AFTER SOLVE

NMODL and the Channel Builder.
Post Reply
bhalterm
Posts: 52
Joined: Wed Mar 08, 2006 10:43 am
Location: University of Pennsylvania

AFTER SOLVE

Post by bhalterm »

I found the "AFTER SOLVE" block mentioned in a post, but I can't find it documented anywhere else. Is there anything equivalent to a "BEFORE SOLVE" block, or an "AFTER AFTER SOLVE" block? It would be nice to have more fine grained control of the order in which mechanisms are evaluated.

Ted, can you give a little description of the AFTER SOLVE block (and any related options) here for posterity? Thanks!
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: AFTER SOLVE

Post by ted »

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
bhalterm
Posts: 52
Joined: Wed Mar 08, 2006 10:43 am
Location: University of Pennsylvania

Re: AFTER SOLVE

Post by bhalterm »

Fantastic! Just what I needed.
Post Reply