Hi
I am trying to reproduce the results of the paper " Excitability of the squid giant axon revisited. J Clay (1998)" (http://www.ncbi.nlm.nih.gov/pubmed/9705477). It has a modified version of the K current where
Ik = gk*n^4*V*[exp(v/24)-ks/ki]/[exp(v/24)-1], where ks is the potassium concentration in the periaxonal space. I am calculating ks and ki from a potassium concentration mechanism that "WRITEs" ks and ki.
In the primary mechanism (hh_clay) that governs the excitable ion channels (modified off the default HH model), I am modifying the Ik current as ik = gk*pow(n,4)*(v)*((exp(v/24)-ko/ki)/(exp(v/24)-1)). I see that I get 'nan' values when I printf ik from the mod file and I get a blank V-t plot(using NEURON with Python) . How can I incorporate ko and ki in the hh_clay.mod file ?
Thanks,
Mohit
USe ko and ki in .mod file
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: USe ko and ki in .mod file
Have you been checking your NMODL code with modlunit?
modlunit filename.mod
will find and report errors that range from incompatible units to undeclared variables.
USEION k READ ki, ko
or maybe you really need this
USEION k READ ki, ks
It might be helpful to review these sections of the Programmer's Reference
https://www.neuron.yale.edu/neuron/stat ... nmodl.html
https://www.neuron.yale.edu/neuron/stat ... modl2.html
modlunit filename.mod
will find and report errors that range from incompatible units to undeclared variables.
Then shouldn't the formula for ik refer to ks instead of ko? Also, what is the upper case V term? Is it (v - Ek) where Ek is the Nernst potential calculated from ki and ks?I am trying to reproduce the results of the paper " Excitability of the squid giant axon revisited. J Clay (1998)" (http://www.ncbi.nlm.nih.gov/pubmed/9705477). It has a modified version of the K current where
Ik = gk*n^4*V*[exp(v/24)-ks/ki]/[exp(v/24)-1], where ks is the potassium concentration in the periaxonal space. I am calculating ks and ki from a potassium concentration mechanism that "WRITEs" ks and ki.
Just put the necessary USEION statement in the NEURON block. Something like this should doHow can I incorporate ko and ki in the hh_clay.mod file ?
USEION k READ ki, ko
or maybe you really need this
USEION k READ ki, ks
It might be helpful to review these sections of the Programmer's Reference
https://www.neuron.yale.edu/neuron/stat ... nmodl.html
https://www.neuron.yale.edu/neuron/stat ... modl2.html
Re: USe ko and ki in .mod file
Thanks for your reply. Indeed, there was an error. Ik should be ik = gk*pow(n,4)*(v)*(exp(v/24)-ko/ki)/(exp(v/24)-1) where v is the membrane voltage and ko is the external potassium concentration (in the periaxonal space). I modified the USEION statement to USEION k READ ki,ko WRITE ik. The mechanism compiles successfully with nrnivmodl, but shows the following error with nrnmodlunit hhrx_clay.mod
Checking units of hhrx_clay.mod
0.001 m2-kg/sec2-coul
The previous expression is not dimensionless at line 88 in file hhrx_clay.mod
ik = gk*pow(n,4)*(v)*(exp(v/24<<ERROR>>)-ko/ki)/(exp(v/24)-1)
I am guessing that NEURON is not happy with dividing v with a dimensionless number of 24. Infact, 24 is the result of RT/F at T = 8 (degC). DOes it affect the calculation of ik ?
Thanks,
Mohit
Checking units of hhrx_clay.mod
0.001 m2-kg/sec2-coul
The previous expression is not dimensionless at line 88 in file hhrx_clay.mod
ik = gk*pow(n,4)*(v)*(exp(v/24<<ERROR>>)-ko/ki)/(exp(v/24)-1)
I am guessing that NEURON is not happy with dividing v with a dimensionless number of 24. Infact, 24 is the result of RT/F at T = 8 (degC). DOes it affect the calculation of ik ?
Thanks,
Mohit
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: USe ko and ki in .mod file
That would bemganguly wrote:The mechanism compiles successfully with nrnivmodl, but shows the following error with nrnmodlunit hhrx_clay.mod
modlunit hhrx...
modlunit has two weaknesses. First, it is absolutely finicky about units, even in cases where you and I would know that there isn't a "real" problem. exp(v/24) is the kind of thing that stops modlunit in its tracks. modlunit's second weakness is that the first time it runs into a unit inconsistency or syntax error, it stops and won't check anything else. To look for anything else that may be wrong, you must first fix the error that stopped it, and run modlunit again.
The message you got happens because exp() requires a dimensionless argument, but v/24 is in millivolts. The solution is to change v/24 to v/(24 (millivolt))--which tells modlunit that the 24 has units of millivolt. If the mod file has a UNITS block that declares
(mV) = (millivolt)
you could write
v/(24 (mV))
"That's not as bad as having to write v/(24 (millivolt)) but it's still a pain because there are so many places in the code that will need this change. Why does anybody bother with modlunit?"
Two reasons:
First, it's real good at finding the serious mistakes that are so easy to miss when you're re-reading your own code for the umpty-leventh time.
Second, because warns you of serious problems with incompatible units, and can even tell you the numeric value of scale factors.
Even so, it can be a real pain to add all of the units hints that a FUNCTION or PROCEDURE may need. Sometimes it's just easier to wrap such blocks of code inside a UNITSOFF . . . UNITSON pair.
Re: USe ko and ki in .mod file
Great ! That solved the modlunit issue. I am just curious, what does the symbol "?" mean in the .mod file? Like '? interface', or '? currents' etc ?
Thanks,
Mohit
Thanks,
Mohit
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: USe ko and ki in .mod file
The question mark can be used as a single line comment delimiter in NMODL; might even be advantageous over the usual delimiter (on some laptop displays it can be very easy to overlook :, especially for people with undercorrected astigmatism). I seem to recall that some primitive interpreter such as BASIC had a similar feature.
Re: USe ko and ki in .mod file
Thanks for the response.
Mohit
Mohit