Page 1 of 1

Variable time step and abrupt changes

Posted: Tue Oct 02, 2007 10:47 am
by dperakis
I am running an Izhikevich artificial cell and it runs perfectly when i use fixed time step.
When i try to incorporate the mechanism, i get back the error message
oc>CVode-- At t = 448.687, too much accuracy requested.
CVode a75fc8 acell advance_tn failed, err=-5.
nrniv: variable step integrator error
near line 28
{neurosimple.I=0 cvode.re_init()}
fadvance( )
advance( )
step( )
continuerun(1000 )
and others
The strange is that i don't get the message while the input current changes from -500nA (t=400ms) to 0nA but at the time of spike reset (t=448ms).
My .hoc code is :

Code: Select all


//* setup the cell
create acell
access acell

objref neurosimple, stim, fresh

acell neurosimple = new STN_NEURON(0.5)

neurosimple.I = -500

fresh = new FInitializeHandler("Isend()")

proc Isend(){
	Isend1 (400,0)

proc Isend1 () {
	sprint(tstr,"neurosimple.I=%g cvode.re_init()",$2)

tstop = 1000

I don't know if i have to use the at_time statement.

Posted: Wed Oct 03, 2007 11:26 am
by ted
at_time is irrelevant for multiple reasons: it's part of NMODL, not hoc; it is a deprecated statement whose functionality has been replaced by the event delivery system; but most important, it has nothing to do with the symptom you describe. The problem lies in the dynamics of this particular model, which NEURON's adaptive integrators cannot handle under all circumstances--see the README file ... izh\README
and comments in izh.hoc ... zh\izh.hoc
For those situations that crash cvode, you'll just have to go back to fixed time steps.

Posted: Thu Oct 04, 2007 3:06 am
by dperakis
Thank you.
I think that i must go back to fixed time steps.
One option is to increase the time step and balance between accuracy and computational efficiency.
Do you know, or maybe "guess", if another variable time step method would work with this .hoc (I have heard about DASPK and IDA).

Posted: Thu Oct 04, 2007 10:17 am
by ted
NEURON's "cvode" really isn't cvode per se. See ... cvode.html
in particular
Although for historical reasons, this class is called CVode at the hoc level, in fact it is an interface to a family of methods which are implemented on top of the CVODES and IDA integrators of the SUNDIALS package . . . (see use_local_dt and use_daspk )
When cvode is "active" NEURON automatically selects which method to use based on the structure of the system equations. However, you can try overriding this selection by using the GUI's VariableStepControl (NEURON Main Menu / Tools / VariableStepControl), which offers a very convenient interface for examining and overriding methods--click on its Details button. A better idea may be to use its Atol Scale Tool to execute an Analysis Run (hint: make this a short run so the simulation doesn't reach the point where it crashes). Then click on the Rescale button so that each state has its own custom absolute error tolerance scale factor, and see if these new error tolerances allow you to execute a full simulation.