modlunit and mknrndll not working in MSWindows

Post Reply
kxm
Posts: 3
Joined: Fri Dec 10, 2010 10:22 pm

modlunit and mknrndll not working in MSWindows

Post by kxm »

I am new in Neuron Software and this might be an easy problem but I will really appreciate if anyone can help .I have been trying to use one of the model in database(Selective control of cortical axonal spikes by a slowly inactivating K+ current (Shu et al. 2007)). It has mod files in the zip file and I tried to compile those mod files since it was giving me an syntax error when tried to use them with Neuron. However, when I try to use modlunit or mknrdll, the window I am supposed to work on it flashes and disapperas right away. I have tried couple of other computers but still same problem
I can open demos with mod files, like release demo, and get results with NeuronDemo. I tried many things to solve this problem but no success yet.
I am using vista64 and Neuron 7.2.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: modlunit and mknrndll not working in MSWindows

Post by ted »

When you double click on nrngui, what is the first line that appears in NEURON's xterm?
kxm
Posts: 3
Joined: Fri Dec 10, 2010 10:22 pm

Re: modlunit and mknrndll not working in MSWindows

Post by kxm »

Thanks very much Ted.That one sentence was enough to take care of my problem. I was trying the modlunit in C/Nrn72/bin and it was not opening. When I used modlunit in the same directory of nrngui,it worked. I am able to check and compile mod files now. However I have little problem with the mod files that I took from DataBase. It is called "Selective control of cortical axonal spikes by a slowly inactivating K+ current (Shu et al. 2007) " I need to take results from that model for my project. Any idea would be a great help.

When I check those mod files with modlunit it basically gives me same error in all mod files. This is the one I am getting for only kd mod file. Others look same too:


units: 0.001 m2-kg/sec2-coul

units: 1
The units of the previous two expressions are not conformable
at line 47 in file ./kd.mod
trates(v<<ERROR>>)
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: modlunit and mknrndll not working in MSWindows

Post by ted »

kxm wrote:I was trying the modlunit in C/Nrn72/bin and it was not opening. When I used modlunit in the same directory of nrngui,it worked.
Typically, MSWin users start nrniv, modlunit, mknrndll etc. by clicking on icons in the NEURON Program Group (or clicking on icons that were copied from the NEURON Program Group to the Desktop). Are you starting these programs by doing something else, like running modlunit from the command line of an rxvt shell?
I have little problem with the mod files that I took from DataBase.

It is called "Selective control of cortical axonal spikes by a slowly inactivating K+ current (Shu et al. 2007) "
Entry 135898 in ModelDB
http://senselab.med.yale.edu/modeldb/sh ... del=135898
right?
When I check those mod files with modlunit
Excellent--you're checking code before you use it. Very important.
it basically gives me same error in all mod files.
. . .

Code: Select all

units:  0.001 m2-kg/sec2-coul

units:  1 
The units of the previous two expressions are not conformable
 at line 47 in file ./kd.mod
        trates(v<<ERROR>>)
When I check kd.mod with modlunit, I see this error message

Code: Select all

celsius must have the units, degC, instead of .
 at line 4 in file kd.mod
and then modlunit quits. The fix is easy: in the PARAMETER block change

Code: Select all

celsius
to

Code: Select all

celsius (degC)
Actually, celsius should be declared in the ASSIGNED block because celsius, like membrane potential v, is an "assigned variable" that gets its value from _outside_ of the kd mechanism (from hoc, actually). Any attempt to specify the value of celsius in a mod file will be overridden by the value that hoc knows (6.3 degC by default, but can be changed by a simple hoc statement like
celsius = 20).

Anyway, after one fixes the units of celsius, checking kd.mod with modlunit now produces the message you're concerned about. This happens because v has units of (mV), but the trates() procedure is declared by a block of code that starts
PROCEDURE trates(v) {
which tells NMODL that trates() expects an argument that is dimensionless (has no units). The fix, of course, is to change this to
PROCEDURE trates(v (mV)) {

And now modlunit has this complaint:

Code: Select all

        1 K
The previous expression is not dimensionless at line 60 in file kd.mod
        qt=q10^((celsius-22)/10)<<ERROR>>
This is because celsius is in (degC), but 22 and 10 are dimensionless. So fix this by changing

Code: Select all

qt=q10^((celsius-22)/10)
to

Code: Select all

qt=q10^((celsius-22 (degC))/(10 (degC)))
and be careful with those parentheses!

But of course modlunit still isn't happy--

Code: Select all

        0.001 m2-kg/sec2-coul
The previous expression is not dimensionless at line 61 in file kd.mod
        minf=1-1/(1+exp((v-vhalfm)/km<<ERROR>>))
because exp() expects an argument that is dimensionless. v and vhalfm have units of (mV) but km is dimensionless, so change the declaration of km in the PARAMETER block to
km=8 (mV)

And modlunit finds a similar problem with the formula for hinf, and the fix is similar: change the declaration of kh to
kh=7.3 (mV)

And finally modlunit reports nothing wrong with kd.mod.

Does this mean that the original kd.mod was "incorrect", but now it is "correct"? Does changing the declaration of km from
km=8
to
km=8 (mV)
make this assignment statement
minf=1-1/(1+exp((v-vhalfm)/km))
give minf a different numeric value? And will this assignment statement
qt=q10^((celsius-22)/10)
produce a different value for qt than this one
qt=q10^((celsius-22 (degC))/(10 (degC)))
?

No. These units inconsistencies are all benign.* They were all fixable without having to multiply anything by a numerical scale factor. So if the original code was a faithful transcription of the mathematical equations that describe the kd mechanism, it was calculating numerically correct results. But notice that I write if, and I mean IF. It's very easy to overlook something, to leave something out or to insert something that shouldn't be there, or to type a + instead of a - or vice-versa. You should still compile the mechanism, insert it into a single compartment model, specify the conductance density that you want and also the desired value of celsius, and run a voltage clamp experiment to make sure that the currents have the correct size and reasonable looking time course. Remember, when using anyone else's code, the rule is always TRUST BUT VERIFY.

*--Sometimes model authors wrap NMODL code inside a pair of
UNITSOFF . . . UNITSON
keywords. This tells modlunit to ignore the code inside the UNITSOFF . . . UNITSON pair, and allows modlunit to check the other NMODL statements. This is OK if you really know what you're doing and are absolutely sure that the code you're not checking doesn't contain any units errors that might require scale factors, or any of the syntax errors that modlunit can detect. But never forget that it's not what you don't know that gets you into trouble--it's what you know for sure that ain't so. Or, as the ancients said, hubris tempts the gods.
kxm
Posts: 3
Joined: Fri Dec 10, 2010 10:22 pm

Re: modlunit and mknrndll not working in MSWindows

Post by kxm »

That was a great help Ted. Thank you. Now I can use that code with confidence. My project is comparing K currents effect on axon. I will include that kd mechanism in axon and compare it with the hh mechanism. I only have to figure out how to see its gradual effect by varying channels properties. Thanks again for your quick and useful response
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: modlunit and mknrndll not working in MSWindows

Post by ted »

Thanks for using NEURON in your project, and also for asking a question that has me thinking about a new addition to the online documentation.
Post Reply