Reader Comments

Post a new comment on this article

Conceptual errors and coding bugs related to how the magnetically-induced electric field is coupled to the neuron model

Posted by bwang443 on 14 May 2019 at 21:11 GMT

We’d like to let readers of PLOS Computational Biology know that, in addition to the two coding bugs regarding the geometry and morphology of the neuron models (see previous comment posted in 2015), this article and the related NEURON code ( contains conceptual errors and coding bugs related to how the magnetically-induced electric field (E-field) is coupled to the neuron models. Specifically, the method of converting the activating function of the E-field into an equivalent current injection applied to the neuronal compartments has a number of problems. Fixing these implementation errors drastically alters the results and conclusions about neural activation by magnetic stimulation, which is discussed in details below.

Boshuo Wang and Aman Aberra, Duke University

1. Errors in the derivation of the equivalent current for mid-cable compartments

1.1. Dimension error—Pashut et al. derived from the continuous cable equation (Eq. 5) the current injection per unit cable length (Eq. 2, 3, 6 and 10), but did not convert the dimension to current injection per unit surface area or total current injection per compartment. To apply a current into the cable compartments in the NEURON software, it has to be either a total current injected as a point process, or to be converted into a membrane current density (dimension of current divided by surface area) for which NEURON handles the scaling by the compartment’s surface area. Pashut et al. attempted to use a membrane current density in their NEURON implementation (as stated on page 3), which would require dividing Eq. 10 by the compartment circumference, but this conversion was neither presented in the article nor implemented in the code.

1.2. Incorrect differentiation—Derivation of Eq. 3 incorrectly placed the cable’s axial resistance per unit length outside the differential operator, whereas the correct derivation should have the axial resistance per unit length inside (see Kamitani et al. [1], Eq. 3). Similarly, Eq. 6, which was the approximation of Eq. 3 for a short cable segment, should also place the axial resistance per unit length inside the difference operator of the numerator. The subsequent calculation in Eq. 10 did not have the E-field at the two ends of the cable segment scaled individually by the local axial resistance, which could be different in general, particularly for morphologically realistic cable models. Eq. 10 also had the incorrect dimension of current due to a typo: the length of the cable segment should be squared (as in their code).

The simpler method to calculate the total current applied to a cable compartment should integrate Eq. 2 along the cable (see Kamitani et al. [1], Eq. 4 and Fig. 1(a), and Wu et al. [2], Eq. 2) and result in an equation that includes the axial resistances at both ends of the compartments.

2. Bugs in the NEURON code implementing the equivalent current for mid-cable compartments

2.1. E-field sampling shift—The sampling of the two E-field values according to Eq. 10 should be at the two ends of a compartment, which are located between the centers of the compartment and its two neighbors. Pashut’s code (line 94 in file TwoDimensions\Neuron\magstim.hoc) sampled the E-fields at the centers of a compartment and its next neighbor, therefore shifting the calculation by half the compartment length.
NOTE: All line numbers in the following text refer to this code file, unless otherwise noted.

2.2. Use of incorrect axial resistance—To scale the E-field difference, the axial resistance was taken at the compartment’s center (line 109), which in NEURON is the (total) axial resistance (in MΩ) between the current compartment and its previous neighbor (topological parent). This axial resistance should only be used to scale the E-field on one end of the compartment. The E-field on the other end should be scaled by the axial resistance between the current compartment and its next neighbor (obtained at the next compartment), but this was not calculated due to the incorrect current injection derivation as discussed in 1.2.

2.3. Confusing compartment lengths with intercompartment distances—As the axial resistance per unit length should be used as in Eq. 2, 3, 6 and 10, the code (line 109) scaled the total axial resistance but incorrectly used the lengths of the compartment instead of the intercompartment distances. While in NEURON these two are identical in the middle of a cable section due to the uniform discretization within the sections, they are different at the first and last compartments of a section, as these intercompartment distances span different sections, which have, in general, different compartment sizes.
NOTE: in NEURON, a section refers to a continuous length of unbranched cable, which may consist of one or many compartments [3].

2.4. Dimension error—The calculated current injection (line 109) was per unit cable length and had incorrect dimension and units for the implementation as a membrane current density [4]. The correct calculation should further divide the current by the circumference of the compartment.

3. Failure of equivalent current to account for termination, connection, and branching points of the cable

Pashut et al. only considered the equivalent current for mid-cable activation based on the partial differential equation describing homogenous unmyelinated axons cables and did not modify it to balance the compartment’s transmembrane current and intracellular current(s) at the ends of cable sections, such as those for branch points or sealed terminals (see Hines and Carnevale [3], Eq. 2 and Fig. 3.1). The calculation for mid-cable activation of an unbranched axon consisting of several sections was also incorrect at the connection points, e.g., between the axon hillock and initial segment or between nodes and internodes. Regardless of how the sections were connected, the applied current by Pashut et al. behaved as if the exogenous component of the axial current driven by the magnetically-induced E-field could leak in and out of the section ends without crossing through the membrane to generate the appropriate polarization [5]. (The intrinsic component of the axial current due to the propagation of membrane potential is handled by NEURON solver and therefore not affected.)

Instead, the current balance equation of cable compartments in a discretized neuron model [3,6,7] should be used as the starting point for the derivation to account for the discontinuity at branching points and terminals, as well as the parameter variation within and between cable sections (diameter, ion channel distribution, myelination, etc.). For correct implementation of the current in NEURON, the calculations need to span cable sections, and thus the cell’s topology needs to be learned by traversing its entire tree-like structure (for example, recursively using a depth-first-search). Pashut’s code used “forall” loops (on lines 43 and 107) containing only local operations within the same cable sections, and thus was not able to calculate the correct current at the section ends.
NOTE: In NEURON, “forall” loops go through cable sections in the order of their creation, regardless of how they are connected.

The current balancing was correctly implemented for the equivalent current method at terminals by Nagarajan et al. ([8], Eq. 13 and 14), Kamitani et al. ([1], Fig. 1(b)), Wu et al. ([2], p. 55), and Elcin et al. ([4], directly debugging Pashut’s code), and at branch points by Kamitani et al. ([1], Fig. 1(c)) and Wu et al. ([2], Eq. 3), respectively.

4. Bugs at the ends of cable section rendered all axonal nodes unresponsive to magnetic stimulation

Regardless of the actual E-field distribution and how many compartments a cable section consisted of, Pashut’s code (line 94) generated zero current injection at the last compartment of a cable section due to the inappropriate use of range variables at the ends of cable sections.
NOTE: in NEURON, a range variable is a function of position along a cable section (see [3], sections 3.2, 4.4, and 4.5 for NEURON’s spatial discretization and representation of cable sections and subtleties with range variables).

While the axon hillock, initial segment, and internodes contained 5 compartments each and were capable of depolarization by the (incorrect) current injection, the axonal nodes consisted of a single compartment and would never be directly polarized by the E-field. (See lines 112 to 166 of code file TwoDimensions\Neuron\BACModel_mag.hoc for model's construction of axonal sections.) In this study by Pashut et al., terminal activation was impossible as the axon terminated at a node; and mid-cable activation was negligible, due to the low gradients of magnetically-induced E-field and the insensitivity of the myelinated internode. The initiation of action potentials in the axon initial segment was due to the geometric error of E-field mapping that created an erroneous strong E-field gradient where the axon initial segment was incorrectly placed (see the other comment to this paper). Thus, inconsistent with cable theory, the orientations of axon terminals and bends and discontinuities like bifurcations and diameter variation had almost no effect on activation threshold (Fig. 4 & 10). The correct simulations by Wu et al. showed orientation-sensitive activation and terminals as the predominant initiation sites (see [2], Fig. 2, 3, 5, and 9), as did the debugged code [4].

1. Kamitani Y, Bhalodia VM, Kubota Y, Shimojo S. A model of magnetic stimulation of neocortical neurons. Neurocomputing. 2001;38–40: 697–703. doi:10.1016/S0925-2312(01)00447-7
2. Wu T, Fan J, Lee KS, Li X. Cortical neuron activation induced by electromagnetic stimulation: a quantitative analysis via modelling and simulation. J Comput Neurosci. 2016;40: 51–64. doi:10.1007/s10827-015-0585-1
3. Hines ML, Carnevale NT. The NEURON Simulation Environment. Neural Computation. 1997;9: 1179–1209. doi:10.1162/neco.1997.9.6.1179
4. Elcin D, Tikidji-Hamburyan R, Canavier C. The effect of neural orientation on action potential generation elicited by transcranial magnetic stimulation: a computational study. Neuroscience 2017, Society of Neuroscience’s Annual Meeting. Washington, DC, USA; 2017. p. Abstract 202.04. http://www.abstractsonlin...
5. Wang B, Grill WM, Peterchev A V. Coupling Magnetically Induced Electric Fields to Neurons: Longitudinal and Transverse Activation. Biophysical Journal. Biophysical Society; 2018;115: 95–107. doi:10.1016/j.bpj.2018.06.004
6. Rattay F. The basic mechanism for the electrical stimulation of the nervous system. Neuroscience. 1999;89: 335–346. doi:10.1016/S0306-4522(98)00330-3
7. Hines M. Efficient computation of branched nerve equations. International Journal of Bio-Medical Computing. 1984;15: 69–76. doi:10.1016/0020-7101(84)90008-4
8. Nagarajan SS, Durand DM, Warman EN. Effects of induced electric fields on finite neuronal structures: a simulation study. IEEE Transactions on Biomedical Engineering. 1993;40: 1175–1188. doi:10.1109/10.245636

No competing interests declared.