Fri 02 September 2016

Using NEURON - Part II

Posted by ankur in Research (328 words, approximately a 2 minute read)

ModelDB is a popular resource where the computational neuroscience community puts up models that were used in various publications. Since I'm quite new to NEURON, I thought I'd play with some existing models to get a hang of things. Here I document how to run an existing model.

ModelDB has quite a few models that use NEURON. Find one that suits you. I'll pick L5b PC model constrained for BAC firing and perisomatic current step firing (Hay et al., 2011) for now.

Download the model

Download the zip file from the model page to a convenient location. There's a link right on the top of the page. Extract it.

$ unzip
$ lash
total 668K
4.0K drwxr-xr-x. 7 asinha asinha 4.0K Mar 30  2013 L5bPCmodelsEH
664K -rw-r-----. 1 asinha asinha 662K Sep  2 13:55

Building and running the model

Enter the directory:

cd L5bPCmodelsEH/

NEURON code comprises of two sets of code files. You have the HOC files, and the NMODL files. NMODL files need to be compiled before the model can be run.

$ ~/dump/neuron-installation/x86_64/bin/nrnivmodl mod
Creating x86_64 directory for .o files.

mod/CaDynamics_E2.mod mod/Ca_HVA.mod mod/Ca_LVAst.mod mod/epsp.mod mod/Ih.mod mod/Im.mod mod/K_Pst.mod mod/K_Tst.mod mod/Nap_Et2.mod mod/NaTa_t.mod mod/NaTs2_t.mod mod/SK_E2.mod mod/SKv3_1.mod
CaDynamics_E2.mod Ca_HVA.mod Ca_LVAst.mod epsp.mod Ih.mod Im.mod K_Pst.mod K_Tst.mod Nap_Et2.mod NaTa_t.mod NaTs2_t.mod SK_E2.mod SKv3_1.mod
"/home/asinha/dump/neuron-installation/x86_64/bin/nocmodl" CaDynamics_E2
Translating CaDynamics_E2.mod into CaDynamics_E2.c
Thread Safe
"/home/asinha/dump/neuron-installation/share/nrn/libtool" --tag=CC --mode=compile mpicc -DHAVE_CONFIG_H  -I. -I.. -I"/home/asinha/dump/neuron-installation/include/nrn" -I"/home/asinha/dump/neuron-installation/x86_64/lib"      -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c -o CaDynamics_E2.lo CaDynamics_E2.c
libtool: compile:  mpicc -DHAVE_CONFIG_H -I. -I.. -I/home/asinha/dump/neuron-installation/include/nrn -I/home/asinha/dump/neuron-installation/x86_64/lib -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c CaDynamics_E2.c  -fPIC -DPIC -o .libs/CaDynamics_E2.o
CaDynamics_E2.c:94:34: warning: missing braces around initializer [-Wmissing-braces]
  static VoidFunc hoc_intfunc[] = {

You'll see a new x86_64 directory which contains the compiled code. Now, simply run NEURON as usual. If everything went well, the simulation will run:

$ ~/dump/neuron-installation/x86_64/bin/nrngui mosinit.hoc

Remember that you must run nrngui in the directory where the x86_64 directory resides for NEURON to find it.

That's it!