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
to
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
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.