One of the strengths of NEURON is its run control system, which frees users from having to deal with the many important, but tedious and error-prone, details that move a simulation forward in time (updating graphs, recording and playing vectors, etc.). On those few occasions when this sequence must be altered, it is most often possible to make such alterations at the hoc level, e.g. with a custom proc advance(). For more details, see chapter 7 of The NEURON Book.
But in some _very_ rare circumstances it may be necessary to embed "execution sequence directives" in a mod file. One example is xtra.mod, which I developed in order to make extracellular stimulation and recording more efficient. For example, in a simulation of extracellular stimulation, the extracellular potential for each segment must be calculated _before_ the cable equation is solved, and in a simulation of extracellular recording, the calculation of each segment's contribution to the extracellular field must be deferred until _after_ the cable equation has been solved. This is done in xtra.mod by blocks of code that are designated BEFORE BREAKPOINT and AFTER SOLVE, respectively:
Code: Select all
BEFORE BREAKPOINT { : before each cy' = f(y,t) setup
ex = is*rx*(1e6)
}
AFTER SOLVE { : after each solution step
er = (10)*rx*im*area
}
In addition, NMODL offers BEFORE INITIAL and AFTER INITIAL directives for specifying code that is to be executed before or after the bulk of what finitialize() does, and an after_cvode SOLVE METHOD.
Usage and effects of these obscure features of NMODL are illustrated in the toy example
Demonstration of order of execution of blocks in NEURON mod files
which is available from SimToolDB
http://senselab.med.yale.edu/SimToolDB/ ... =94&lin=-1