Implementation of a network of spiking neuron (Morris Lecar)


#1

I am trying to implement Morris-Lecar model for a network. I have tested the code for single neuron and it worked correctly, but there is a problem when I turn on the synaptic current.

here is the integration part of the code:

for (int it=1; it<num_steps; it++)
    {
        t = it * dt;    //current time
        ts = ts_new;    //vector includes the times of spikes 
        for (int i = 0; i < N; i++)
        {
            // define synaptic current
            for (int j = 0; j < N; j++)
                if(Cij[i][j]!=0)
                {
                    Isyn[i] += coupling[i] * exp(-(t - ts[j]) * inv_tau ) * (Esyn - V[i]);
                }
            
            M_inf[i] = 0.5 * (1 + tanh((V[i] - v1) / v2));
            W_inf[i] = 0.5 * (1 + tanh((V[i] - v3) / v4));
            Tau_W[i] = phi * cosh((V[i] - v3) / (2.0 * v4));
            // std::cout <<Isyn[i]<< "\n";
            
            f[i] =  c_inv * (Iext[i] + Isyn[i] -\
                    gl * (V[i] - vl) -\
                    gca * M_inf[i] * (V[i] - vca) -\
                    gk * W[i] * (V[i] - vk));
            
            f[i + N] = (W_inf[i] - W[i]) * Tau_W[i];
            
            V[i] += (f[i] * dt);
            W[i] += (f[i+N]*dt);
            
            if ((V[i]>Esyn) && s[i]==0)
            {
                ts_new[i] = t;
                s[i] = 1;
            }
            else 
                s[i] = 0;
        }
        if ((it%step_print==0) && (it > index_transition))
        {
            oS.write((char *)&s[0], s.size()*sizeof(int));
            oV.write((char *)&V[0], V.size()*sizeof(double));
            counter ++;
        }
    }

I used “Synchronization properties of heterogeneous neuronal networks with mixed excitability type” as a reference.
I appreciate in advance for any guide.