FS_neuron::FS_neuron(const vector<double>& param) { // set neuron params from vector V = param[0]; ENa = param[1]; // mv Na reversal potential EK = param[2]; // mv K reversal potential El = param[3]; // mv Leakage reversal potential gbarNa = param[4]; // mS/cm^2 Na conductance gbarK = param[5]; // mS/cm^2 K conductance gl = param[6]; fi = param[7]; Iextmean = param[8]; variance = param[9]; unsigned int seed = chrono::system_clock::now().time_since_epoch().count(); generator = new default_random_engine (seed); normRand = new normal_distribution <double> (Iextmean, variance); Iext = (*normRand)(*generator); // Iext generate from normal distribution m = alpha_m() / (alpha_m() + beta_m()); n = alpha_n() / (alpha_n() + beta_n()); h = alpha_h() / (alpha_h() + beta_h()); gNa = gbarNa*m*m*m*h; gK = gbarK*n*n*n*n; Isyn = 0; countSp = true; th = -20; }
void FS_neuron::integrate (double dt, double duraction) { double t=0; int i=0; while (t < duraction) { V = V + dt*(gNa*(ENa - V) + gK*(EK - V) + gl*(El - V) - Isyn + Iext); m = alpha_m() / (alpha_m() + beta_m()); n = n_integrate(dt); h = h_integrate(dt); gNa = gbarNa*m*m*m*h; gK = gbarK*n*n*n*n; Iext = (*normRand)(*generator); Isyn = 0; i++; t+=dt; } }
double m_inf(const double V_tilde) { return alpha_m(V_tilde)/(alpha_m(V_tilde)+beta_m(V_tilde)); }
static inline double tau_m(double V) { return 1.0 / (alpha_m(V) + beta_m(V)); }
static inline double m_inf(double V) { return alpha_m(V) / (alpha_m(V) + beta_m(V)); }