Hello,
I am working on a purely Matlab implementation of the MRG 2002 doublecable model, and have run into issues I haven't been able to resolve following the NEURON book, tutorials, papers, and forum posts I have seen. Currently, my results are similar to those given by NEURON  steady state membrane voltage is the same, and the same general pattern appears when responding to an initial voltage  which leads me to believe that I am getting close. However, I am running into an issue where the number/timing of spikes my model predicts is slightly different from that given by NEURON.
I would very much appreciate it if you could please clarify a few points on how NEURON implements:
1. Implicit Euler advancement for ion channels.
I have been following Equation (9) of http://www.neuron.yale.edu/ftp/neuron/p ... ffic84.pdf and taking two halfdeltaT steps, first advancing the channel state to that of (t+deltaT/2), then resolving all membrane voltages at (t+deltaT/2) following a variation of Equation (4), and repeating the process again to reach (t+deltaT). This does not feel correct, as the process is split into two halfsteps. Would simply altering equations (4) and (9) to use deltaT rather than deltaT/2 be sufficient for implementing a fullstep implicit Euler?
The documentation I have seen says that the ion channels and voltages are updated in a staggered manner for the CrankNicholson method, but that in more recent implementations they are computed simultaneously for Implicit Euler. I have been unable to find the equations for simultaneously solving the voltage equations and the ion channel progression. If this is the case, could you please direct me to an explanation of how this is done?
2. Voltage initialization.
Using finitialize, and referring specifically to http://www.neuron.yale.edu/neuron/stati ... racellular
I know that upon setting an initial membrane voltage, channel gate values are adjusted to their steady state for the given voltage. Would the same be true of VExt values in extracellular compartments, or would their voltage be set directly to a specific value?
3. Action Potential count.
My understanding of Neuron's record function is that it is generally set to record events specified by the user  in the case of action potentials, this seems to default to membrane voltage breaking 0 mv. Am I correct in assuming that this is the default spike counting method?
I'm trying to find a way to determine if a given timevarying current input (or a change in external voltage) would result in a propagating signal _far_ downstream in a model axon.
For example  when an initial voltage of, say, 40mV is set for a 15um fiber in the MRG model, there are a number of spikes  none of which break 0 mV  which appear before the membrane voltage drops to its resting value. None of these follow the traditional "allornothing" shape, so I am unsure if they would propagate a reasonable distance or excite something more actionpotential looking downstream.
Would there be an easy way of determining this without seeing a traditional action potential within the set of modeled nodes, or directly simulating a long axon?
Thank you for your help,
Platon
MRG NEURON mechanics

 Site Admin
 Posts: 5684
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: MRG NEURON mechanics
Equation 9 pertains only to the use of tables of precomputed rate functions. Ignore it. As far as "two halfdeltaT steps" is concerned, Euler methods produce first order correct solutions. Equation 8, however, pertains to a "staggered CrankNicholson method" that generates a second order correct solution. It's not relevant if you're trying to implement implicit Euler. If you want implicit Euler, just use the plain old implicit Euler formula.pxl282 wrote:1. Implicit Euler advancement for ion channels.
I have been following Equation (9) of http://www.neuron.yale.edu/ftp/neuron/p ... ffic84.pdf and taking two halfdeltaT steps
I do not recall seeing such documentation. Where did you see it?The documentation I have seen says that the ion channels and voltages are updated in a staggered manner for the CrankNicholson method, but that in more recent implementations they are computed simultaneously for Implicit Euler.
As far as I know, those start out at 0 unless they are driven by Vector play or perhaps (via pointers) by a function of time that has a nonzero value at t=0.I know that upon setting an initial membrane voltage, channel gate values are adjusted to their steady state for the given voltage. Would the same be true of VExt values in extracellular compartments, or would their voltage be set directly to a specific value?
There are two ways to keep track of the number of spikes. One is with an instance of the APcount class, and the other takes advantage of the NetCon class's record() method. Each has a userspecifiable threshold parameter, but you'll want to see the Programmer's Reference for the most recent documentation of default threshold values.My understanding of Neuron's record function is that it is generally set to record events specified by the user  in the case of action potentials, this seems to default to membrane voltage breaking 0 mv. Am I correct in assuming that this is the default spike counting method?
The only way to know if a stimulus at some point A elicits a propagating spike is to observe propagation of a spike past some other point B such that B is so far from A that the stimulus current injected at A does not directly affect membrane potential at B.I'm trying to find a way to determine if a given timevarying current input (or a change in external voltage) would result in a propagating signal _far_ downstream in a model axon.
For example  when an initial voltage of, say, 40mV is set for a 15um fiber in the MRG model, there are a number of spikes  none of which break 0 mV  which appear before the membrane voltage drops to its resting value. None of these follow the traditional "allornothing" shape, so I am unsure if they would propagate a reasonable distance or excite something more actionpotential looking downstream.
Would there be an easy way of determining this without seeing a traditional action potential within the set of modeled nodes, or directly simulating a long axon?
Re: MRG NEURON mechanics
Hello ted, thank you for your response!
m = m + mexp(v) * (minf(v)m)
where
mexp(v) = 1  exp (deltaT / tau( v(t) ) ) //deltaT in ms
be the correct implicit Euler equation?
Also, in following fadvance, is the following process correct:
1. Check conductances between compartments, adjust changes.
2. Find di/dv by evaluating IHH( m,h,s, v) and IHH (m,h,s,v+0.001) [as opposed to IHH ( m,h,s,v reevaluated assuming V(t+deltaT) = V(t+deltaT) +0.001)]
3. Resolve matrix equations by gaussian elimination. Acquire V(t+deltaT).
4. Adjust channels using this new V(t+deltaT) and the Implicit Euler equation for channels.
Thanks again!
Platon
Regarding the Implicit Euler equation. Would simplyIf you want implicit Euler, just use the plain old implicit Euler formula.
m = m + mexp(v) * (minf(v)m)
where
mexp(v) = 1  exp (deltaT / tau( v(t) ) ) //deltaT in ms
be the correct implicit Euler equation?
Also, in following fadvance, is the following process correct:
1. Check conductances between compartments, adjust changes.
2. Find di/dv by evaluating IHH( m,h,s, v) and IHH (m,h,s,v+0.001) [as opposed to IHH ( m,h,s,v reevaluated assuming V(t+deltaT) = V(t+deltaT) +0.001)]
3. Resolve matrix equations by gaussian elimination. Acquire V(t+deltaT).
4. Adjust channels using this new V(t+deltaT) and the Implicit Euler equation for channels.
Sorry, I misread the channels and voltages being updated simultaneously. This seems to only apply to voltage clamp models.I do not recall seeing such documentation. Where did you see it?
Thanks again!
Platon

 Site Admin
 Posts: 5684
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: MRG NEURON mechanics
Tell you whatchapter 7 of The NEURON Book is the most detailed narration available, short of walking through the source code. See if chapter 7 gives you the information you're looking for.
Re: MRG NEURON mechanics
Hello ted,
I have been following chapter 7, and it has been incredibly helpful!
I asked about the process only to check that I wasn't missing something simple.
I've got few differences between my output and NEURON's output, but they do exist and I'm trying to iron them out. I am most unsure of the implicit Euler ion channel adjustment step after calculating all voltages following the process described in chapter 7. As is I'm using equation 7.5, from chapter 7, with (t+ deltaT  t) rather than (t +deltaT/2  tdeltaT/2), but this doesn't seem right.
Unfortunately, I can't find a source for the implicit equation for integrating Hodgkin Huxley channels  the "plain old implicit Euler formula"  that doesn't involve finding a convergence point iteratively, and was hoping you could provide the equation used or a reference to it.
Thanks,
Platon
I have been following chapter 7, and it has been incredibly helpful!
I asked about the process only to check that I wasn't missing something simple.
I've got few differences between my output and NEURON's output, but they do exist and I'm trying to iron them out. I am most unsure of the implicit Euler ion channel adjustment step after calculating all voltages following the process described in chapter 7. As is I'm using equation 7.5, from chapter 7, with (t+ deltaT  t) rather than (t +deltaT/2  tdeltaT/2), but this doesn't seem right.
Unfortunately, I can't find a source for the implicit equation for integrating Hodgkin Huxley channels  the "plain old implicit Euler formula"  that doesn't involve finding a convergence point iteratively, and was hoping you could provide the equation used or a reference to it.
Thanks,
Platon

 Site Admin
 Posts: 5684
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: MRG NEURON mechanics
Have you read chapter 4?
Re: MRG NEURON mechanics
Hello ted,
Chapter 4 helped, thank you!
 Platon
Chapter 4 helped, thank you!
 Platon