Page 1 of 1

Init that forces inhomogeneous membrane potential

Posted: Tue Nov 22, 2011 6:07 am
by tcp
Dear Ted,

How can I set some compartments in my model to different initial membrane potentials? I think a way to do it, is to change v_init to a very positive value (v_init = 10).
For the rest of the model I want to maintain v_init as initially set (v_init = -56).

Below is what I've tried:
In the init procedure, instead of finitialize ->

Code: Select all

forall if (issection("s.*")) {   //soma
for (x) v(x) = 10
}
forall if (issection("d.*")) {   //dendrite
for (x) v(x) = 10
}
forall if (issection("a.*")) {    //axon
for (x) v(x) = -56
}
You may already know that this is not working.
Do you have any suggestions?

Thank you very much,

Best regards,
Eleftheria

Re: Init that forces inhomogeneous membrane potential

Posted: Wed Nov 23, 2011 11:29 am
by ted
First, make sure that the first statement in your program is
load_file("nrngui.hoc")

Then, after the code that specifies your model's topology, geometry, spatial discretization, and biophysical properties, insert some hoc code that makes two SectonLists and appends all sections that are to be initialized to 0 mV to one, and all sections that are to be initialized to -60 to the other.

After that, but before any run() statement, insert this procedure (which assumes that the SectionLists are called init_to_0 and init_to_minus_60, respectively, and also assumes that your model does not need any other kind of custom initialization):

Code: Select all

proc init() {
  finitialize(-65)
  forsec init_to_0 v=0
  forsec init_to_minus_60 v=-60
  finitialize()
  if (cvode_active()) {
    cvode.re_init()
  } else {
    fcurrent()
  }
  frecord_init()
}
Please note that this does not guarantee that ion accumulation mechanisms (mechanisms described by NMODL code that WRITEs one or more ionic concentrations) have been properly initialized.

Re: Init that forces inhomogeneous membrane potential

Posted: Wed Nov 23, 2011 12:15 pm
by tcp
Hi Ted,

Thanks once again.
It works.
One more question; after simulation ends, in the command window, when soma is accessed, print v_init gives -60.
However during the simulation soma membrane potential has been set at the desired value (v_init = 0).
Why is this?

Best regards,
Eleftheria

Re: Init that forces inhomogeneous membrane potential

Posted: Fri Nov 25, 2011 11:39 am
by ted
v_init is irrelevant to the custom initialization that I described in my post from Wed Nov 23, 2011 11:29 am, because it isn't used by anything. To quote from the documentation of finitialize() in the Programmer's Reference:
SYNTAX
finitialize()
finitialize(v)
DESCRIPTION
Call the INITIAL block for all mechanisms and point processes inserted in the sections. If the optional argument is present then all voltages of all sections are initialized to v.