Programming Tips for NEURON

 

Accessing Inbuilt Functions and the GUI

To make sure NEURON can access its library of inbuilt functions, including the graphical user interface, the following line should appear at the top of your main HOC file:

xopen("$(NEURONHOME)/lib/hoc/noload.hoc")

To start the GUI, include the following line after the above command:

nrnmainmenu()


Dividing Your Simulation Between Multiple HOC Files

The xopen command can be used to load and run the contents of any file containing HOC commands in the HOC interpreter. Thus you can divide the HOC commands that specify your simulation logically into multiple files, keeping each individual file manageably small. Your main file (ie the one that you run by double-clicking or including on the NEURON command line to start your simulation) may look something like:

xopen("$(NEURONHOME)/lib/hoc/noload.hoc")
nrnmainmenu()
xopen("mycell.hoc")
xopen("mynet.hoc")
access soma

Note that the HOC commands are executed as soon as they are loaded from the file using the xopen command.


Saving Your Session

If you open lots of GUI windows while playing with your simulation, you can save them by selecting "save session" from the "NEURON Main Menu". Then when you run the simulation again, you can restore all your windows by loading the session file with an xopen command at the OC prompt e.g.:

xopen("mygui.ses")

Your session file name can also be added to the NEURON command line if you start NEURON from a Unix or DOS prompt.

 

 
If you have comments or suggestions, email me at b.graham@cs.stir.ac.uk