Change parameters on the run-initialization

NMODL and the Channel Builder.
Post Reply
tcp

Change parameters on the run-initialization

Post by tcp »

Dear All,

I'd like to ask your opinion on a bit of code relative to changing of parameters in the course of simulation.

Code: Select all

//this is the procedure 
proc LastAxon_spike() {
	counter = counter + 1
	if (counter > 3) {
		forsec "axon" {
			gbar_na16 = gbar_na16 * 1.15
			gbar_kv2_gp = gbar_kv2_gp * 1.15
			gbar_kv4_gp = gbar_kv4_gp * 1.15
			gbar_sk_dop = gbar_sk_dop * 1.0
		}
	}
}

which is called here:

Code: Select all

netconAxon.record("LastAxon_spike()")
Am I missing something with respect to initialization?

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

Re: Change parameters on the run-initialization

Post by ted »

Should work with fixed time step integration. If there is a chance that anyone would ever use that code with adaptive integration, insert cvode.re_init() before the closing curly bracket }. Whatever you do, test to make sure that it works.
tcp

Re: Change parameters on the run-initialization

Post by tcp »

I am not using cvode. After the occurrence of the fourth spike, I "Init and Run" through RunControl. It seems like it starts with the updated values. Is it correct?

Thanks for your prompt reply,
Eleftheria
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Change parameters on the run-initialization

Post by ted »

I mentioned cvode.re_init() because your first post to this thread referred to
changing of parameters in the course of simulation
Now you say you are stopping the simulation after the 4th spike, changing parameters, and starting a new simulation. If that's what you're doing, you're not really changing parameters "in the course of a simulation," are you? And, consequently, cvode.re_init() would not be necessary.
tcp

Re: Change parameters on the run-initialization

Post by tcp »

No, no I am not stopping the simulation or changing parameters after. I am doing exactly what you understood the first time. I am only calling "Init and Run" as another way to test my code. I was expecting after call "Init and Run" the simulation give the same results as before any on the run initialization.
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Change parameters on the run-initialization

Post by ted »

tcp wrote:No, no I am not stopping the simulation or changing parameters after. I am doing exactly what you understood the first time.
Well, then my statement about cvode.re_init() still applies. Changing parameters in the middle of a simulation is not the same as reinitializing. If you don't call cvode.re_init() after changing parameters, make sure you never use adaptive integration or this code will fail, and the failure will be the worst kind: i.e. NEURON will continue to generate results, without any error message, but the results will not what they should have been because the integrator was not reinitialized.
tcp

Re: Change parameters on the run-initialization

Post by tcp »

Clear.

Thank you very much Ted
Eleftheria
Post Reply