mod files: what they are, and how to use them

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: 6314
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

mod files: what they are, and how to use them

Post by ted »

"mod files" are instructions written in the NMODL programming language that are used to add new features to NEURON. Typically they are used to specify the properties of a biophysical mechanism such as a ligand- or voltage-gated ion channel, or an "ion accumulation mechanism" that tells NEURON how transmembrane and/or diffusional fluxes of an ionic species affect that ion's intra- and/or extracellular concentration (for examples, download and expand a recent gzipped tar file of NEURON source code from, then descend into nrn/share/examples/nrniv/nmodl). mod files are also used to specify the properties of new kinds of synaptic mechanisms or of current or voltage sources like current or voltage clamps (e.g. ...,, or or at They can also be used for other purposes, e.g. to capture the local maximum and minimum of some variable during a simulation (see ... =15&t=1816)

mod files must be compiled in order to be incorporated into NEURON. It is most convenient to put all of the mod files that are relevant to a particular project into the same directory as the hoc, ses, and py files used by that project. Then you can compile them from the command line following directions posted at ... -mod-files
or, under OS X, by dragging and dropping that directory onto the mknrndll icon,
or, under MSWin, by double clicking on mknrndll and then using mknrndll's directory browser to navigate to the directory that contains the mod files. If compilation is successful, when you start NEURON in that directory it will automatically load the compiled mod files before doing anything else.

For more information, see chapter 9 in the NEURON Book, and also look at these items in the FAQ list ... stions-faq
Where can I find examples of mod files?
How do I compile mod files?
I can't get mod files to compile.
I installed a new version of NEURON, and now I see error messages like this:
mechanisms fooba needs to be re-translated.
Is there a list of the functions that are built into NMODL?

And remember: if you update NEURON, you'll have to recompile your mod files so that the new version of NEURON can use those mechanism. But first delete any nrnmech.dll, .c, or .o files and any x86_64 subdirectory in the directory that contains your hoc, python, or mod files.
Post Reply