<< Main Manual 

Tutorial #1. Building and Running a Simple Single-Neuron Simulation

For this example, we are going to use the XPPAUT implementation of the CA1 pyrimidal neuron of Golomb, Yue, and Yaari (2006) as a starting point. That results in a neuron that behaves like this:


xpp example

1.1. Building the Simulator Code

First, the simulator needs to know how to implement the neuron's equations. We achieve this by defining an .oden file, which is analagous to XPPAUT's .ode files. Save the following block of code in a file called zca.oden in a directory that you wish to run a simulation (which we will call the working directory from now on).

zca.oden:

# Excitatory cortical neurons, 0 [Ca].
#
number Cm=1.0
number pms=3,pns=4
number VNa=55.0,t_tauh=-40.5,t_taun=-27.0
number thetaa=-50.0,sigmaa=20.0,thetab=-80.0,sigmab=-6.0,tauBs=15.0
number sigmam=9.5,sigmah=-7.0,sigman=10.0,sigmaz=5.0,sigmak=7
#
p gNa=35.0,gKdr=6.0,gL=0.05,Iapp=0.661914
p gA=1.4,gNaP=0.3,gZ=1.0
p thetaz=-39.0,tauZs=75.0
p phi=10.0, thetah=-45.0
p thetam=-30.0,thetan=-35.0,thetap=-47.0,sigmap=3.0
p VK=-90.0,VL=-70.0
#
GAMMAF(VV,theta,sigma)=1.0/(1.0+exp(-(VV-theta)/sigma))
#ZFUNC(AA,CA,zz)=1/(1+(AA^zz/CA^zz))
#
VVs'=(-gL*(VVs-VL)-INa-INaP-IKdr-IA-Iz+Iappx)/Cm
hhs'=phi*(GAMMAF(VVs,thetah,sigmah)-hhs)/(1.0+7.5*GAMMAF(VVs,t_tauh,-6.0))
nns'=phi*(GAMMAF(VVs,thetan,sigman)-nns)/(1.0+5.0*GAMMAF(VVs,t_taun,-15.0))
bbs'=(GAMMAF(VVs,thetab,sigmab)-bbs)/tauBs
zzs'=(GAMMAF(VVs,thetaz,sigmaz)-zzs)/tauZs
#
Iappx=Iapp
#Iappx=if(t<=3.0)then(Iapp)else(0.0)
Minfs=GAMMAF(VVs,thetam,sigmam)
Pinfs=GAMMAF(VVs,thetap,sigmap)
Ainfs=GAMMAF(VVs,thetaa,sigmaa)
#
INa=gNa*(Minfs^pms)*hhs*(VVs-VNa)
INaP=gNaP*Pinfs*(VVs-VNa)
IKdr=gKdr*(nns^pns)*(VVs-VK)
IA=gA*Ainfs^3*bbs*(VVs-VK)
Iz=gZ*zzs*(VVs-VK)
#
init VVs=-71.81327
init hhs=0.98786
init nns=0.02457
init bbs=0.203517
init zzs=0.00141

This code is very similar to the original zca.ode file used by XPPAUT, except the XPPAUT-specific '@' lines were removed for clarity. We changed the file extension from .ode to .oden to reflect the fact that the .oden file format diverges from XPPAUT's .ode file format in some cases. In most cases, however, XPPAUT .ode files should work without significant adjustments (except for the file extension change). For specific details on the syntax of the .oden file, see the .oden file documentation.

Then, from a terminal, switch to the working directory and type the following:


> nne_build

This will generate the C++ library for this neuron model using the .oden files found in the working directory (called libodens.so).  

If all goes well, you will now have a library that you can use with the installed NeuronetExperimenter executable to run simulations.

1.2. Running a Simulation

When running a simulation, the executable requires 3 minimum files: a .net file that defines the parameters of each neuron and the arrangement of neuronal connections, a .setup file that describes what to run, and a .exp file that describes how a specific experiment within the simulator should run. Consult the documentation for each file type for further information on the files.

The easiest way to get these files is to use the generated binary to autogenerate stubs of each file. To achieve this do the following:

> NeuronetExperimenter zca              

This will generate the following three files for the 'zca' model (comments for you are in blue, and text in red will needed to be changed to reflect those values to get the results we will show below):

zca.setup:
Network zca.net
Dt 0.05                                    #       with a timestep of 0.05
Print Step Size 1                          #       and should output data every time step
Output t VVs hhs nns bbs zzs               #       and should output time and each of the state variables for all the neurons
Experiment control 1                       #       and should run the experiment in control.exp once

control.exp:
Time: 500                                  # Indicates the simulator should run 500 ms for this experiment iteration

zca.net:
Neuron ID:   1
Neuron Name: zca

     Initial conditions:
     VVs        -71.8133
     hhs        0.98786
     nns        2.457e-02
     bbs        0.203517
     zzs        1.41e-03

     Associated Variable Values:
     Cm         1
     Iapp       0.661914
     VK         -90
     VL         -70
     VNa        55
     gA         1.4
     gKdr       6
     gL         5.e-02
     gNa        35
     gNaP       0.3
     gZ         1
     phi        10
     pms        3
     pns        4
     sigmaa     20
     sigmab     -6
     sigmah     -7
     sigmak     7
     sigmam     9.5
     sigman     10
     sigmap     3
     sigmaz     5
     t_tauh     -40.5
     t_taun     -27
     tauBs      15
     tauZs      75
     thetaa     -50
     thetab     -80
     thetah     -45
     thetam     -30
     thetan     -35
     thetap     -47
     thetaz     -39

Notice that the parameters and initial conditions were pulled directly from the .oden file in the stub generation. This makes it easier to transfer simulations from XPPAUT to NeuronetExperimenter. However, the actual parameters and initial conditions that will be used for a simulation run will be in the .net file. So any of these values can be overwritten in the .net file rather than changing them in the .oden file and rebuilding the simulator. The only time the simulator needs to be rebuilt is when the equations for a model has changed, or new neuron types are added.

Finally, to run the simulation, simply type the following:

> NeuronetExperimenter zca.setup              

The simulator will run quickly and the final output is "Saving Network" before terminal control returns to the user. The output data is placed into a subdirectory of the .setup file with the name of the .setup file (in this case simulations/ca1/zca/). In the simulations/ca1/zca/neuron_1.txt file are the values of the state variables as follows:

zca/neuron_1.txt:
t               VVs             hhs             nns             bbs             zzs   
0               -71.7802        0.987335        2.45734e-02     0.203516        1.41e-03   
5.e-02          -71.7473        0.986834        2.45831e-02     0.203511        1.41001e-03   
0.1             -71.7144        0.986357        2.45986e-02     0.203504        1.41003e-03   
0.15            -71.6817        0.985901        2.46194e-02     0.203493        1.41005e-03

...             ...             ...             ...            
...             ...            


'Dt' and 'Print Step Size' in the zca.setup file determines the rate at which these data points are output (in this case 1 row of samples per 0.05 ms). Plotting the VVs column in your favorite plotting tool results in something that looks like the following:

neuronetexperimenter example

This completes the example showing a single-neuron simulation in NeuronetExperimenter. In the next tutorial, we will show how to couple this CA1 neuron to another CA1 neuron to achieve synchronous bursting.

>> Tutorial #2. Coupling Neurons through Synaptic Connections

<< Main Manual