Sodium Dependent Membrane Capacitance

Anything that doesn't fit elsewhere.
Post Reply
unluerdincer
Posts: 2
Joined: Tue Nov 30, 2010 11:59 am

Sodium Dependent Membrane Capacitance

Post by unluerdincer » Mon Dec 05, 2011 5:14 pm

Hi,

I am trying to modify my mod file to add sodium dependent capacitance to my basic HH equations. In HH equations, Cm is a constant that does not vary with membrane voltage. I would like to split my capacitance to two parts by setting "Cm = 0.88 + 0.13 (1-m)" where m is the sodium activation.

I tried to code this in my mod file and could not make it function. Every time I tried to change the value of Cm in the mod file, the hoc file sets back the Cm to 1, so regardless of my coding, I get the same result.

Is there any way I could code this in the hoc file? Anything I tried in the mod file did not work. Thanks a lot for your help.

ted
Site Admin
Posts: 5057
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Sodium Dependent Membrane Capacitance

Post by ted » Tue Dec 06, 2011 10:24 am

unluerdincer wrote:I am trying to modify my mod file to add sodium dependent capacitance to my basic HH equations. In HH equations, Cm is a constant that does not vary with membrane voltage. I would like to split my capacitance to two parts by setting "Cm = 0.88 + 0.13 (1-m)" where m is the sodium activation.
That's not going to work, as you found out.

Leaving aside the question of why this would be a useful thing to do . . . your best bet is to use a custom proc advance()

Code: Select all

proc advance() {
  forall if (ismembrane("hh")) {
    for (x,0) cm(x) = 0.88+0.13*(1-m)
  }
  fadvance()
}
This will not work with adaptive integration. It could be modified to allow adaptive integration by inserting

Code: Select all

if (cvode.active()) cvode.re_init()
just before the fadvance() call.

I would expect a noticeable performance penalty, especially with adaptive integration.

hines
Site Admin
Posts: 1436
Joined: Wed May 18, 2005 3:32 pm

Re: Sodium Dependent Membrane Capacitance

Post by hines » Tue Dec 06, 2011 10:58 am

I'm out of town this week but when I return I'll look in my archives (quite a few years back)
to resurrect the proper idiom for capacitance that is changing in time.
I think that is better than
trying to redevelop it here. The basic issue that has to be dealt with is that the
equation is no longer c*dv/dt = ... but is d(cv)/dt so there is an extra term of the
form v*(dc/dt).
I kind of remember that a mod file was written to handle changing membrane
area (due to vesicle release etc.).

unluerdincer
Posts: 2
Joined: Tue Nov 30, 2010 11:59 am

Re: Sodium Dependent Membrane Capacitance

Post by unluerdincer » Tue Dec 06, 2011 12:28 pm

Dear Ted, Hines,

Thank you for your quick response. I have tried to add the following proc advance() to my code. Now my code runs, but still it does not update the cm. With or without the procedure, the action potential generated looks exactly the same. I was expecting a difference in the velocity of the APs. Is there anything I am doing wrong with the procedure? Once again thanks a lot for your help and guidance.

Dincer

load_file("nrngui.hoc") // loads the library that contains Neuron's GUI tools

chdir("./nrn71/aps/")

create axon // creates the axon (long axon)
axon {
nseg = 1000 // number of segments - always ODD
L = 81000 // length (um)
diam = 100 // diameter (um)
Ra = 34.5 // resistance (ohm-cm)
celsius = 10 // temperature (C)
insert hh // insert Huxley-Hodgkin mechanism
}
axon psection() // displays the properties of soma

proc advance() {
forall if (ismembrane("hh")) {
for (x,0) cm_hh = 0.88+0.13*(1-m_hh)
}
if (cvode.active()) cvode.re_init()
fadvance()
}

objectvar stim1 // creates an object variable named stim1
axon stim1 = new IClamp(0.0) // inserts a current clamp into the middle of the soma
stim1.del = 10 // sets the delay until the onset of the stimulus (ms)
stim1.dur = 0.2 // sets the duration of the stimulus (ms)
stim1.amp = 1001 // sets the amplitude of the stimulus (nA)

dt = 0.001 // simulation step size (ms)
tstop = 50 // simulation stop time (ms)
//steps_per_ms = 1000 // points plotted/ms

hines
Site Admin
Posts: 1436
Joined: Wed May 18, 2005 3:32 pm

Re: Sodium Dependent Membrane Capacitance

Post by hines » Tue Dec 06, 2011 2:32 pm

1) you are not changing cm but your own scalar cm_hh which is not a range
variable and has nothing to do with hh
2) if you have more than one segment in a section then range variable syntax that
you should use is cm(x) and not cm which refers to cm(.5)
3) cvode cannot possibly work using continuous reinitialization, you will never get
more than an infinitesimal dt step.
4) you are missing a possibly important term which is also probably not computable
with cvode but would probably require the DAE solver. I may be mistaken about
cvode.

Feel free to try the fixed step method with your changing cm(x). At least the
capacitance will change in
those circumstances.

ted
Site Admin
Posts: 5057
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Sodium Dependent Membrane Capacitance

Post by ted » Tue Dec 06, 2011 2:56 pm

hines wrote:2) if you have more than one segment in a section then range variable syntax that
you should use is cm(x) and not cm which refers to cm(.5)
Quite true. I have accordingly revised the proc advance() in my earlier post from today.

ted
Site Admin
Posts: 5057
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Sodium Dependent Membrane Capacitance

Post by ted » Tue Dec 06, 2011 3:01 pm

I have moved this entire thread from "NEURON + Python" to "Other questions" because from the start it has had nothing to do with Python. After other participants have caught up with this change, I will remove this explanatory message and leave the rest of the thread intact.

AntonioC1980
Posts: 3
Joined: Fri Sep 25, 2015 8:17 am

Re: Sodium Dependent Membrane Capacitance

Post by AntonioC1980 » Thu Jul 20, 2017 7:07 pm

Dear M. Hines,
I would like to know if you found the "proper idiom for capacitance that is changing in time" and if eventually you could provide an example on how to implement the code.
Many thanks for your assistance!

hines
Site Admin
Posts: 1436
Joined: Wed May 18, 2005 3:32 pm

Re: Sodium Dependent Membrane Capacitance

Post by hines » Fri Jul 21, 2017 9:53 am

I did not find it but I believe I have been able to re-invent it. I believe the idea is sound but it could certainly use more testing. To my surprise the example that began this thread has very little effect on the
action potential. The standard hh.mod file has been transformed into hhdcdt.mod . All the added lines are indented by just two spaces instead of a tab. Please carefully consider the long commnet that has been added.
Here is the diff

Code: Select all

hines@hines-T7500:~/tmp$ diff ~/neuron/nrn/src/nrnoc/hh.mod hhdcdt.mod
1a2,19
> 
> : modified to take into account sodium gating capacitance (perhaps wrongly)
> : But provides an example of how to manage variable capacitance using
> : the relation q = c*v so that i = (c*dv/dt) + (dc/dt * v)
> : The gating capacitance is assumed to be c = c0 + c1*(1 - m_hh)
> : The effect of changing capacitance on the (c*dv/dt) term is accomplished
> : via a POINTER to the compartment cm (set up in hoc) where the c pointer
> : is assigned a value in the BEFORE BREAKPOINT block.  The effect of
> : the (dc/dt * v) term is accomplished in the BREAKPOINT block (note that
> : dc/dt = -c1 * dm_hh/dt = -c1 * ( minf - m/mtau ). It is a computaionally
> : experimental question for me if it is safe to use Dm for ( minf - m/mtau).
> : (the answer is no, for both the fixed and variable step methods.)
> : My confidence that this last term (dc/dt * v) is physically correct is low.
> : But this model is about how to solve a time varying capacitance
> : equation in NEURON, not whether
> : the equation is a conceptually valid model of the biophysics.
> : To allow a better undertanding of the role of the two terms of d(c*v)/dt,
> : the flag use_dc_dt can be used to turn the second term on or off.
24c42,43
<         SUFFIX hh
---
> 	THREADSAFE : assigned GLOBALs will be per thread
>         SUFFIX hhdcdt
28a48,50
>   GLOBAL usedcdt
>   RANGE c0, c1
>   POINTER c
30d51
< 	THREADSAFE : assigned GLOBALs will be per thread
33a55,57
>   usedcdt = 1
>   c0 = 0.88 (microfarad/cm2)
>   c1 = 0.13 (microfarad/cm2)
44a69,70
>   c (microfarad/cm2)
>   idc (mA/cm2)
58a85,94
> BEFORE BREAKPOINT {
>   VERBATIM
>   if (_p_c) {
>   ENDVERBATIM
>     c = c0 + c1*(1 - m)
>   VERBATIM
>   }
>   ENDVERBATIM
> }
> 
66a103,114
>   idc = 0
>   VERBATIM
>   if (_p_c) {
>   ENDVERBATIM
> rates(v)
> idc = -c1*((minf - m)/mtau)*v*(0.001)
>   VERBATIM
>   }
>   ENDVERBATIM
>   if (usedcdt) {
>     il = il + idc
>   }
hines@hines-T7500:~/tmp$
The test I used shows the standard AP, the AP with the full time varying capacitance, and the AP with only the c*dv/dt term (missing the dc/dt * v term). Here is the python test driver.

Code: Select all


hines@hines-T7500:~/tmp$ cat hhdcdt.py
from neuron import h, gui

#single compartment hh model
soma = h.Section(name='soma')
soma.L = 5
soma.diam = 100/h.PI/soma.L # 100 um2 area
soma.insert('hhdcdt')
ic = h.IClamp(soma(.5))
ic.delay = 1
ic.dur = 0.1
ic.amp = 0.3

h.newPlotV()
g = h.graphItem

g.exec_menu("Keep Lines")
h.cvode_active(1)
h.cvode.atol(1e-6)

# standard hh
h.run()

# activate the time varying capacitance effect on cm
for sec in h.allsec():
  for seg in sec:
    h.setpointer(seg._ref_cm, 'c', seg.hhdcdt)

h.run()

# if the dcdt term is removed
h.usedcdt_hhdcdt = 0
h.run()
hines@hines-T7500:~/tmp$ 
I would normally use a ses file to set up the model but it would be inconvenient to copy that here.

Post Reply