Adding new mechanisms to NEURON

NMODL and the Channel Builder.
Post Reply
Site Admin
Posts: 5740
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Adding new mechanisms to NEURON

Post by ted » Thu Dec 15, 2005 4:35 pm

The following is a modified excerpt from Chapter 12 of The NEURON Book

To add new mechanisms, you first write a specification of the mechanism properties
in the NMODL language (see Chapter 9), and then you compile it. To compile under
UNIX and Linux, you execute the shell script nrnivmodl, which is located in
nrn/i686/bin. Most often, nrnivmodl is called with no file name arguments, which
results in compilation of all "mod files" in the current working directory (i.e. files that
have the suffix .mod ). It can also be called with one or more file name arguments, e.g.
nrnivmodl file1 file2 . . .
compiles the model descriptions defined in file1.mod, file2.mod, etc.. Regardless of
how nrnivmodl is invoked, the first step in the process is translation of the model
descriptions from NMODL into C by the nocmodl translator.

Under Linux, the end result is a shared object located in a subdirectory
.i686/.libs of the current working directory, as well as a shell script called special
in the .i686 subdirectory that starts nrniv and makes it load the shared object. Under
non-Linux UNIX, the result is a complete executable called special. In either case,
if one now invokes nrngui in the current working directory (the one in which
nrnivmodl had been executed), an instance of NEURON will start that contains
the new mechanism(s). The new mechanism(s) will automatically appear at the
appropriate locations in the menus of NEURON's GUI tools.

The MSWindows version of nrnivmodl is called mknrndll. It compiles and links
the models into a dynamically loadable library called nrnmech.dll. neuron.exe
automatically looks in the current working directory for a nrnmech.dll file, and if one
exists, loads it into memory and makes the mechanisms available to the interpreter.

Regardless of which OS one uses, it is a good idea to keep related mod files in the
same directory as the hoc files that need them.


Another way to add voltage- and ligand-gated channels to NEURON is with the Channel Builder. This GUI tool has a convenient graphical interface for creating kinetic scheme or HH-style specifications of ion channels.

As of December 2008, NMODL remains the only way to add ion accumulation mechanisms, or to create new classes of artificial spiking cells with dynamics that differ from the built-in classes (IntFire1, IntFire2, IntFire4).
Last edited by ted on Wed Mar 05, 2008 10:13 am, edited 1 time in total.

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

Post by ted » Thu Aug 03, 2006 5:11 pm

For instructions on how to compile mod files, go to NEURON's FAQ page
and look for the item
How do I compile mod files?

If you have Linux or OS X and are having difficulty compiling mod files, make sure that your
computer has the necessary software development environment--see
Be sure your Linux can compile source code

The Documentation page has a tutorial on how to use the Channel Builder.

Post Reply