Here are some hints and questions that will help you answer your own question.
But first this question: why bother to reinvent NEURON's standard run system? And a small subset of it, at that. I refer to this excerpt from your code:
Code: Select all
proc initialize() {
finitialize(v_init)
fcurrent()
}
proc integrate() {
g.begin()
while (t<tstop) {
fadvance()
g.plot(t)
}
g.flush()
}
proc go() {
initialize()
integrate()
}
If you simply
load_file("nrngui.hoc")
at the start of your program (or if you don't want to see the NEURON Main Menu toolbar, just
load_file("stdgui.hoc")), you can launch a single run with just one command:
run()
and it will automatically take care of initialization and updating Graphs. In other words, run() will take care of everything that's in your code's initialize(), integrate(), and go() procedures--and its easy to type and doesn't clutter up your source code.
Are you following an example you have seen elsewhere? If so, please let me know so that I can find out if it is possible to do something about it (i.e. something that will help prevent others from spending time reinventing the standard run system).
"Well, I have cobbled up a Graph that isn't updating from one step to the next."
Fine. If you're using the standard run sytem, you can just append your non-updating Graph to a graphList. graphList[0] is a good choice if you want points to be plotted vs. t.
graphList[0].append(g)
will do the job. Now run() will launch a simulation and your special Graph will update properly.
when I run the simulation with the command go(), the model just runs once
So walk through your code to discover what happens when you execute go(). Pretend you're the computer, read each statement line by line, and imagine that you do what it says.
go() calls initialize()
initialize() calls finitialize(v_init), then calls fcurrent() and returns
go() next calls integrate()
integrate does what?
Did you see anything that calls batchrun()?
And about batchrun()--
Code: Select all
proc batchrun() { local i, tmp
tmp = syn.onset
for i=0,$0-5 {
syn.onset = tmp*i
run()
}
}
have you tried calling this yourself from the oc> prompt? That is, at the oc> prompt type
batchrun()
and see what happens. Did it work as expected? Or were you going to call it with a numerical argument, and if so, what? Maybe it would be useful to comment out the run() line and insert a print statement so you can get a better idea of what will happen when batchrun() is called. That is, change the for loop to
Code: Select all
for i=0,$0-5 {
syn.onset = tmp*i
// run()
print "i ", i, " syn.onset ", syn.onset
}