eca calculation

Anything that doesn't fit elsewhere.
Post Reply
roybens
Posts: 54
Joined: Fri Mar 14, 2008 7:57 am

eca calculation

Post by roybens »

Hi,
I wanted to ask how does NEURON knows when to calculate eca from cai and cao or not to. For example in Mainen's model https://senselab.med.yale.edu/modeldb/s ... %2F#tabs-1 the eca is always 140. But when using one of the BBP models from their portal it is updated every timestep. How does the environment knows if to calculate eca or keep it constant?
Thanks in advance
Roy
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: eca calculation

Post by ted »

Good question. Read the Programmer's Reference documentation of ion_style.
roybens
Posts: 54
Joined: Fri Mar 14, 2008 7:57 am

Re: eca calculation

Post by roybens »

Thank, Ted!
This is very helpful.
roybens
Posts: 54
Joined: Fri Mar 14, 2008 7:57 am

Re: eca calculation

Post by roybens »

I am a bit confused trying to figure this out. From the program reference i get this:
The oldstyle value is previous internal setting of c_style + 4*cinit + 8*e_style + 32*einit + 64*eadvance.

c_style: 0, 1, 2, 3.
Concentrations respectively treated as UNUSED, PARAMETER, ASSIGNED, or STATE variables. Determines which panel (if any) will show the concentrations.
e_style: 0, 1, 2, 3.
Reversal potential respectively treated as UNUSED, PARAMETER, ASSIGNED, or STATE variable.
einit: 0 or 1.
If 1 then reversal potential computed by Nernst equation on call to finitialize() using values of concentrations.
eadvance: 0 or 1.
If 1 then reversal potential computed every call to fadvance() using the values of the concentrations.
cinit: 0 or 1.
If 1 then a call to finitialize() sets the concentrations to the values of the global initial concentrations. eg. nai set to nai0_na_ion and nao set to nao0_na_ion.
But when i call it in the Mainen model at the soma i get 136 - so i assume that eadvance is 2 - 136/64. But eadvance gets only 0 or 1, what does 2 means.
In the BBP model i get 247 thus eadvance is 3 so i am probably misunderstood the documentation. Please help.
Thanks
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: eca calculation

Post by ted »

The documentation leads one to believe that

Code: Select all

the numeric result returned by ion_style("name_ion")
can be interpreted as the 7 bit binary value
b6 b5 b4 b3 b2 b1 b0
where
b1 b0 is c_style
b2    is cinit
b4 b3 is e_style
b5    is einit
b6    is eadvance
However, as you have noted,
soma print ion_style("ca_ion")
returns the decimal value 136, and the corresponding binary number is the 8 bit value
1 0 0 0 1 0 0 0

Analyzing the model with the ModelView tool confirms that the soma has the cad mechanism, and examining cad.mod, which WRITEs cai, shows that cai is a STATE variable whose value is calculated at every advance, so c_style should be 3 (b1 b0 should be 1 0).
The PARAMETER cainf in cad.mod is used to specify the initial value of cai, but the value of ca0 comes from the global initial concentration cao0_ca_ion. Does that mean that cinit (b2) should be 1 instead of 0?
By default, NEURON should calculate eca at every advance (b6 should be 1) and also at initialization (b5 should also be 1), and eca would be treated as an ASSIGNED variable (b4 b3 (e_style) would be 10 i.e. decimal 2).

So I come up with the binary number
1 1 1 0 ? 1 0
(where the ? is the value of cinit (b2)), which corresponds to decimal 7*16 + 2 + maybe 4 = 114 or 118, depending on whether b2 is 0 or 1.

And now I myself have more questions than answers.
roybens
Posts: 54
Joined: Fri Mar 14, 2008 7:57 am

Re: eca calculation

Post by roybens »

:-) thanks Ted, ill continue investigating!
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: eca calculation

Post by hines »

from nrn/src/nrnoc/eion.c

Code: Select all

/*the bitmap is
03      concentration unused, nrnocCONST, DEP, STATE
04      initialize concentrations
030     reversal potential unused, nrnocCONST, DEP, STATE
040     initialize reversal potential
0100    calc reversal during fadvance
0200    ci being written by a model
0400    co being written by a model
*/
So it seems the 0200 and 0400 octal bits in regard to ci and co being written by a model are not described in the
documentation ion_style return value. (note these bits cannot be set via ion_style as they refer to a fact that is derived from the manifest
of membrane mechanisms that happen to have been inserted in the relevant section).
roybens
Posts: 54
Joined: Fri Mar 14, 2008 7:57 am

Re: eca calculation

Post by roybens »

Thanks Micheal,
Now the results i got from ion_style does make sense.
Best
Roy
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: eca calculation

Post by ted »

Correction to my post from 1/31--

cai is a state, and its value is initialized in cad.mod. so b2 b1 b0 should be 1 1 1
and the 7 bit number is
1 1 1 0 1 1 1

So why does ion_style"ca_ion") return 1 0 0 0 1 0 0 0 ? According to that value,
eca is NOT recalculated at every advance,
eca is NOT calculated on initialization from cai and cao
eca is UNUSED
on initialization, cai and ca0 are set to the global initial concentrations cai0_ca_ion and cao0_ca_ion
and cai and cao are UNUSED.

Which makes no sense, since
soma psection()
reveals that the soma has the cad mechanism, which READs ica and cai and WRITEs cai,
and also has the "ca" mechanism, which READs eca.

Regardless of what does or doesn't happen to the 0200 and 0400 octal bits, why does
soma print ion_style("ca_ion")
return 136?
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: eca calculation

Post by hines »

Using
neurondemo -python
#select release model

Code: Select all

from neuron import h
bin(int(h.ion_style("ca_ion", sec=h.terminal)))
yields
'0b11110111'
If you send me the code fragment that returns

Code: Select all

>>> bin(136)
'0b10001000'
I can look into it in more detail.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: eca calculation

Post by ted »

For the benefit of others who may read this--
hines points out that the model setup code in demofit1.hoc executes

Code: Select all

  forall if(ismembrane("ca_ion")) {
    . . .
    ion_style("ca_ion",0,1,0,0,0)
    . . .
  }
after a calcium channel mechanism has been inserted into the soma. This overrides the "automatic ion_style" settings.
Post Reply