Secrets of the GUI: VariableStepControl

A collection of noteworthy items selected by our moderators from discussions about making and using models with NEURON.

Moderators: ted, wwlytton, tom_morse

Post Reply
Site Admin
Posts: 6097
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Secrets of the GUI: VariableStepControl

Post by ted »

VariableStepControl is a GUI tool that makes it extremely easy to specify the error tolerance used for adaptive integration. This is particularly helpful when states span many orders of magnitude, e.g. models that include calcium or other second messengers. It can be used regardless of whether your own model code is written in hoc, Python, or both. Here's how to proceed.

1. Ensure that the runtime library has been loaded by putting a
statement at or near the top of your model source code. This will automatically create an instance of the cvode class. If you're using Python, just change
from neuron import h
from neuron import h, gui

2. Bring up a VariableStepControl (NEURON Main Menu / Tools / VariableStepControl).

3. Click on the Use variable dt button

4. Click on the Atol Scale Tool button

5. In the Atol Scale Tool, click on the Analysis Run button. This launches a simulation in which NEURON determines the dynamic range of each state variable, and then chooses appropriate error tolerance scale factors for each of them.

6. You may now click on the Atol Scale Tool's Rescale button, and then close the Atol Scale Tool window.

7. Be sure to save the VariableStepControl to a session file by itself (for the sake of this example, let's call this file

8. Exit NEURON, then add a
statement to your model source code (in Python, that's
). This should be inserted at a point _after_ your model specification code (the code that specifies the anatomical and biophysical properties of your model, including any synapses that may be present), but before your own run control statements (i.e. before calling run() (Python: or executing any other statements that initialize and launch a simulation).

The next time you execute your program file, adaptive integration will be automatically configured to use the error tolerances that were custom tailored for each state. This will work even if your model is simulated on parallel hardware and started by a command line that calls nrniv.
Post Reply