Hi,
I'm running quite long simulations, in batch, doing something like a parameter search. Some (if not many) of the simluations I don't want to run until the end, because I know that something is going wrong. However, when I am not there, there is no way that neuron realize it, stop the simulation and proceed with the next one.... or there is?
I already have figured out how to decide that the simulation should be stopped. With a few modifications of the APCount point process (which I am already using) I can evaluate wether the 'stop criteria' is fulfilled. But, how do I tell neuron to actually stop the simulation? Is there such a command in nmodl?
Suggestion on any other way to do this (within the hoc code, for example) will also be appreciated.
Regards.
How to stop a simulation from within a nmodl mechanism?
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Don't stop simulation execution from inside a mod file.
The best way to do what you want is to abandon APCount and use NetCon instead.
Read about NetCon class's record() method
http://www.neuron.yale.edu/neuron/stati ... tml#record
Note the syntax
netcon.record("stmt")
which lets you execute arbitrary code whenever a "source event" happens (spike, in
this case). stmt could be a call to a proc that decides if it is time to stop.
If you also want to keep a running count of spikes, add this extra bit of code:
spktim.size() will tell you how many spikes have occurred so far.
The best way to do what you want is to abandon APCount and use NetCon instead.
Read about NetCon class's record() method
http://www.neuron.yale.edu/neuron/stati ... tml#record
Note the syntax
netcon.record("stmt")
which lets you execute arbitrary code whenever a "source event" happens (spike, in
this case). stmt could be a call to a proc that decides if it is time to stop.
Code: Select all
proc maybe_stop() {
if (whatever you like) stoprun=1
}
objref nc, null // null will be a NULLobject target for nc
// for this example, assume there is a section called soma
nc = new NetCon(&soma.v(0.5), null)
nc.record("maybe_stop()")
Code: Select all
objref spktim, spnc
spktim = new Vector
spnc = new NetCon(&soma.v(0.5), null)
spnc.record(spktim)