replace i_cap/modify equation for i_cap
replace i_cap/modify equation for i_cap
Hi,
I want to implement a special "capacitive" current described by the ODE: i_capn + di_capn/dt = Cdv/dt. I want this current to actually replace the capacitive current.
I saw in this thread that a way to obtain dv/dt (which I need for the ODE in my NMODL file) is via the capacitive current: dv/dt=i_cap/cm
http://www.neuron.yale.edu/phpbb/viewto ... =16&t=2146
However, since in my case I'm replacing i_cap with i_capn I was setting cm=0 so that i_cap=0. So my question is: is there another way to obtain dv/dt? Perhaps I could set cm=1e=9 (so that i_cap is negligible), but is i_cap/cm a good estimation of dv/dt in this case? Or perhaps I should go to the source and try to modify the ODE for i_cap?
Thanks a lot in advance.
I want to implement a special "capacitive" current described by the ODE: i_capn + di_capn/dt = Cdv/dt. I want this current to actually replace the capacitive current.
I saw in this thread that a way to obtain dv/dt (which I need for the ODE in my NMODL file) is via the capacitive current: dv/dt=i_cap/cm
http://www.neuron.yale.edu/phpbb/viewto ... =16&t=2146
However, since in my case I'm replacing i_cap with i_capn I was setting cm=0 so that i_cap=0. So my question is: is there another way to obtain dv/dt? Perhaps I could set cm=1e=9 (so that i_cap is negligible), but is i_cap/cm a good estimation of dv/dt in this case? Or perhaps I should go to the source and try to modify the ODE for i_cap?
Thanks a lot in advance.
Re: replace i_cap/modify equation for i_cap
Without, perhaps, understanding all of your context, I wonder if you would be happy to replace the membrane capacitance with a linear circuit that you define.
For example, instead of a pure capacitance, three capacitors in parallel each with a different series resistance. You can even put a 0 voltage battery into the
circuit so that you can observe the net capacity current. Anyway, when the linear circuit is developed it can be saved as a class and then instantiated at
every segment where you want to have the more elaborate membrane capacitance model.
For example, instead of a pure capacitance, three capacitors in parallel each with a different series resistance. You can even put a 0 voltage battery into the
circuit so that you can observe the net capacity current. Anyway, when the linear circuit is developed it can be saved as a class and then instantiated at
every segment where you want to have the more elaborate membrane capacitance model.
Re: replace i_cap/modify equation for i_cap
Thanks for your reply, Michael.
The linear circuit idea makes me very happy indeed :) since I wanted to test other ODE's as well, for which I'd just need to figure out the equivalent circuit. However, I'm not able to save a class from any circuit. I know this sounds silly but I can't find the "Create Class" button that you mentioned in this thread: http://www.neuron.yale.edu/phpBB/viewto ... ism#p12814
I use Windows 7, and I checked in v7.2 and v7.3. Is the button available in a different version or OS?
Thank you
The linear circuit idea makes me very happy indeed :) since I wanted to test other ODE's as well, for which I'd just need to figure out the equivalent circuit. However, I'm not able to save a class from any circuit. I know this sounds silly but I can't find the "Create Class" button that you mentioned in this thread: http://www.neuron.yale.edu/phpBB/viewto ... ism#p12814
I use Windows 7, and I checked in v7.2 and v7.3. Is the button available in a different version or OS?
Thank you

 Site Admin
 Posts: 5548
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: replace i_cap/modify equation for i_cap
"Create class" was added August 25, 2013
http://www.neuron.yale.edu/hg/neuron/nr ... bbc306cf50
Development code or alpha versions released after that date should have it. Its visible manifestations are the "Create class" button on the LinearCircuit tool's "Parameters" page, and the text in the "LinearCircuit Parameters Hints" panel which is brought up by clicking on that page's Hints button.
http://www.neuron.yale.edu/hg/neuron/nr ... bbc306cf50
Development code or alpha versions released after that date should have it. Its visible manifestations are the "Create class" button on the LinearCircuit tool's "Parameters" page, and the text in the "LinearCircuit Parameters Hints" panel which is brought up by clicking on that page's Hints button.
Re: replace i_cap/modify equation for i_cap
I can also say that you can add the feature without uninstalling by replacing the files in nrn/lib/hoc/celbild with the latest hg repository versions of those
hoc files. The reason I mention this is because I'm presently suffering several administrative problems in regard to preparing new distributions for mswin which
I hope to be able to overcome in the next several weeks. The repository code is at
http://www.neuron.yale.edu/hg/neuron/nr ... oc/celbild
hoc files. The reason I mention this is because I'm presently suffering several administrative problems in regard to preparing new distributions for mswin which
I hope to be able to overcome in the next several weeks. The repository code is at
http://www.neuron.yale.edu/hg/neuron/nr ... oc/celbild

 Site Admin
 Posts: 5548
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: replace i_cap/modify equation for i_cap
Maybe you meant the files in nrn/lib/hoc/lincir/
http://www.neuron.yale.edu/hg/neuron/nr ... hoc/lincir
http://www.neuron.yale.edu/hg/neuron/nr ... hoc/lincir
Re: replace i_cap/modify equation for i_cap
oops. Yes of course. lincir not celbild. Glad you noticed the error.
Re: replace i_cap/modify equation for i_cap
Thank you so much for your responses, Michael and Ted.
It was really helpful seeing the .hoc template that the LCB generates. In fact, the ODE that I first mentioned can be represented as a series RC, and I used the LCB template to then move to working directly with the LinearMechanism.
Though I have a running implementation that matches what I get in a Matlab implementation, I'm trying to understand what the LinearMechanism does. If I define:
_n = 2
_c = new Matrix(_n,_n,2)
_g = new Matrix(_n,_n,2)
_c.x[0][0] = C
_c.x[0][1] = C
_c.x[1][0] = C
_c.x[1][1] = C
_g.x[1][1] = 1/R
...
_lm = new LinearMechanism(_c, _g, _y, _y0, _b, 0.5)
Then the equations would be (vm the transmembrane potential where I'm coupling this linear mechanism, v2 an auxiliary variable representing the potential at the RC node in my circuit model):
C(vmv2)' = 0
C(vmv2)' 1/R v2 = 0
The second equation is easy to interpret. But the first equation, which is coupled to the system, is not totally clear to me since the RHS is zero. Is the LHS of the equation a current that is balanced with the membrane current and so not necessarily zero? And how is the sign convention (if I replace C with C in this equation I don't get the same results as in Matlab)? Further, suppose I add extracellular mechanism so that I want the R end of my circuit model connected to vext. Then the current balance equation would be (v2vext)/R, but again I'm not sure how the sign convention is (opposite sign inconsistent with Matlab implementation).
Thank you!
It was really helpful seeing the .hoc template that the LCB generates. In fact, the ODE that I first mentioned can be represented as a series RC, and I used the LCB template to then move to working directly with the LinearMechanism.
Though I have a running implementation that matches what I get in a Matlab implementation, I'm trying to understand what the LinearMechanism does. If I define:
_n = 2
_c = new Matrix(_n,_n,2)
_g = new Matrix(_n,_n,2)
_c.x[0][0] = C
_c.x[0][1] = C
_c.x[1][0] = C
_c.x[1][1] = C
_g.x[1][1] = 1/R
...
_lm = new LinearMechanism(_c, _g, _y, _y0, _b, 0.5)
Then the equations would be (vm the transmembrane potential where I'm coupling this linear mechanism, v2 an auxiliary variable representing the potential at the RC node in my circuit model):
C(vmv2)' = 0
C(vmv2)' 1/R v2 = 0
The second equation is easy to interpret. But the first equation, which is coupled to the system, is not totally clear to me since the RHS is zero. Is the LHS of the equation a current that is balanced with the membrane current and so not necessarily zero? And how is the sign convention (if I replace C with C in this equation I don't get the same results as in Matlab)? Further, suppose I add extracellular mechanism so that I want the R end of my circuit model connected to vext. Then the current balance equation would be (v2vext)/R, but again I'm not sure how the sign convention is (opposite sign inconsistent with Matlab implementation).
Thank you!
Re: replace i_cap/modify equation for i_cap
http://www.neuron.yale.edu/neuron/stati ... inmod.html
gives some details about how the LinearMechanism adds terms to the normal internal current balance equations.
gives some details about how the LinearMechanism adds terms to the normal internal current balance equations.