Simulation divided into short ones using SaveState
Posted: Wed Sep 08, 2010 12:26 pm
I would like to do several simulations of a single neuron in current clamp, for which the input is read from a file (stim1.dat, stim2.dat, etc; a different one for each turn). I want the simulations to be a follow-up of each other, so the initialization of the next turn should be the same as the last state of the previous turn. After defining the neuron and its geometry I was working with the following code:
However, this gives me the following error:
I can understand that for the first time, there was no SaveState yet, so this could be a problem. However, adding 'svstate.save()' after 'svstate = new SaveState()' makes the first simulation give wrong results and gives another error in the second run:
Does anyone know how to do several consecutive simulations like this?
Code: Select all
objref r,f, svstate
strdef filename, line
f = new File()
r = new Vector()
svstate = new SaveState()
proc init() {
finitialize(v_init)
svstate.restore()
t = 0 // t is one of the "states"
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
for(i = 1; i <= 2; i = i + 1) {
sprint(filename, "stim%d.dat", i)
f.ropen(filename)
r.scanf(f)
r.play(&IClamp[1].amp, dt)
init()
run()
svstate.save()
f.close()
}Code: Select all
opening file: stim1.dat
starting run 1
running custom init
SaveState warning: 3 sections exist but saved 0
nrniv: SaveState: Stored state inconsistent with current neuron structure
in D:/Neuron/dendtc/tc3_cc_hcur_loop.hoc near line 394
}
^
SaveState[0].restore( )
init( )Code: Select all
'Failed assertion nprs_==prl->count() at line 574 of file/home/hines/neuron/releases/nrn-7.1/src/nrniv/savstate.cpp'