I should have been more explicit about usage in writing the readme.txt that accompanies the files in extracellular_stim_and_rec.zip. Of course, at the time it was all very clear to me, which is why some helpful tips were left unstated. Here I try to atone for these omissions.
First, the code is written in a very modular fashion, which separates specification of biological properties, instrumentation, control code, and user interface from each other. This was done for several reasons, not least of which is the fact that it allows "plug and play" substitution of one model cell for another.
To see what this means, consider the file initxstim.hoc:
Code: Select all
load_file("anatscale.hoc") // show xyz scale bars
load_file("interpxyz.hoc") // only interpolates sections that have extracellular
load_file("setpointers.hoc") // automatically calls grindaway() in interpxyz.hoc
load_file("rigc.ses") // RunControl, graphs of v, vext, e_extracellular
load_file("rigxc.ses") // graph of er_xtra, just for diagnostic|development purposes
load_file("field.hoc") // computes extracellularly recorded potential vrec
load_file("vrecc.ses") // graph of vrec(t)
load_file("calcrxc.hoc") // computes transfer r between segments and recording electrodes
// load_file("iclampc.ses") // intracellular stimulus
load_file("stim.hoc") // extracellular stimulus
load_file("msgxc.hoc") // minimal hints
The second load_file() statement tells NEURON to read the file that specifies the anatomical and biophysical properties of the model cell. In this particular case, the file is cell.ses, which was created by saving a CellBuilder to a ses file, but it could just as easily be a hoc file. The file must do the following--
1. Specify topology: create and connect the sections, and use a single access statement to declare one of them as the default section.
2. Assign biophysical properties and specify discretization: assign values to Ra, cm and nseg; insert whatever density ("distributed") mechanisms are necessary.
3. Insert extracellular and xtra into all sections that are to "feel" the effect of an extracellular field. The parameters of extracellular should be assigned the following values:
xraxial=1e+09 xg=1e+09 xc=0 e_extracellular=0
4. If geometry was specified with the stylized method (i.e. L and diam) rather than the pt3d method, call define_shape(). Once is enough.
The two other files that may require changes by the user are calcrxc.hoc and stim.hoc.
The introductory comments to calcrxc.hoc are somewhat misleading. The code does not set up bipolar stimulation--it sets up monopolar stimulation. I offer my deepest apologies for this remnant of a previous implementation and promise never to do such a thing again. Clever users will quickly discover how to make it generate a bipolar stimulus (hint: the solution is in the file itself).
stim.hoc contains the code that specifies the waveform of the current that is applied to the stimulating electrodes.
Conditions of reuse
Anyone is welcome to reuse any or all of it and modify it as necessary, but if such reuse produces fame or fortune I would appreciate a piece of the action. It would be nice if results published in a reputable scientific journal were accompanied by acknowledgment of the origins of the code. And of course I wrap myself in the same litany of disclaimers that MicroSoft repeats in its EULAs.
I'd be glad to hear of suggestions for improving this code. Support is conditioned on the requirement that the user's code adhere to good programming practice. ("well, then why are we using hoc?")
ChrisR, you did a good job of deciphering the basic structure of initxstim.hoc and identifying the files that are essential for extracellular stimulation.
You will want to change the parameters of extracellular as noted above.
xtra should be inserted into all sections of your model, unless the myelinated internodes are encased in little Faraday cages.
Here are some other questions and comments that may help you avoid some nasty little gotchas:
Is there any particular reason for the nseg values you're using, i.e. 1 for the (long) internodes, and 10 for the (very short) nodes? Also, when nseg is even, what does it mean to refer to somerangevariable
(0.5) (or even somerangevariable
without the (0.5) bit)? It would be a good idea to read the FAQ list's entries about nseg -- see http://www.neuron.yale.edu/neuron/faq
Finally, please see 'Use only one "access" statement' in the Forum's "Hot tips" area viewforum.php?f=28