unit inconsistencies between my files

NMODL and the Channel Builder.
Post Reply
char4040

unit inconsistencies between my files

Post by char4040 »

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. I then created my own passive channel with the units set for i, g, and v as uA/cm2, mS/cm2, and mV respectively and compared the default pas compared to my own passive channel, each with g=.0001, in a cell containing only the distributed passive channels and an IClamp injecting a pulse of current amp=1. When compared to the default pas channel, the responses obtained were exactly the same: raising the voltage from its resting potential at -70mV to approximatley -64mV with a time constant of 10 msec. In the case of g=.0001mS/cm2 as in the revised pas channel, the voltage should have time constant of 10 sec, yet instead it still changes over about 0.1 sec.

I am hoping that you could help clarify how NEURON accounts for units changes and why the voltage of the cell responds the same when conductance is the same value but in S or mS. Attached below are the files I have written to test this.

Code: Select all

TITLE adjusted passive membrane channel

UNITS {
	(mV) = (millivolt)
	(uA) = (microamp)
	(mS)=(millisiemens)
}

NEURON {
	SUFFIX mypas
	NONSPECIFIC_CURRENT i
	RANGE g, e
}

PARAMETER {
	g = .0001	(mS/cm2)	<0,1e9>
	e = -70	(mV)
}

ASSIGNED {v (mV)  i (uA/cm2)}

BREAKPOINT {
	i = g*(v - e)
}

run using:

Code: Select all

load_file ("nrngui.hoc")

create soma
access soma
insert mypas
g_mypas=1e-4 

objref p
p=new IClamp(0.5)
p.del=100
p.dur=100
p.amp=1

c=1

tstop=300

forall psection()
Thanks,
Char
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Did you run modlunit on both variants of your mod-file?

It is the developers responsibility to make sure that internal to the mod-file th e units are correct. Modlunit helps you with that by checking whether the units are consistent. From what you describe I wouldn't be surprised that you find errors in one or both of your mod-files variants.
char4040

Post by char4040 »

No. I haven't run modlunit-that has not been working for me either. I have posted on this elsewhere with no positvie results thusfar.
ted
Site Admin
Posts: 6392
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: unit inconsistencies between my files

Post by ted »

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

Code: Select all

   i = (0.001)*g*(v - e)
"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
}
char4040

Post by char4040 »

Thanks for the help -- that works. One curiosity and one more question: I typo'd on the units of capacitance, but meant to say that I assume the units are uF/cm^2. If this is true, then it is my understanding that the default units in NEURON are not self-consistent:

C dV/dt = i_membrane

It is my understanding that:
C's default is uF/cm^2
V's default is mV
t's default is ms
i_membrane (for density mechanisms) is mA/cm^2.

This does not seem consistent--seemingly, i should be uA/cm^2?

This leads to my question: it sounds from your previous reply that NONSPECIFIC_CURRENTs and WRITE statements need to be in mA/cm^2. Are there other restrictions on the units that variables need to be in--I couldn't find anything about this in The NEURON Book.
ted
Site Admin
Posts: 6392
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

char4040 wrote:I typo'd on the units of capacitance, but meant to say that I assume the units are uF/cm^2. If this is true, then it is my understanding that the default units in NEURON are not self-consistent:

C dV/dt = i_membrane

It is my understanding that:
C's default is uF/cm^2
V's default is mV
t's default is ms
i_membrane (for density mechanisms) is mA/cm^2.

This does not seem consistent--seemingly, i should be uA/cm^2?
The units are consistent with common usage by experimentalists. In membrane
biophysics, specific membrane conductance is in uf/cm2, specific ionic conductances
are in S/cm2, and electrical potential is in mV. For consistency with experimental cellular
neurophysiology, time is in ms.

Note that S/cm2 * mV has units of mA/cm2, i.e. the units of specific capacitance, current
density, and potential are consistent in the steady state.

As you point out, the apparent inconsistency has to do with the relationship between
current density, specific membrane capacitance, and rate of change of membrane
potential. But this is only an apparent inconsistency, which NEURON resolves
internally by applying appropriate scale factors when it sets up the data structures
for solving the cable equation. This allows experimentalists to think in terms of
familiar units.
This leads to my question: it sounds from your previous reply that NONSPECIFIC_CURRENTs and WRITE statements need to be in mA/cm^2. Are there other restrictions on the units that variables need to be in--I couldn't find anything about this in The NEURON Book.
Try top of page 212 for a start. Also see "What units are used in NEURON?" in the
"Hot tips" section of the Forum.
Post Reply