However, I have a problem. I want you to be able to run the completed example from this page but this disallows the running of "special" versions of NEURON on UNIX machines. (There would be no problem under mswin since the downloaded hoc file that is to be executed could change to the proper directory exercise/rectifying_gap_junction and dynamically load the nrnmech.dll file).
So, to allow all machines to run this
example from the web, I am using a Channel Builder to specify the properties
of the gap junction channels in terms of a simple HH-style mechanism
with a single gating variable:
g = gmax * O, where O' = (Oinf - O)/Otau
We use three cellbuilders to create the two HH axons and a gap section. By specifying the orientation of each section and moving the 0 location of the root, we can arrange the sections so that combined appearance will turn out to look like
which nicely indicates the intended relation between the structures and makes it convenient to select the site of stimulus current injection as well as points for a time plot and two separate paths for a space plot.
Happily, the use of the "Reposition" tool in the "Topology" panel of a "Continuously Create"ing CellBuilder constantly updates the location of the instantiated sections and this is immediately re-plotted in a shape scene.
I'm using 1000um x 10um sections with hh channels and "d_lambda" segmentation for the "left" and "right" cables. For the gap section, I am using an area of 100 um2, cm as close to 0 as the cell builder allows (the default implicit method in NEURON allows cm=0 but that is another story), an rgap channel with maximum conductance of 1 mA/cm2 == 1 uS, ena=0 (ions mistakenly don't show up in the CellBuilder so that can only be done with a NEURONMainMenu/Tools/DistibutedMechanism/Viewers/ShapeName tool or with an interpreter statement) and an extracellular mechanism.
The extracellular mechanism for the gap section is a key idea in this exercise since it gives us a non-trivial extracellular node (without an extracellular mechanism, the outside voltage next to the membrane is defined to be 0). This means that we can use available channel and point process mechanisms to create an arbitrary two terminal conductance component which, in conjunction with the LinearCircuit builder, can be attached between any two points in a network of cells. We defeat the normal usage of the extracellular mechanisms by setting xg to 0 so that there is no longer a default path from the extracellular node to ground. Thus the normal equivalent circuit of a single compartment section has been subverted to look like
Now the Linear Circuit Builder can be used to connect these pieces.
The batteries are necessary in order to introduce electrical current variables as first class states of the system. These current states allow consistency of an otherwise overdetermined system. That is, connecting two voltage nodes by a short circuit introduces the equation v1 = v2 and the only way to make this consistent with the two current balance equations for the nodes is to calculate the current flowing through the short circuit simultaneously with all the other membrane potentials. The batteries themselves have a default potential of 0 mV. This is a nice trick to use when one wishes to measure the current through a short circuit.
See how an action potential initiated on the left propagates into the right section. However an action potential initiated on the right is blocked by the gap junction.
Clearly, the Linear Circuit Builder would be inadequate to handle more than a few gap junctions. In hoc one would manage such simulations by writing a "GapJunction" template that manages a gap section with an rgap and extracellular mechanism along with a LinearMechanism instance to connect the gap junction to the desired locations. With that class as the basic object, it would then not be too much trouble to create a GUI tool (perhaps using a Shape scene) that managed interactive creation of the gap junctions.