Code: Select all

```
NEURON {
SUFFIX nap_ch
USEION na READ ena WRITE ina
RANGE gnabar, gna, ina
GLOBAL m_inf
}
UNITS {
(S) = (siemens)
(mV) = (millivolt)
(mA) = (milliamp)
}
PARAMETER {
gnabar = 0.0001 (S/cm2)
ena = 45 (mV)
}
ASSIGNED {
v (mV)
ina (mA/cm2)
gna (S/cm2)
m_inf
}
STATE { m }
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gnabar * m
ina = gna * (v - ena)
}
INITIAL {
m = m_inf
}
DERIVATIVE states {
rates(v)
noise(m)
UNITSOFF
m' = (m_inf - m)/0.1
UNITSON
}
PROCEDURE rates(v (mV)) {
m_inf = (1/(1+exp(-(v+50)/3.0 (mV))))
}
PROCEDURE noise(m) {
LOCAL randflag, dpa, dpb, dpz
:generate the random term
srand ( time(NULL) )
:generate randomflag between 0 and 1
randflag = roundf(rand()/(2^31-1))
if (randflag == 1){
dpa = cos(2*(22/7)*rand()/(2^31-1))
}
if (randflag == 0){
dpa = sin(2*(22/7)*rand()/(2^31-1))
}
dpb = -2*.001*(m_inf + m - 2*m_inf*m)/(300*.1)
dpz = dpa*(dpb*log(rand()/(2^31-1)))^(1/2)
m = m + dpz
if (m<0)
{
m=0
}
if (m>1)
{
m=1
}
}
```