I fixed your NMODL and hoc code so that it looks like code and doesn't lose its
formatting--see "Preserving code formatting"
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=493
char4040 wrote:I looked at the default passive channel mod file and noticed that the units were in mA/cm2 for current, S/cm2 for conductance, and mV for voltage; however, I don't see how this is consistent with the default setting for capacitance which is microfarads/mS.
It's not, but the units of capacitance aren't microfarads per milliSiemens either.
NEURON's cm is in density units, i.e. uf/cm2.
I then created my own passive channel with the units set for i, g, and v as uA/cm2, mS/cm2, and mV respectively
So
i = g*(v-e)
is dimensionally consistent, and you expected that your new mechanism would work
just fine. However, a density current that is declared in a NONSPECIFIC_CURRENT
statement, or in a WRITE statement, must be in units of milliamp/cm2. Too bad modlunit
has a bug, or it would have given you a warning message.
What's happening here is that the numeric values of i, which your mechanism is
generating, are being passed to NEURON's internal routines for dealing with charge
balance, where they are being treated as if they were in milliamp/cm2. So your
mechanism's i is having an effect that is 1000 times too strong.
NMODL doesn't fix this stuff for you. You have to fix it yourself.
The fix is to change the units of i to milliamp/cm2, and then run modlunit to see if the
fix broke anything. modlunit would then tell you
Code: Select all
The previous primary expression with units: 0.01 coul/m2-sec
is missing a conversion factor and should read:
(0.001)*()
at line 27 in file charpas.mod
i = g*(v - e)<<ERROR>>
which means you should rewrite the assignment statement as
"But I really want to have a current variable whose units are uA/cm2" you might say.
Fine. Do that by adding an auxilary variable that has your desired scaling.
Here's how to add such an auxiliary variable, called ip:
Change the RANGE statement to
RANGE g, e, ip
To the ASSIGNED block add this statement
ip (uA/cm2)
Change the BREAKPOINT block to
Code: Select all
BREAKPOINT {
ip = g*(v - e)
i = (0.001)*ip
}