4.3 Section variables
 Three parameters apply to the section as a whole: cytoplasmic resistivity Ra ( cm), the section length L, and the compartmentalization parameter nseg. The first two are "ordinary" in the sense that they do not affect the structure of the equations that describe the model. Note that the hoc code specifies values for L but not for Ra. This is because each section in a model is likely to have a different length, whereas the cytoplasm (and therefore Ra) is usually assumed to be uniform throughout the cell. The default value of Ra is 35.4 cm, which is appropriate for invertebrate neurons. Like L it can be assigned a new value in any or all sections (e.g. ~200 cm for mammalian neurons). The user can change the compartmentalization parameter nseg without having to modify any of the statements that set anatomical or biophysical properties. However, if parameters vary with position in a section, care must be taken to ensure that the model incorporates the spatial detail inherent in the parameter description.

4.4 Range variables
 Like dendritic diameter in our example, most cellular properties are functions of the position parameter x. NEURON has special provisions for dealing with these properties, which are called "range variables." Other examples of range variables include the membrane potential v, and ionic conductance parameters such as the maximum HH sodium conductance gnabar_hh (siemens / cm2). Range variables enable the user to separate property specification from segment number. A range variable is assigned a value in one of two ways. The simplest and most common is as a constant. For example, the statement axon.diam = 10 asserts that the diameter of the axon is uniform over its entire length. The syntax for a property that changes along a length of a section is rangevar(xmin:xmax) = e1:e2. The four italicized symbols are expressions with e1 and e2 being the values of the property at xmin and xmax, respectively. The position expressions must meet the constraint 0 <= xmin <= xmax <= 1. Linear interpolation is used to assign the values of the property at the segment centers that lie in the position range [xmin, xmax]. In this manner a continuously varying property can be approximated by a piecewise linear function. If the range variable is diameter, neither e1 nor e2 should be 0, or corresponding axial resistance will be infinite. In our model neuron, the simple dendritic taper is specified by diam(0:1) = 10:3 and nseg = 5. This results in five segments that have centers at x = 0.1, 0.3, 0.5, 0.7 and 0.9 and diameters of 9.3, 7.9, 6.5, 5.1 and 3.7, respectively. The value of a range variable at the center of a segment can appear in any expression using the syntax rangevar(x) in which 0 <= x <= 1. The value returned is the value at the center of the segment containing x, NOT the linear interpolation of the values stored at the centers of adjacent segments. If the parentheses are omitted, the position defaults to a value of 0.5 (middle of the section). A special form of the for statement is available: for (var) stmt. For each value of the normalized position parameter x that defines the center of each segment in the selected section (along with positions 0 and 1), this statement assigns var that value and executes the stmt. This hoc code would print the membrane potential as a function of physical position (in um) along the axon: ``` axon for (x) print x*L, v(x) ```
4.5 Specifying geometry: stylized vs. 3-D
 As noted previously (4.2.2 Second step . . .), there are two ways to specify section geometry. Our example uses the stylized method, which simply assigns values to section length and diameter. This is most appropriate when cable length and diameter are authoritative and 3-D shape is irrelevant. If the model is based on anatomical reconstruction data (quantitative morphometry), or if 3-D visualization is paramount, it is best to use the 3-D method. This approach keeps the anatomical data in a list of (x, y, z, diam) "points." The first point is associated with the end of the section that is connected to the parent (this is not necessarily the 0 end!) and the last point is associated with the opposite end. There must be at least two points per section, and they should be ordered in terms of monotonically increasing arc length. This pt3d list, which is the authoritative definition of the shape of the section, automatically determines the length and diameter of the section. When the pt3d list is non-empty, the shape model used for a section is a sequence of frusta. The pt3d points define the locations and diameters of the ends of these frusta. The effective area, diameter, and resistance of each segment are computed from this sequence of points by trapezoidal integration along the segment length. This takes into account the extra area introduced by diameter changes; even degenerate cones of 0 length can be specified (i.e. two points with same coordinates but different diameters), which add area but not length to the section. No attempt is made to deal with the effects of centroid curvature on surface area. The number of 3-D points used to describe a shape has nothing to do with nseg and does not affect simulation speed.

4.6 Density mechanisms and point processes
 The insert statement assigns biophysical mechanisms, which govern electrical and (if present) chemical signals, to a section. Many sources of electrical and chemical signals are distributed over the membrane of the cell. These density mechanisms are described in terms of current per unit area and conductance per unit area; examples include voltage-gated ion channels such as the HH currents. However, density mechanisms are not the most appropriate representation of all signal sources. Synapses and electrodes are best described in terms of localized absolute current in nanoamperes and conductance in microsiemens. These are called point processes. An object syntax is used to manage the creation, insertion, attributes, and destruction of point processes. For example, a current clamp (electrode for injecting a current) is created by declaring an object variable and assigning it a new instance of the IClamp object class (see 4.2.3 Third step: attach stimulating electrodes). When a point process is no longer referenced by any object variable, the point process is removed from the section and destroyed. In our example, redeclaring stim with the statement objref stim would destroy the pulse stimulus, since no other object variable is referencing it. The location of a point process can be changed with no effect on its other attributes. In our example the statement dendrite[2] stim.loc(1) would move the current stimulus to the distal end of the third dendrite. Many user-defined density mechanisms and point processes can be simultaneously present in each compartment of a neuron. One important difference between density mechanisms and point processes is that any number of the same kind of point process can exist at the same location. User-defined density mechanisms and point processes can be linked into NEURON using the model description language NMODL. This lets the user focus on specifying the equations for a channel or ionic process without regard to its interactions with other mechanisms. The NMODL translator then constructs the appropriate C program which is compiled and becomes available for use in NEURON. This program properly and efficiently computes the total current of each ionic species used, as well as the effect of that current on ionic concentration, reversal potential, and membrane potential. An extensive discussion of NMODL is beyond the scope of this article, but its major advantages can be listed succinctly.
 Interface details to NEURON are handled automatically and there are a great many such details. NEURON needs to know that model states are range variables and which model parameters can be assigned values and evaluated from the interpreter. Point Processes need to be accessible via the interpreter object syntax and density mechanisms need to be added to a section when the "insert" statement is executed. If two or more channels use the same ion at the same place, the individual current contributions need to be added together to calculate a total ionic current. Consistency of units is ensured. Mechanisms described by kinetic schemes are written with a syntax in which the reactions are clearly apparent. The translator provides tremendous leverage by generating a large block of C code that calculates the analytic Jacobian and the state fluxes. There is often a great increase in clarity since statements are at the model level instead of the C programming level and are independent of the numerical method. For example, sets of differential and nonlinear simultaneous equations are written using an expression syntax such as ``` x' = f(x, y, t) ~ g(x, y) = h(x, y) ``` where the prime refers to the derivative with respect to time (multiple primes such as x'' refer to higher derivatives) and the tilde introduces an algebraic equation. The algebraic portion of such systems of equations is solved by Newton's method, and a variety of methods are available for solving the differential equations, such as Runge-Kutta or backward Euler. Function tables can be generated automatically for efficient computation of complicated expressions. Default initialization behavior of a channel can be specified.

 Address questions and inquiries to Michael Hines or Ted Carnevale Digital preprint of "The NEURON Simulation Environment" by M.L. Hines and N.T. Carnevale, Neural Computation, Volume 9, Number 6 (August 15, 1997), pp. 1179-1209. Copyright © 1997 by the Massachusetts Institute of Technology, all rights reserved. HTML formatting and graphics for page navigation copyright © 1997 by N.T. Carnevale amd M.L. Hines.