Bug: CVode - stdrun.hoc - tstop

Post Reply
cafischer

Bug: CVode - stdrun.hoc - tstop

Post by cafischer »

When loading stdrun.hoc before declaring and setting CVode to 1 the simulation will not run until tstop but stop at some earlier point. However when reversing the order everything is fine and the simulation stops at tstop. In the documentation it says that a cvode will be created when loading stdrun.hoc but also if I set h.cvode to 1 the simulation does not run until tstop.

Here is a small example:

Code: Select all

from neuron import h

# adaptive integration
h.load_file("stdrun.hoc") # reverse order between this and the following two lines
cvode = h.CVode()
cvode.active(1)

# create cell
h.nrn_load_dll('../demo/channels/i686/.libs/libnrnmech.so')
soma = h.Section(name='soma')
soma.insert('pas')

# insert IClamp
iclamp = h.IClamp(soma(.5))
iclamp.amp = 1
iclamp.delay = 20.0
iclamp.dur = 40.0

# record the time
t_rec = h.Vector()
t_rec.record(h._ref_t)

# run simulation
dt = 0.01
tstop = 100
h.v_init = -60
h.tstop = tstop
h.steps_per_ms = 1.0 / dt
h.dt = dt
h.run()

# output
print tstop
print t_rec[-1]
assert tstop == t_rec[-1]
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Bug: CVode - stdrun.hoc - tstop

Post by ted »

Try cvode_active(1) instead of cvode.active(1). See
Turning adaptive integration ("CVODE") on and off
in the Hot tips area of the NEURON forum.
Post Reply