Page 1 of 1

Learning NMODL

Posted: Fri Mar 30, 2007 1:41 pm
by tsa
Hello,

I've been trying to develop simple variants on HH sodium and potassium currents in NMODL. My current are based off the examples given in the NMODL tutorial. They compile and insert fine but when I add them to a 1 segment neuron I find no activity in the v, ek, or ena. Here is my code for the sodium current:

NEURON {
SUFFIX na
USEION na READ ena WRITE ina
RANGE gnabar, ena, ina
}

UNITS {
(S) = (siemens)
(mV) = (millivolts)
(mA) = (milliamp)
}

PARAMETER {
gnabar = 28e-9 (S/cm2)
}

ASSIGNED {
v (mV)
ena (mV)
ina (mA/cm2)
gna (S/cm2)
}

STATE { m n }

BREAKPOINT {
SOLVE states METHOD cnexp
gna = gnabar * m^4 *(1-n)
ina = gna * (v-ena)
}

INITIAL {
n = nalpha(v)/(nalpha(v)+nbeta(v))
m = malpha(v)/(malpha(v)+mbeta(v))
}

DERIVATIVE states {
m' = (1-m)*malpha(v) - m*mbeta(v)
n' = (1-n)*nalpha(v) - n*nbeta(v)
}

FUNCTION malpha (Vm (mV)) (/ms) {
UNITSOFF
malpha = (1/(2*0.01))*exp((Vm+34)/10)
UNITSON
}

FUNCTION mbeta (Vm (mV)) (/ms) {
UNITSOFF
mbeta = (1/(2*0.01))*exp(-(Vm+34)/10)
UNITSON
}

FUNCTION nalpha (Vm (mV)) (/ms) {
UNITSOFF
nalpha = (1/(2*10))*exp((Vm+29)/8)
UNITSON
}

FUNCTION nbeta (Vm (mV)) (/ms) {
UNITSOFF
nbeta = (1/(2*10))*exp(-(Vm+29)/8)
UNITSON
}

and here is the potassium current
NEURON {
SUFFIX kd
USEION k READ ek WRITE ik
RANGE gkbar, ek, ik
}

UNITS {
(S) = (siemens)
(mV) = (millivolts)
(mA) = (milliamp)
}

PARAMETER {
gkbar = 11.2e-9 (S/cm2)
}

ASSIGNED {
v (mV)
ek (mV)
ik (mA/cm2)
gk (S/cm2)
}

STATE { n }

BREAKPOINT {
SOLVE states METHOD cnexp
gk = gkbar * n^4
ik = gk * (v-ek)
}

INITIAL {
n = nalpha(v)/(nalpha(v)+nbeta(v))
}

DERIVATIVE states {
n' = (1-n)*nalpha(v) - n*nbeta(v)
}

FUNCTION nalpha (Vm (mV)) (/ms) {
UNITSOFF
nalpha = (1/(2*10))*exp((Vm+29)/8)
UNITSON
}

FUNCTION nbeta (Vm (mV)) (/ms) {
UNITSOFF
nbeta = (1/(2*10))*exp(-(Vm+29)/8)
UNITSON
}

Any help would be greatly appreciated. Thanks!

Posted: Fri Mar 30, 2007 11:57 pm
by ted
Save yourself a lot of time and effort. Use the Channel Builder.

Posted: Sat Mar 31, 2007 9:26 am
by tsa
I am trying to set up a pacemaker model based on Butera 1999a J Neurophysiol. This model uses a sodium current with the gating variable h equal to 1-n. In using ChannelBuilder I saw no way to accomplish this so I turned to NMODL. Is there a way to work around this in ChannelBuilder

Posted: Sat Mar 31, 2007 11:07 am
by ted
I haven't examined the paper (1999a?), but assuming that your functions for nalpha and
nbeta are correct, only a little graphical analysis is needed to discover that the gna
inactivation gate is perfectly suited for the ChannelBuilder.

The problem with the published
gna = gnabar * m^4 *(1-n)
is the (1-n). The solution is to figure out how to convert this to a more orthodox form, i.e.
gna = gnabar * m^4 * h
but the question is how. The key is to realize that ninf (steady state n) is a nice sigmoid of
the form e^x / (e^x + e^(-x)), where x = k(v - d), which increases monotonically from
0 to 1 as x (or v) ranges from -inf to +inf, and is 0.5 when v = d = -29 mV. Then note that
if you substitute h = 1 - n, then hinf = 1 - ninf = e^(-x) / (e^x + e^(-x)), and also note that this
substitution has no effect on the time constant htau = ntau = 1 / (e^x + e^(-x)).

So replace 1 - n with h, and replace k(v - d) with -k(v - d), and the job is done. Using the
ChannelBuilder's notation, both ah and bh will be of the form A*exp(k*(v-d)))--specifically
ah = (1/(2*10))*exp(-(Vm+29)/8)
bh = (1/(2*10))*exp((Vm+29)/8)
so A is 1/20 and d is -29 for both ah and bh, and k is -1/8 for ah but 1/8 for bh.
You will find that this gives a reasonable looking voltage dependence of infh and tauh.
Furthermore, the voltage dependencies of infh and tauh will be identical to those of
(1-ninf) and taun.