Page 1 of 1

NMODL mechanism using two USEION statements

Posted: Fri Jan 04, 2008 4:39 pm
by joe1234
I'm translating a GENESIS model into NEURON and the 10 NMODL mechanisms all work the same in my nrn model as in the genesis one, with one exception. The trouble-maker is an Sk channel, a calcium-dependent potassium channel, reading calcium concentration from a 200 nM shell below the cell membrane. The calcium concentration mechanism works fine. Can anyone see something wrong in the following code, for example with the double USEION statements in the NEURON block? Or with the TABLE lower down? Thanks a lot! /Joe

NEURON {
SUFFIX Sk
USEION ca READ cai VALENCE 2
USEION k READ ek WRITE ik
RANGE gbar, z, ik
}

UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(molar) = (1/liter)
(mM) = (millimolar)
}

PARAMETER {
gbar = 1e-5 (siemens/cm2) :default value, change in hoc
}

ASSIGNED {
v (mV)
ek (mV) : set ek to -90 (mV) from hoc
ik (mA/cm2)
cai (mM)
zinf
tauz (ms)
}

STATE {
z :calcium-dependent activation variable
}

INITIAL {
rate(cai)
z = zinf
}

BREAKPOINT {
SOLVE states METHOD cnexp
ik = gbar * z * (v - ek)
}

DERIVATIVE states {
rate(cai)
z' = (zinf - z) / tauz
}

PROCEDURE rate(cai(mM)) {
TABLE zinf, tauz FROM 0 TO 0.01 WITH 300
UNITSOFF
zinf = cai*cai*cai*cai / (cai*cai*cai*cai + 8.1e-15)

if (cai < 0.005) {
tauz = 1 - (186.67 * cai)
} else {
tauz = 0.0667
}
UNITSON
}

Posted: Sun Jan 06, 2008 11:09 am
by Raj
Does it compile?
If not what are the error messages?

Posted: Mon Jan 07, 2008 3:47 am
by joe1234
Thanks for your reply Raj. I've finally, after two weeks of bug hunting, found the fault elsewhere in the model. Now it works beautifully!
So nothing's wrong with the code I gave, it seems.
Thanks again,

Joe