## Figures

## Abstract

Transcranial brain stimulation and evidence of ephaptic coupling have sparked strong interests in understanding the effects of weak electric fields on the dynamics of neuronal populations. While their influence on the subthreshold membrane voltage can be biophysically well explained using spatially extended neuron models, mechanistic analyses of neuronal spiking and network activity have remained a methodological challenge. More generally, this challenge applies to phenomena for which single-compartment (point) neuron models are oversimplified. Here we employ a pyramidal neuron model that comprises two compartments, allowing to distinguish basal-somatic from apical dendritic inputs and accounting for an extracellular field in a biophysically minimalistic way. Using an analytical approach we fit its parameters to reproduce the response properties of a canonical, spatial model neuron and dissect the stochastic spiking dynamics of single cells and large networks. We show that oscillatory weak fields effectively mimic anti-correlated inputs at the soma and dendrite and strongly modulate neuronal spiking activity in a rather narrow frequency band. This effect carries over to coupled populations of pyramidal cells and inhibitory interneurons, boosting network-induced resonance in the beta and gamma frequency bands. Our work contributes a useful theoretical framework for mechanistic analyses of population dynamics going beyond point neuron models, and provides insights on modulation effects of extracellular fields due to the morphology of pyramidal cells.

## Author summary

The elongated spatial structure of pyramidal neurons, which possess large apical dendrites, plays an important role for the integration of synaptic inputs and mediates sensitivity to weak extracellular electric fields. Modeling studies at the population level greatly contribute to our mechanistic understanding but face a methodological challenge because morphologically detailed neuron models are too complex for use in noisy, in-vivo like conditions and large networks in particular. Here we present an analytical approach based on a two-compartment spiking neuron model that can distinguish synaptic inputs at the apical dendrite from those at the somatic region and accounts for an extracellular field in a biophysically minimalistic way. We devised efficient methods to approximate the responses of a spatially more detailed pyramidal neuron model, and to study the spiking dynamics of single neurons and sparsely coupled large networks in the presence of fluctuating inputs. Using these methods we focused on how responses are affected by oscillatory weak fields. Our results suggest that ephaptic coupling may play a mechanistic role for oscillations of population activity and indicate the potential to entrain networks by weak electric stimulation.

**Citation: **Ladenbauer J, Obermayer K (2019) Weak electric fields promote resonance in neuronal spiking activity: Analytical results from two-compartment cell and network models. PLoS Comput Biol 15(4):
e1006974.
https://doi.org/10.1371/journal.pcbi.1006974

**Editor: **Lyle J. Graham,
Université Paris Descartes, Centre National de la Recherche Scientifique, FRANCE

**Received: **May 3, 2018; **Accepted: **March 22, 2019; **Published: ** April 22, 2019

**Copyright: ** © 2019 Ladenbauer, Obermayer. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **Python code for the presented models and methods is freely available at https://github.com/neuromethods/two-compartment-models-and-weak-electric-fields.

**Funding: **This work was supported by the German Research Foundation via Collaborative Research Center 910, http://www.dfg.de/. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

The interaction between weak electric fields and neuronal activity in the brain has gained increased attention over the past decade [1–3]. These weak fields can be generated endogenously by populations of neurons [4–7] or through transcranial electrical stimulation [3, 8–10], and they can modify neural activity in various ways [4, 11–15]. Although the electric fields caused by this type of noninvasive intervention exhibit low magnitudes (≤ 1-2 V/m [8, 9, 16]) they can modulate neuronal spiking activity [3, 4, 17, 18] and lead to changes in cognitive processing [19, 20], offering a number of possible clinical benefits [21, 22]. The influence of extracellular fields on the subthreshold membrane voltage of single cells has been thoroughly studied and biophysically explained [17, 23–26]. How weak electric fields affect neuronal spiking activity and interact with network dynamics, however, is currently not well understood [3].

Multi-compartment models are useful tools to dissect effects in single neurons in the absence of input fluctuations [27–29], but they are not well suited to study neuronal and network spiking activity in noisy, in-vivo like conditions, because of their large complexity. Single-compartment (point) neuron models, on the other hand, allow for mechanistic analyses at the network level (see, e.g. [30–32]), but they lack the spatial structure that is required to biophysically describe the direct effect of an electric field on the membrane voltage [25]. Extracellular fields can only be effectively incorporated either in simplified, phenomenological ways [12, 14, 33] or by elaborate model extensions to accurately reproduce the effects on spatially elongated neurons [25] at the cost of an increased complexity of the system (and its analysis). Two-compartment neuron models feature a suitable compromise between biological rigor and analytical tractability in this regard, with minimal level of spatial detail necessary to biophysically take into account an extracellular electric field. Models of this type have proven useful to study the effects of constant fields on the activity of single neurons and synchronization of neuronal pairs [34–36]. Irrespective of extracellular fields simplified two-compartment neuron models have also been successfully applied, for example, to dissect neural coding of high-frequency signals [37, 38] or neurocircuit mechanisms [39]. However, powerful methods to study the spiking dynamics of these model neurons, at the levels of single cells and populations in a noisy, cortical setting, have been lacking.

Here we employ this model class to describe the activity of pyramidal (PY) neurons receiving in-vivo like fluctuating inputs in the presence and absence of an oscillatory extracellular field. The neuron model consists of a compartment for the soma and one for the apical dendrite, allowing to differentiate between synaptic inputs at the soma (including basal dendrite) and those at the distal (apical) dendrite. We first determine the model parameters semi-analytically to reproduce the behavior of a more sophisticated, spatially extended neuron model which involves the cable equation. We then develop an analytical method to effectively characterize the stochastic spiking dynamics of single neurons and sparsely coupled large populations of PY neurons and inhibitory (IN) interneurons. The method exploits the Fokker-Planck equation and a moment closure approximation technique.

We apply these tools to study (i) how a weak oscillatory field affects the spiking activity of neurons exposed to fluctuating synaptic inputs, (ii) how these effects compare to those of weak oscillatory inputs in the absence of an electric field, and (iii) how weak applied fields modulate network-induced oscillations. Our contribution sheds some light on the effects of extracellular fields at the population level. Furthermore, it provides useful methods for mechanistic studies on the dynamics of coupled compartmentalized spiking neurons that allow to broadly distinguish inputs according to the location of the synapses. Such a distinction is important, for example, in circuit models which involve different types of (inhibitory) neurons.

## Results

### Modeling approach

#### Pyramidal neuron model.

The PY model neurons consist of two compartments, one for the soma and one for the (apical) dendrite, for which we consider trans-membrane capacitive currents, ionic leak currents, an approximation of the somatic Na^{+} current at spike initiation, an internal current, synaptic input currents and an extracellular electric field. The latter is defined as , where , are the extracellular membrane potentials for the somatic and dendritic compartments, whose centers are separated with distance Δ. The dynamics of action potentials are simplified by a reset mechanism of the integrate-and-fire type at the soma. Fluctuating input currents at the soma and the dendrite, *I*_{s} and *I*_{d}, that mimic the compound effect of synaptic bombardment in vivo, are described by stochastic processes with means , and standard deviations *σ*_{s}, *σ*_{d}. In this model the dynamics of the somatic and the dendritic membrane voltage, *V*_{s} and *V*_{d}, respectively, are thus governed by two coupled differential equations together with a reset condition for spikes (for details see Methods section 1). A schematic circuit diagram of the model is depicted in Fig 1A.

A: schematic circuit diagram for the membrane voltage dynamics of the two-compartment (2C) model. B: visualization of a spatial ball-and-stick (BS) model neuron (black) whose somatic voltage dynamics are approximated by the 2C model (green). *I*_{s}, *I*_{d} denote the input currents at the soma and dendrite, *E* is the extracellular electric field, *V*_{s} is the somatic membrane voltage of the 2C model neuron and *V* is the membrane voltage of the BS model. C-H: responses of a BS neuron parametrized to model a typical PY cell and of the fitted 2C model (for parameter values see Table 1). C: amplitude of subthreshold somatic impedances for inputs at the soma and dendrite as a function of input frequency (using Eqs (11), (12) and (67)–(69)). D: amplitude of subthreshold somatic voltage responses to a sinusoidal electric field with amplitude *E*_{1} = 1 V/m (and *E*_{0} = 0) as a function of field frequency (using Eqs (10)–(12) and (66)–(69)). E: somatic voltage transients after a spike for constant threshold inputs at the soma (left) and dendrite (right) of the BS model (black) and 2C model (green); for details see Methods section 4. F: example time series of the somatic voltage in response to fluctuating inputs, with spike times indicated, as well as voltage histograms of both models (right) and voltage density *p*_{s} (green line; analytically calculated). Note that although *p*_{s} appears Gaussian this is not an assumption of our method. G: spike coincidence measure Γ between the spike trains of both models for , and , . Γ = 1 indicates an optimal match with precision Δ_{c} = 5 ms, Γ = 0 indicates chance (for details see Methods section 5). H: spike rates from numerical simulation (symbols) and analytical calculation (green lines; cf. Methods section 3) for input parameter values as in G. The grey square marks the parameter values from F. All curves in C-E and H represent analytical results.

#### Model parametrization.

To determine the parameter values of the two-compartment model and assess whether its spatial complexity is adequate we semi-analytically fit the model to a biophysically more sophisticated, spatially elongated ball-and-stick neuron model (Fig 1B). That model involves the cable equation, an integrate-and-fire spike mechanism at the soma and an extracellular field which is assumed spatially homogeneous (see Methods section 4). Due to its mathematical complexity this model is not well suited for analyses of spiking dynamics and application in networks. The fitting method approximates the somatic responses of the ball-and-stick model in an efficient way without knowledge about the input or the electric field. In brief, for both models we analytically calculate the somatic subthreshold responses for small amplitude variations of the inputs and the electric field as well as the transient somatic voltage responses after a spike for threshold inputs, and subsequently apply a least-squares fit (Fig 1C–1E). Note that the membrane voltage dynamics at the soma directly affect spike timing and are therefore the most relevant (axon initial segments are absorbed by the somatic compartments and not separately included in the models). In this way we rapidly obtain an accurate reproduction of the relevant response properties of the ball-and-stick model (Fig 1C–1H). Specifically, the subthreshold responses, in terms of somatic impedances for inputs at the soma and dendrite (Fig 1C) and the somatic voltage response for an oscillatory applied field (Fig 1D), are well approximated, and spiking activity, in terms of spike coincidences (Fig 1F and 1G, see Methods section 5) and the spike rate (Fig 1H), are accurately predicted. Note that the accuracy in Fig 1F–1H results from the approximation quality for subthreshold responses (Fig 1C) and post-spike transients (Fig 1E). This quality of our fitting method is not restricted to the selected ball-and-stick morphology but extends to a range of plausible shapes (S1 Fig).

#### Characterization of spiking dynamics.

We focus on spiking activity, in particular the dynamics of the (instantaneous) spike rate *r*. This quantity can be calculated exactly using the Fokker-Planck equation that governs the evolution of the joint probability density for the somatic and dendritic membrane voltage *p*(*V*_{s}, *V*_{d}, *t*), describing the stochastic dynamics in deterministic form (see Methods section 3). Since a numerical solution of this partial differential equation is very demanding in terms of implementation and especially computational effort we employ a moment closure approximation method. Specifically, we use *p*(*V*_{s}, *V*_{d}, *t*) = *p*_{s}(*V*_{s}, *t*)*p*_{d}(*V*_{d}|*V*_{s}, *t*), where *p*_{s} is the marginal probability density for the somatic voltage and *p*_{d} the probability density for the dendritic voltage conditioned on *V*_{s}, and approximate *p*_{d} by a conditioned Gaussian probability density. The resulting system allows for convenient and efficient calculation of the spike rate responses for constant input statistics as well as weak sinusoidal variations of the input moments or the applied field. To this end only ordinary differential equations need to be solved. An evaluation of this method in comparison to numerical simulation for constant input moments is shown in Fig 1H. Spike rates from simulations are well matched for a range of plausible input moments. Moreover, this quality of agreement extends to different parametrizations of the two-compartment model that correspond to various ball-and-stick morphologies (S2A Fig).

### Modulation of neuronal spiking activity

We first consider a PY neuron exposed to fluctuating inputs at the soma and the dendrite and a weak sinusoidal applied field. The noisy inputs drive the neuron to stochastic spiking activity that is influenced by the field. This effect can be quantified by the instantaneous spike rate across a large number of trials (obtained from numerical simulations with different realizations of the input), which is equivalent to the population-averaged spike rate for a large number of uncoupled PY neurons receiving independent inputs. The field leads to an oscillatory modulation of the spike rate that is accurately reproduced by our analytical calculation method (Fig 2A).

A: spike times and spike rate (histogram: grey, analytical result: green line; cf. Methods section 3) of a PY model neuron in response to a sinusoidal electric field, *E*(*t*) = *E*_{1} sin(*ωt*) with angular frequency *ω* (here: *ω*/(2*π*) = 12.6 Hz), in the presence of noisy background input. B: amplitude of spike rate responses to a field with amplitude *E*_{1} = 1 V/m as a function of field frequency for input statistics , , , (green squares) and , , , (green circles), as well as amplitude of normalized subthreshold somatic voltage responses (magenta dashed line). C and D: amplitude of spike rate responses (green) and of normalized subthreshold somatic voltage responses (impedances; magenta dashed lines) to sinusoidal modulations of the mean input at the soma, , with amplitude (C) or at the dendrite, , with amplitude (D) as a function of modulation frequency in the absence of an extracellular field. Baseline (constant) input statistics in C and D correspond to those in B. Remark: the spike rate responses to the field and those to modulations of the mean input are mathematically linked (by Eq (57)) such that the former can be calculated from responses to modulations at the soma and dendrite, respectively, using response amplitude and phase information.

By measuring these spike rate responses over a range of field frequencies we observe a clear resonance in a biologically relevant, relatively narrow frequency band (Fig 2B). In other words, the spike rate oscillations are strongest for field oscillations in that frequency range. This resonance behavior is not shown by the subthreshold membrane voltage response to the field in the absence of suprathreshold fluctuating inputs. Interestingly, spike rate responses to weak sinusoidal modulations of the mean input at the soma or dendrite instead of an applied field do not exhibit such a resonance (Fig 2C and 2D). Response amplitudes typically decrease as the frequency of the input modulations increases, although spike rate responses remain elevated for somatic modulations of up to about 100 Hz. This behavior is robustly shown for various neuronal morphologies (S2B Fig). The overall response amplitudes, especially for input modulations at the dendrite, however, are strongly affected by the ratio between dendritic and somatic membrane surface. An increased ratio appears to cause increased spike rate responses. Notably, the analytical results are in good agreement with those of numerical simulations (Fig 2 and S2 Fig). This justifies the extensive application of our analytical method in the subsequent analyses.

Next, we assess the resonance behavior caused by the applied field for a range of biologically plausible input statistics (see Fig 3). Intriguingly, resonance robustly appears across these input conditions; that is, a resonance peak occurs for very different spiking statistics, including low rate, high variability (due to small input means , and large variances , ) as well as high rate, low variability (due to large , and small , ; cf. Figs 3 and 1H). Resonance frequency (Fig 3A) and strength (Fig 3B and 3C) increase with increasing input mean, but not necessarily with increasing input variance. For mean-dominated input (that is, large input mean and small input variance) the resonance frequency is similar to the baseline spike rate (compare the dashed curves for large input mean in Fig 3A with Fig 1H). In this case an increase in input variance interestingly leads to a decrease in resonance frequency and strength. For fluctuation-dominated input the resonance frequency is restricted to the the beta and low gamma frequency bands (∼15-40 Hz), and peak amplitudes vary between about 1-2 spikes/s.

Resonance frequency (argmax_{ω} *r*_{1}(*ω*)/(2*π*); A), amplitude (max *r*_{1}(*ω*); B) and strength (max *r*_{1}(*ω*)/*r*_{1}(0); C) of the oscillatory spike rate with amplitude *r*_{1} (cf. Methods section 3) in response to a sinusoidal applied field with *E*_{1} = 1 V/m and angular frequency *ω* for a range of input statistics. Left: (dashed lines), (solid lines), and ; right: (dashed lines), (solid lines), and .

How does the external field promote this resonance behavior? From the definition of the extracellular field and the circuit diagram in Fig 1A it becomes evident that the trans-membrane currents caused by the field at the soma and dendrite are opposed (using Kirchhoff’s law, that all incoming currents at a point of the circuit must sum to zero; see Eqs (1) and (2), where *E*(*t*) affects *V*_{s} and *V*_{d} with opposite sign). This indicates that the electric field effectively reflects anti-correlated inputs at the soma and dendrite. To examine the influence of input correlations more closely we applied sinusoidal modulations of the mean input at the soma and dendrite with a phase shift (Fig 4A). A resonance peak emerges as the phase shift increases from 0 (synchronized modulations / strong correlation) towards 180° (anti-synchronized modulations / negative correlation) and becomes most pronounced at that value. We further considered a time lag instead of a phase shift between the two mean input modulations (Fig 4B). The lag effectively reflects a difference in delays with which an oscillatory signal arrives at the two neuronal locations, for example, due to a relay population. Lags that are sufficiently large cause multiple resonance peaks. The frequency that corresponds to the most dominant peak (with positive frequency) decreases with increasing time lag, but is otherwise largely independent of the baseline input statistics (Fig 4C).

A: amplitude of normalized rate responses to sinusoidal modulations of the mean input at the soma, , and dendrite, , with phase shift *ϕ* as a function of modulation frequency, for the baseline input statistics , , , (left) and , , , (right). *ϕ* = *π* corresponds to negatively correlated (anti-synchronous) modulations. B: amplitude of normalized rate responses to mean input modulations and with time lag Δ*T*. Baseline input statistics as in A. C: frequency (left) and normalized amplitude (resonance strength, using the amplitude at frequency 0; right) of the most dominant peak at a positive frequency >1 Hz as a function of time lag Δ*T* for baseline input statistics as in A.

### Modulation of network dynamics

To examine how an applied field interacts with network mechanisms to shape population dynamics we derived a mean-field network model from large populations of sparsely coupled PY neurons and IN neurons exposed to fluctuating background inputs and a spatially homogeneous (with respect to neuronal orientation) weak electric field. PY neurons are described by the two-compartment model and IN neurons by an established single-compartment spiking model (exponential integrate-and-fire), because IN neurons are spatially more compact and therefore the direct effect of the electric field on them is negligible [24]. Synaptic coupling is incorporated by delayed current pulses which cause post-synaptic potentials of reasonably small magnitude with distributed delays. In the derivation we apply a diffusion approximation and a moment closure method to transform the original network model into a manageable system of two Fokker-Planck equations—one for each population—coupled via synaptic input moments. This system describes the collective stochastic dynamics in a way that allows for convenient dissection of the network activity in terms of population-averaged instantaneous spike rates (see Methods section 6).

The network is parametrized to exhibit a baseline state of asynchronous (irregular) spiking activity that depends on the strength of the external drive. Network-induced resonance emerges for weak sinusoidal input modulations at the soma of PY neurons with strongest responses in the beta and gamma frequency bands (∼15-55 Hz, Fig 5). Depending on whether IN neurons target PY neurons only at the soma (Fig 5B, 5E and 5H) or only at the dendrite (Fig 5C, 5F and 5I) the resonance peak occurs at a higher or lower frequency compared to the mixed setup (Fig 5A, 5D, and 5G). This resonance behavior is more pronounced in a baseline state of increased activity (Fig 5A–5F) where the activity level of PY neurons seems more decisive than that of IN neurons (Fig 5G–5I). Interestingly, for input modulations at the dendrite of PY neurons such a clear resonance behavior does not appear.

Amplitude of oscillatory spike rate of the PY neuron population for networks of sparsely coupled PY and IN neurons exposed to external drives of different strengths and an applied field (solid lines, dots) or weak modulations of the mean input at the soma (dashed lines, squares) and dendrite (dotted lines, diamonds) of PY neurons, as a function of field/modulation frequency. Insets: baseline spike rates for the PY and IN populations (, ). Each PY neuron receives inputs from 100 IN neurons both at soma and dendrite (A,D,G-I) or from 200 IN neurons only at the soma (B,E) or dendrite (C,F), each IN neuron receives inputs from 200 PY neurons; random connectivity, excitatory/inhibitory coupling strengths ±0.1 mV and distributed delays with bi-exponential delay density (rise time constant 0.5 ms, decay time constant 2 ms/5 ms for excitatory/inhibitory connections; for details see Methods section 6). Baseline mean of the external input for PY neurons (at soma and dendrite): 6 pA (A-C), 9 pA (D-I), for IN neurons: 0 pA (A-F), 0.05 nA (G), 0.1 nA (H), 0.15 nA (I); input standard deviation: for PY neurons, for IN neurons. Field amplitude was *E*_{1} = 1 V/m, input modulation amplitudes were chosen to yield equal response amplitude at the lowest frequency. Symbols: results from network simulations (10,000 neurons), lines: analytical results from derived mean-field system.

When we consider a weak sinusoidal field instead of input modulations we observe a strongly amplified resonance of the population activity in the same frequency band. The prominent effect of an applied field in single cells thus carries over to PY-IN networks, boosting network-based oscillations that are mediated by an excitation-inhibition loop (as studied, for example, in [40]). Notably, the analytical results from the mean-field network are quantitatively validated by numerical simulations of networks with 10,000 neurons. The agreement is quite remarkable considering that the mean-field derivation requires additional approximations compared to the single cell setting. In sum these results indicate that an oscillatory electric field as generated, for example, by transcranial stimulation should be most effective to induce or maintain rhythmic network dynamics in the beta-gamma frequency range.

## Discussion

### Methodological aspects

#### Neuron model.

Model-based investigations on how extracellular electric fields impact neuronal spiking activity face a methodological challenge: the neuronal spatial extent plays an important biophysical role, however, morphologically detailed neuron models are exceedingly complex for use in noisy, in-vivo like conditions, especially in large networks. Two-compartment neuron models feature the minimal level of spatial detail required to biophysically account for the direct polarization effects caused by the field. At the same, simplified models of this type retain the computational efficiency and, in part, the analytical tractability of point neurons that are widely used to study network dynamics. Our approach is based on a two-compartment spiking PY neuron model which accounts for an external electric field and includes fluctuating synaptic input at the soma and/or (apical) dendrite. Using semi-analytical techniques this model was rapidly calibrated to accurately approximate the (subthreshold somatic and spiking) response properties of a morphologically more plausible ball-and-stick model neuron.

Based on that spatially elongated model we have recently developed an extension for point neuron models to match the subthreshold somatic responses to synaptic inputs and an applied weak electric field [25]. The methodology presented here entails several advantages compared to our previous work: the fitted two-compartment model involves a low-dimensional differential equation in contrast to an integro-differential equation (in case of the extended point model to account for dendritic filtering effects), allowing for faster numerical simulation, straightforward implementation of networks, and a natural way to account for an extracellular field. Notably, the last feature highlights a benefit over networks of point model neurons for which field effects were previously implemented in a simplified, phenomenological way [12, 14, 33]. Importantly, the two-compartment model further allowed for the application of analytical methods to study spiking dynamics.

#### Spike rate dynamics.

We devised a method to efficiently study the spike rate dynamics of these two-compartment neurons and the population activity of sparsely coupled large networks. It employs the Fokker-Planck partial differential equation and a moment closure technique for dimension reduction which allows to numerically solve the resulting system in reasonable time. These solutions yielded an accurate and efficient approximation of the instantaneous (population-averaged) spike rate (cf. Figs 1H, 2 and 5 and S2 Fig).

Similar moment closure methods were previously applied in different contexts, such as integrate-and-fire point model neurons with synaptic dynamics (see, e.g. [41, 42] and references therein). In Ref. [41] the issue was raised that moment closure may not be applicable for certain ranges of parameter values. For the setting and regions of parameter space considered throughout the present study the approximation method was well suited. This might not be the case for very small or large values of the input parameters (causing unphysiological behavior).

We approximated the conditional probability density *p*_{d}(*V*_{d}|*V*_{s}, *t*) by a conditioned Gaussian, thereby closing the system of lower dimensional equations at the 3^{rd} central moment of *V*_{d} (assuming the 3^{rd} and higher cumulants are zero). Closure at lower order moments lead to markedly less accurate results due to similar timescales for the somatic and dendritic voltage and strong coupling between those variables. On the other hand, the room for improvement is vanishingly small such that closure at higher order moments does not justify its increased implementation complexity and computational demands.

Notably, moment closure at order 1 is equivalent to the adiabatic approximation frequently applied for adaptive integrate-and-fire neurons in the presence of noise [32, 43–45]. In that case the conditional first centered moment (of the adaptation variable given membrane voltage) is approximated by the corresponding unconditioned moment. This usually leads to an accurate reproduction of the spike rate dynamics due to the circumstance that the timescales of the two variables are separated. Such an adiabatic approximation has also been applied for two-compartment Purkinje model neurons [37] which possess large dendritic trees. A substantial difference in somatic and overall dendritic capacitance justifies the assumption of separated timescales for those models. Our approach, in contrast, is also valid for model parametrizations that yield rather similar timescales for soma and dendrite, and therefore suitable for pyramidal cells.

It is worth noting that our analytical techniques also allow for correlated somatic and dendritic input fluctuations (cf. Methods section 3); an investigation into such input correlations, however, is beyond the scope of the present study. The methodological results presented here may further be used to derive a simple spike rate model in form of a low-dimensional differential equation from two-compartment model neurons. This may be achieved by adapting available approximation methods [32] to our reduced description based on the Fokker-Planck equation.

### Described phenomena

In our modeling study we focused on pyramidal neurons from cortex in a spontaneous state, in which the neural membrane potentials typically fluctuate close to the threshold for most of the time and spikes are emitted at irregular intervals. For a single neuron an oscillatory electric field with an amplitude of 1 V/m caused a small polarization effect that leads to a modulation of the spiking probability. At the level of a local population of similarly oriented neurons these small effects became apparent in the collective activity (population spike rate) which exhibited a modulation of a few spikes/s per neuron on average. This type of stochastic resonance is a hypothesized mechanism, perhaps the principle one, by which transcranial electrical stimulation causes immediate functional effects [3].

We found that spiking activity is most strongly modulated in a rather narrow frequency band. This resonance robustly emerged for a range of plausible input statistics. The resonance frequency varied depending on the inputs; for the biologically relevant regime of strong input fluctuations, however, the resonance peak was constrained to the beta and gamma frequency bands (∼15-45 Hz for single neurons and ∼15-55 Hz for networks). The phenomenon clearly differs from the spike rate resonance for oscillatory input modulations shown in integrate-and-fire point neurons (see, e.g. [46] or Fig 7C in [32]), which only occurs for mean-dominated inputs (hence, fairly regular spiking) and where the resonance frequency rapidly increases as the input increases.

Recent modeling results suggest that this resonance frequency may be largely determined by the location of background input (soma vs. distal dendrite) [25]. Our results confirm that resonance frequencies are higher for mainly dendritic background inputs compared to mainly somatic background inputs (cf. Fig 3A). However, unless the input at one location is completely extinguished (as in [25]) the statistics of background inputs at either location appear to play the dominant role in determining this frequency. It may also be noted at this point that spike rate resonance frequencies are lower for model neurons that include an exponential nonlinearity (at the soma) compared to purely leaky integrate-and-fire neurons [25].

To date, experimental evidence for frequency-dependent modulation of neuronal activity by extracellular fields is very sparse (see [47] for a review). Weak electric fields alternating at 30 Hz have been shown to increase spiking coherence of pyramidal cells in rat hippocampal slices [18], and fields with high-frequency components have been evidenced to entrain spiking activity in ferret primary visual cortex more effectively than fields that only contain low-frequency components [4]. To the best of our knowledge, the effects of multiple field frequencies have not yet been experimentally assessed. Therefore, most of our results on spike rate resonance are currently not confirmed and may be regarded as predictions.

Interestingly, these resonance effects at the suprathreshold level were not shown by the subthreshold membrane voltage, whose amplitude monotonically decreased with increasing field frequency (cf. Figs 1D and 2B). The latter phenomenon is in accordance with electrophysiological observations: the subthreshold response amplitude (which scales linearly with the field amplitude [23]) is of the same order of magnitude as that measured in pyramidal cells and decreases with increasing field frequency [17]. Note that the parameter values of our model were not optimized to reproduce this behavior quantitatively but can be adjusted accordingly in a straightforward way (cf. S1 Fig) [25].

The two-compartment model naturally accounts for input filtering caused by the dendrite (for example, as described in [25]). Notably, the somatic impedance and spike rate response for input modulations at the soma exhibited rather distinct dependencies on input frequency (compare Figs 1C and 2C), which may be attributed to the nonlinearity caused by spiking. The presence of the dendrite lead to increased spike rate responses to weak oscillatory input modulations with high frequency at the soma, also for strongly fluctuating background inputs. This is consistent with previous findings for Purkinje neurons in vitro and using a two-compartment model similar to the one used here [37] despite marked differences in the morphology between Purkinje and pyramidal cells. Specifically, the ratio between dendritic and somatic membrane surface (hence, capacitance) are quite distinct for these two types of neurons, which explains certain differences in the results.

## Methods

Python code for the models and methods presented below is freely available at GitHub: https://github.com/neuromethods/two-compartment-models-and-weak-electric-fields.

### 1. Two-compartment neuron model

The two-compartment neuron model consists of two differential equations for the dynamics of the somatic and the dendritic membrane voltage, *V*_{s} and *V*_{d}, respectively, together with a reset condition of the integrate-and-fire type (for similar models with and without an extracellular field see [35, 37, 38, 48]),
(1)
(2)
(3)
(4)
where *V*_{s}, *V*_{d} are defined by the difference between the deviations , of the intracellular membrane potentials from the leak reversal potential (assumed identical for soma and dendrite) and the extracellular membrane potentials , for the somatic and dendritic compartment, respectively,
(5)

*C*_{s}, *C*_{d} and *G*_{s}, *G*_{d} denote the capacitances and leak conductances of the somatic and dendritic membranes. The exponential term with conductance *G*_{e}, threshold slope factor Δ_{T} and effective threshold voltage *V*_{T} approximates the rapidly increasing Na^{+} current at spike initiation [49]. *G*_{i} is the internal conductance between the somatic and the dendritic compartment, Δ is the spatial distance between their centers, and *E* denotes the extracellular electric field, defined by
(6)

*I*_{s} and *I*_{d} are the synaptic input currents at the soma and dendrite, respectively. When *V*_{s} increases beyond *V*_{T}, it diverges to infinity in finite time due to the exponential term, which defines a spike. In practice, however, the spike is said to occur when *V*_{s} reaches a given threshold value *V*_{th} > *V*_{T}. The downswing of the spike is not explicitly modeled; instead, when *V*_{s} passes *V*_{th} (from below), the somatic membrane voltage is instantaneously reset to a lower value *V*_{r}, cf. (4).

Eqs (1) and (2) are the current balance equations for the center points of the two compartments according to the electrical circuit diagram in Fig 1A. This can be seen by using Kirchhoff’s law, that all incoming currents at a circuit point must sum to zero, and the definitions (5) and (6) which imply . We consider an applied weak sinusoidal field,
(7)
with offset *E*_{0} = 0, amplitude *E*_{1} = 1 V/m and angular frequency *ω*, unless stated otherwise.

The synaptic inputs are fluctuating currents that mimic the compound effect of synaptic bombardment in-vivo, described by
(8)
(9)
with time-varying moments , and *σ*_{s}, *σ*_{d}, and uncorrelated unit Gaussian white noise processes *ξ*_{s}, *ξ*_{d}, i.e., 〈*ξ*_{s}(*t*)*ξ*_{d}(*t* + *τ*)〉 = *δ*(*τ*)*δ*_{sd}, where 〈 ⋅ 〉 denotes expectation (with respect to the ensemble of noise realizations at times *t* and *t* + *τ*) and *δ*_{sd} is the Kronecker delta.

### 2. Calculation of subthreshold responses

We analytically calculate the somatic membrane voltage response for small amplitude variations of the synaptic inputs *I*_{s}(*t*), *I*_{d}(*t*) and a weak oscillatory field *E*(*t*), which do not elicit spikes. Considering that the somatic voltage evolves sufficiently below the effective threshold value *V*_{T} allows us to neglect the exponential term in Eq (1) (i.e., the somatic membrane is purely leaky and capacitive). Using the Fourier transform of Eqs (1) and (2) we then obtain:
(10)
where
(11)
(12)
are the somatic impedances for inputs at the soma and at the dendrite, respectively. indicates a Fourier transformed variable and *ω* denotes angular frequency.

### 3. Calculation of spike rate responses

To assess spiking activity we solved the stochastic differential equations Eqs (1)–(4), (7)–(9) numerically using the Euler-Maruyama integration scheme with time steps between 0.01 ms and 0.05 ms. In addition, we employed analytical calculations as described in the following.

#### Fokker-Planck system.

For improved readability we rewrite Eqs (1)–(3) with extracellular field according to Eq (7) and synaptic input given by Eqs (8) and (9) in compact form:
(13)
(14)
where the coefficients on the right hand side depend on the parameters of the system described in Methods section 1. Note that here *σ*_{sd} = *σ*_{ds} = 0, since the input fluctuations at the soma and dendrite are uncorrelated; however, the methods in this section may also be applied in scenarios where any of these parameters is nonzero and varies over time.

The dynamics of the joint membrane voltage probability density *p*(*V*_{s}, *V*_{d}, *t*) for this system plus reset condition (4) are governed by the Fokker-Planck equation (see, e.g. [32, 44, 50])
(15)
where *q*_{s} and *q*_{d} are the probability fluxes for the somatic and dendritic membrane voltage, respectively, given by
(16)
(17)
with , subject to the boundary conditions:
(18)
(19)
(20)
(21)

The last condition, a re-injection of probability flux, accounts for the voltage reset in the neuron model. We obtain the instantaneous spike rate as (22)

#### Dimension reduction.

Solving the 2+1 dimensional Fokker-Planck partial differential equation (PDE) system (15)–(21) numerically is possible in principle, but computationally demanding. Here we reduce the dimension of this PDE system, which greatly reduces the effort to calculate a) the steady-state spike rate, and b) spike rate responses to weak sinusoidal variations of the input moments or the applied field. For that purpose only ordinary differential equation (ODE) systems need to be solved (see further below). This advantage in terms of implementation and particularly computation becomes crucial for derived mean-field models of multiple neuronal populations (see Methods section 6).

To reduce the dimension of the PDE system we utilize a moment closure approximation method. The (full) probability density *p* can be expressed in terms of the marginal probability density for the somatic voltage, *p*_{s}, and the conditional probability density for the dendritic voltage, *p*_{d}, as *p*(*V*_{s}, *V*_{d}, *t*) = *p*_{s}(*V*_{s}, *t*) *p*_{d}(*V*_{d}|*V*_{s}, *t*). Note that *p*_{d} is characterized by a (potentially) infinite number of conditioned moments {*η*_{d,1}(*V*_{s}, *t*), *η*_{d,2}(*V*_{s}, *t*), …}. The method approximates *p*_{d} by considering only the first *k* moments as described below (see [41] for the application of such a method in a different setting). We transform the PDE system (15)–(21) into a system of 1+1-dimensional PDEs
(23)
together with the associated boundary conditions by multiplying Eqs (15)–(21) with for *l* ∈ {0, 1, 2, …} and integrating over *V*_{d} assuming that *p* and *q*_{d} tend sufficiently fast to zero for *V*_{d} → ±∞, i.e., , . Each linear operator in (23) depends on the next higher conditioned moment *η*_{d,l+1} as indicated, hence the system is (potentially) infinitely large. Note that we have omitted the obvious arguments *V*_{s}, *t* for *p*_{s}, *η*_{d,l} for improved readability, the linear operators are specified further below.

We close the system (23) at *k* = 3 by setting the 3^{rd} central moment of *V*_{d} (as well as higher cumulants) to zero, such that , thereby assuming that *p*_{d} can be sufficiently well approximated by a conditioned Gaussian probability density,
(24)

For a motivation of this assumption see the remark below Eq (38). In the following we specify the system of 3 coupled 1+1-dimensional PDEs we obtain in this way. Using the definitions *p*_{s,1} ≔ *p*_{s}*η*_{d,1} and *p*_{s,2} ≔ *p*_{s}*η*_{d,2} the system is given by:
(25)
(26)
(27)
with
(28)
(29)
(30)
and
(31)
subject to the conditions
(32)
(33)
(34)
(35)
(36)
and requiring that *p*_{s} is initialized such that . The spike rate is then obtained by
(37)

Note that *p*_{s}(*V*_{th}, *t*) = 0 implies *p*_{s,1}(*V*_{th}, *t*) = *p*_{s,2}(*V*_{th}, *t*) = 0. The conditions (33) follow from condition (19) and a self-consistency requirement with respect to the dynamics of the unconditioned moments and . The latter can be seen by integration of Eqs (26) and (27) over *V*_{s} and comparison with the moment equations obtained by successive integration of Eq (15) over *V*_{s}, multiplication by *V*_{d} or , respectively, and integration over *V*_{d}. Conditions (34)–(36) follow from (21). Note also that
(38)

Remark: The assumption that *p*_{d} can be sufficiently well approximated by a conditioned Gaussian is supported by the circumstance that for subthreshold inputs and an electric field which keep the somatic voltage (sufficiently) below the spike threshold the approximation is excellent. In that case *p*_{d}(*V*_{d}|*V*_{s}, *t*) is indeed a conditioned Gaussian probability density (because the exponential term in Eq (1) as well as conditions (18) and (21) are negligible). Since this is not the case for stronger inputs (that cause spiking) the reproduction performance of this approximation needs to be evaluated (cf. Figs 1E, 1G and 2 and Discussion).

#### Steady state.

For the steady state (in case of constant parameters *μ*_{s}, *μ*_{d}, *σ*_{ss}, *σ*_{ds}, *σ*_{sd}, *σ*_{dd}) we obtain, by setting the time derivatives in Eqs (25)–(27) to zero, the 6-dimensional ODE system
(39)
(40)
(41)
(42)
(43)
subject to the conditions (32)–(36) (with time dependence omitted).

We solve this nonlinear ODE system (nonlinearity due to *h*_{s}, cf. Eq (31)) with variable coefficients numerically by integrating Eqs (39)–(43) backwards from *V*_{th} with *p*_{s}(*V*_{th}) = *p*_{s,1}(*V*_{th}) = *p*_{s,2}(*V*_{th}) = 0, *u*_{s}(*V*_{th}) = 1, *u*_{s,1}(*V*_{th}) = *η*_{d,1}(*V*_{th}), *u*_{s,2}(*V*_{th}) = *η*_{d,2}(*V*_{th}) to a sufficiently small (lower bound) voltage value *V*_{lb}, taking into account the “jump” conditions (34)–(36), and determine *η*_{d,1}(*V*_{th}) and *η*_{d,2}(*V*_{th}) such that *u*_{s,1}(*V*_{lb}) = *u*_{s,2}(*V*_{lb}) = 0, cf. condition (33), is fulfilled. Then, the scaling factor *r* (the spike rate) of the obtained solution is determined such that holds. The solution was achieved by means of a Python implementation using a root finding algorithm provided by the package Scipy [51] (optimize.root, modification of the Powell hybrid method [52]) and low-level virtual machine acceleration through the package Numba [53].

#### Response to modulations.

In order to characterize the spike rate dynamics we calculate the response to small-amplitude sinusoidal variations of the mean input around a baseline, , , or to a weak sinusoidal field, cf. Eq (7). These modulations translate to sinusoidal modulations of *μ*_{s}(*t*) and *μ*_{d}(*t*) in the system (25)–(36). The parameters *σ*_{ss}, *σ*_{ds}, *σ*_{sd} and *σ*_{dd} remain constant.

For mathematical convenience we write the modulations in complex form
(44)
with small and (thereby introducing a companion system) and approximate the solution to first order, , where is a complex variable from which the response amplitude *r*_{1} and phase shift *ψ* of the oscillatory spike rate *r*_{0} + *r*_{1}(*ω*)sin(*ωt*+ *ψ*(*ω*)) can be extracted in a straightforward way: , (see, e.g. [46] for a similar type of analysis in a different setting). Note that also the state variables of this solution take the form (analogously for *p*_{s,1}, *p*_{s,2}, *u*_{s}, *u*_{s,1}, *u*_{s,2}). For fixed (angular) frequency *ω* we obtain the following ODE system (neglecting terms of second and higher order in ):
(45)
(46)
(47)
(48)
(49)
with
(50)
subject to the conditions
(51)
(52)
(53)
(54)
(55)
where indicates a complex valued variable that depends on *ω*. Note that this ODE system depends on the (steady state) solution of the system (39)–(43) through , and .

The linear (complex valued) ODE system with variable coefficients (45)–(55) can be conveniently solved in the following way. The desired spike rate response solution can be written as where the solution component corresponds to and, vice versa, corresponds to . We first describe how we obtain ( is calculated in an analogous way, see further below). The solution associated with can be decomposed into (omitting the argument *ω* below for improved readability)
(56)
where **x**_{α}, **x**_{β}, **x**_{γ} solve the homogeneous part (, ) of the ODE system (45)–(50) with for *x* ∈ {*α*, *β*, *γ*}, , , , , , , , , and “jump” conditions (53)–(55). Note that *r*_{0}, and are known from the solution for the steady state system. **x**_{δ} solves the inhomogeneous system (45)–(50) with () and condition **x**_{δ}(*V*_{th}) = 0. These solutions are obtained numerically by backward integration from *V*_{th} to *V*_{lb}. together with are then calculated by solving the linear equation system that arises to satisfy the condition . The solution method for is completely analogous with the difference that appears instead of in Eq (56) and **x**_{δ} solves the inhomogeneous system (45)–(50) with ().

We obtain the amplitude of the spike rate response to an applied field from (57) whereas the response modulations to sinusoidal mean input at the soma and dendrite in the absence of an oscillatory field are given by and , respectively.

### 4. Parametrization via ball-and-stick model

In the following we describe a semi-analytical technique to fit the two-compartment (2C) model to a biophysically more detailed, spatially extended ball-and-stick (BS) model. In particular, the parameter values of the 2C model are determined to best approximate the somatic voltage dynamics of the BS model. This is done in an efficient way using analytical results for the voltage dynamics of both models, and it does not depend on a particular choice of parameter values for the input or the extracellular field. This part may thus be regarded as a reduction of the BS model.

#### Ball-and-stick model.

The BS neuron model consists of a finite passive dendritic cable of length *L* with lumped somatic compartment at the proximal end, *x* = 0, and a sealed end boundary condition at the distal extremity, *x* = *L*. It includes capacitive and leak currents across the membrane, an approximation of the spike-generating sodium current at the soma, an internal current (along the cable) and synaptic input currents at the soma and distal dendrite as well as a spatially homogeneous but time-varying external electric field (for details on the derivation of this model see [25]). The dynamics of the model are governed by
(58)
(59)
(60)
together with a reset condition
(61)
where *c*_{m} = *cD*_{d} *π* is the membrane capacitance, *g*_{m} = *ϱ*_{m} *D*_{d}*π* is the membrane conductance and *g*_{i} = *ϱ*_{i}(*D*_{d}/2)^{2}*π* is the internal (axial) conductance of a dendritic cable segment of unit length. *c* is the specific membrane capacitance (in F/m^{2}), *ϱ*_{i} is the specific internal conductance (in S/m), *ϱ*_{m} is the specific membrane conductance (in S/m^{2}) and *D*_{d} is the cable diameter. and are the somatic membrane capacitance and leak conductance, respectively, with soma diameter *D*_{s}. The exponential term with threshold slope factor Δ_{T} and effective threshold voltage *V*_{T} approximates the rapidly increasing Na^{+} current at spike initiation [49]. Spike times are defined by the times at which the somatic membrane voltage *V*(0, *t*) crosses the threshold voltage value *V*_{th} from below (cf. spike mechanism of the 2C model). *I*_{s}(*t*), *I*_{d}(*t*) and *E*(*t*) are described by Eqs (8), (9) and (7), respectively. The parameter values are provided in Table 1.

To generate spike trains we simulated the BS neuron model using a semi-implicit numerical scheme (Crank-Nicolson method; see, e.g. appendix C of [59]) that was extended for stochasticity as proposed in [60], and by applying the tridiagonal matrix algorithm. Discretization steps were 5 *μ*s for time and *L*/200 for space (along the dendrite).

#### Calculation of subthreshold responses.

We analytically calculate the somatic membrane voltage response of the BS model for small variations of the synaptic inputs *I*_{s}(*t*), *I*_{d}(*t*) and a weak oscillatory field *E*(*t*), which do not elicit spikes. We consider that the somatic voltage evolves sufficiently below *V*_{T}, which allows us to neglect the exponential term in Eq (59) (cf. Methods section 2). The linear PDE (58) together with the boundary conditions (59) and (60) is then solved using separation of variables *V*(*x*, *t*) = *W*(*x*)*U*(*t*) and the Fourier transform
(62)

We obtain the system of differential equations
(63)
(64)
(65)
where indicates a (temporally) Fourier transformed variable. The solution of this system can be expressed as
(66)
with
(67)
(68)
where ±*z*(*ω*) are the roots of the characteristic polynomial *g*_{i}*y*^{2} = *g*_{m} + c_{m}i*ω* of Eq (63),
(69)

Note that and are the somatic impedances for inputs at the soma and the distal dendrite, respectively.

The response to a sinusoidal field variation, *E*(*t*) = *E*_{1} sin(*φt*), with constant *I*_{s} and *I*_{d} can be expressed in the time domain as
(70)

In addition we calculate the somatic voltage time series in response to subthreshold input for a given initial condition *V*(*x*, 0) = *V*_{0}(*x*). Using separation of variables and the Laplace transform
(71)
with complex variable *s* we obtain
(72)
(73)
(74)
where indicates a (temporally) Laplace transformed variable. We solve this system and obtain
(75)
with
(76)
(77)
where ±*z*(*s*) are the roots of the characteristic polynomial *g*_{i}*y*^{2} = *c*_{m}*s* + *g*_{m} of Eq (72), given by
(78)

The somatic voltage time series *V*(0, *t*) is then computed by inverse transforming using an efficient numerical method [61].

#### Parameter fitting.

We approximate the somatic voltage dynamics of the BS model by the 2C model in two steps. First, we fit to using Eqs (10) and (66) over a range of angular frequencies *ω* ∈ [0, *ω*_{max}], requiring that the voltage values for *ω* = 0 (i.e. the steady states) match exactly. This constraint determines three parameters,
(79)
(80)
(81)
where we have introduced the electrotonic length constant . The remaining three subthreshold parameters *C*_{s}, *C*_{d} and *G*_{s} are obtained using the method of least squares, with *ω*_{max}/(2*π*) = 10 kHz. In the second step we determine the reset voltage *V*_{r} by approximating the transient BS somatic voltage time series immediately after a spike elicited by threshold somatic input and threshold dendritic input for *E*(*t*) = 0. Specifically, we fit the post-spike voltage time series *V*_{s}(*t*) to *V*(0, *t*) across the time interval *t* ∈ [0, *τ*_{s}] with initial conditions *V*_{s}(0) = *V*_{r}, *V*_{d}(0) = (*G*_{i}*V*_{th} + *I*_{d})/(*G*_{d} + *G*_{i}) and ,
(82)
for threshold somatic input *I*_{s} = *V*_{th}[*g*_{s} + λ*g*_{m} tanh(*L*/λ)], *I*_{d} = 0 and for threshold dendritic input *I*_{d} = *V*_{th}[*g*_{s} cosh(*L*/λ) + λ*g*_{m} sinh(*L*/λ)], *I*_{s} = 0 simultaneously using the method of least squares. *τ*_{s} = *C*_{s}/(*G*_{s} + *G*_{i}) is the somatic membrane time constant of the 2C model. Note that we consider threshold input as constant current that yields *V* = *V*_{T} (calculated from the linear subthreshold model systems). The voltage time series *V*(0, *t*) of the BS model is rapidly computed using the Laplace transform, Eq (75), and the voltage time series *V*_{s}(*t*) of the 2C model is calculated analytically in a straightforward way (linear ODE system). To guarantee an equal effectiveness of the exponential term on the somatic membrane voltage dynamics in the 2C model compared to the BS model we set *G*_{e} = *C*_{s} *g*_{s}/*c*_{s} (cf. Eqs (1) and (59)). The values for Δ_{T}, *V*_{T} and *V*_{th} are set equal to those of the BS model. Notably, this fitting method is very efficient, since it involves analytical results and does not depend on specific realizations of time series for the neuronal input or extracellular field.

### 5. Spike coincidence measure

To quantify the similarity between the spike trains of the two-compartment and the ball-and-stick model neurons we used the coincidence factor Γ defined by [62]
(83)
where *N*_{c} is the number of coincident spikes with precision (i.e., maximal temporal separation) Δ_{c}, *N*_{BS} and *N*_{2C} are the number of spikes in the spike trains of the ball-and-stick and the two-compartment models, respectively. 〈*N*_{c}〉 = 2*r*Δ_{c}*N*_{BS} is the expected number of coincidences generated by a homogeneous Poisson process with spike rate *r* = *N*_{2C}/*T* as exhibited by the two-compartment model, where *T* is the duration of the spike train. The factor normalizes Γ_{BS,2C} to a maximum value of 1, which is attained if the spike trains match optimally (with precision Δ_{c}). Γ_{BS,2C} = 0 on the other hand would result from a homogeneous Poisson process with rate that corresponds to the spike train of the two-compartment model, and therefore indicates pure chance. Here we used Δ_{c} = 5 ms.

### 6. Two-population network

In this section we describe the network model of a large number *N* of sparsely and randomly coupled pyramidal (PY) neurons and inhibitory (IN) interneurons, and derive a mean-field system from it. Each PY neuron is described by the 2C model, Eqs (1)–(4), (7)–(9), and each IN neuron is described by an exponential integrate-and-fire (point) neuron model,
(84)
(85)
because IN neurons do not exhibit an elongated spatial morphology compared with PY neurons. We used *C*_{IN} = 0.2 nF and *G*_{IN} = 10 nS. The model neurons receive fluctuating external and recurrent synaptic input and are exposed to an applied weak electric field *E*(*t*) that is spatially uniform. For fields induced by transcranial brain stimulation [10] this is a valid assumption. Each PY neuron receives inputs from *K*_{s} IN neurons at the soma and *K*_{d} IN neurons at the dendrite and each IN neuron receives inputs from *K*_{IN} PY neurons. Synaptic coupling is described by delayed current pulses that produce postsynaptic potentials of size *J*_{s}, *J*_{d} or *J*_{IN} (depending on the location of the synapse). Specifically, the input currents for neuron *k*, with somatic and dendritic membrane voltage *V*_{s,k}, *V*_{d,k} (in case of a PY neuron) or overall membrane voltage *V*_{k} (in case of an IN neuron), are given by
(86)
x ∈ {s, d, IN}, where , is the *m*-th spike time of neuron *l* and the coupling delay between neuron *l* and *k*. The delays are independently sampled according to the probability distribution with density
(87) *x* ∈ {s, d, IN}. We consider large numbers of connections *K*_{x} and reasonably small coupling strengths *J*_{x}.

We simulated networks of this type in the presence of a sinusoidal weak field and, alternatively, sinusoidal modulations of the mean inputs at the soma or dendrite of PY neurons. Network simulations were performed using the Python-based Brian2 simulator [63]. In addition, we derived a mean-field description and analytically computed network activity in terms of population-averaged spike rates, as described in the following.

#### Derived mean-field model and resonance analysis.

For large networks (in the mean-field limit *N* → ∞) the overall synaptic input can be approximated by a mean part with additive fluctuations,
(88)
(89)
(90) *x* ∈ {s, d, IN} with delayed spike rates , , , and unit white Gaussian noise process *ζ*_{x,k} that is uncorrelated to that of any other neuron (see, e.g. [32]). This step is valid under the assumptions of (i) sufficient presynaptic activity, (ii) that neuronal spike trains can be approximated by Poisson processes and (iii) that the correlations between the fluctuations of synaptic inputs for different neurons vanish. Note that the latter assumption is supported by sparse and random synaptic connectivity.

The previous approximation allows us to express the collective spiking dynamics in terms of a coupled system of Fokker-Planck PDEs, one for the PY population (cf. Methods section 3) and one for the IN population, where the coupling is mediated through the synaptic input moments and (cf. Eqs (89) and (90)). Specifically, the system for the PY population consists of Eq (15) with
(91)
(92)
subject to the conditions (18)–(21) and *r*_{PY} given by Eq (22). The system for the IN population is specified by
(93)
(94)
subject to the conditions
(95)
(96)
and spike rate given by *r*_{IN} = *q*_{V}(*V*_{th}, *t*).

To analyze the resonance properties of this mean-field network model we proceed similarly as in Methods section 3: we consider either a weak sinusoidal electric field, Eq (7), or weak sinusoidal modulations of the external mean input at the soma or dendrite of PY neurons, , *x* ∈ {s, d}. We assume a parametrization of the network such that without these modulations () it exhibits asynchronous activity represented by a fixed point solution of the mean-field system. We write the modulations in complex form and express the first order population spike rate responses as and . To obtain the stationary (steady state) components and we solve the system (39)–(43) with and , *x* ∈ {s, d} (and with the corresponding boundary conditions) together with the respective system for the IN population with and via fixed point iteration of the form , where *n* denotes the iteration number. Recall that *σ*_{sd} = *σ*_{ds} = 0 in Eqs (13) and (14), as noted above. The response components and are obtained from
(97)
(98)
where , *x* ∈ {s, d, IN} is the Fourier transformed delay density (cf. Eq (87)) and , are the population spike rate response components for sinusoidal modulations of *μ*_{x}, of unit amplitude. Note that Eqs (97) and (98) can be jointly solved in a straightforward way. In addition to first order responses to modulations of *μ*_{s} and *μ*_{d} we therefore need to calculate the responses for weak sinusoidal modulations of and . That is, the rate response solution of the system (25)–(36) for and is required. This is done in an analogous way as explained above for sinusoidal modulations of *μ*_{s} and *μ*_{d} (see Methods section 3). In particular, we solve (45)–(55) with , , , and where the inhomogeneous terms , , and in Eqs (45), (47), (49) and (48) are replaced by , , and , respectively. The resulting system can be numerically solved as explained in Methods section 3, using Eq (56) where is replaced by and , respectively, and **x**_{δ} solves the adjusted inhomogeneous system (with , and , , respectively). For the simpler case of the exponential integrate-and-fire point model for the IN population (steady state and response modulations) we refer to Refs. [32, 46].

## Supporting information

### S1 Fig. Subthreshold response properties of ball-and-stick neurons and fitted two-compartment neurons.

A: amplitude of subthreshold somatic impedances for inputs at the soma and dendrite, respectively, as a function of input frequency (cf. Fig 1C). B: amplitude of subthreshold somatic voltage responses to a sinusoidal electric field with amplitude *E*_{1} = 1 V/m as a function of field frequency (cf. Fig 1D). C: somatic voltage transients after a spike for constant threshold inputs at the soma and dendrite, respectively (cf. Fig 1E). The six columns correspond to different parametrizations (morphologies) of the ball-and-stick model, from left to right: *L* = 4 ⋅ 10^{−4} m, *L* = 10 ⋅ 10^{−4} m (default *L* = 7 ⋅ 10^{−4} m), *D*_{d} = 0.5 ⋅ 10^{−6} m, *D*_{d} = 1.5 ⋅ 10^{−6} m (default *D*_{d} = 1 ⋅ 10^{−6} m), *D*_{s} = 10 ⋅ 10^{−6} m, *D*_{s} = 20 ⋅ 10^{−6} m (default *D*_{s} = 15 ⋅ 10^{−6} m). For all other parameter values see Table 1. All curves were analytically computed.

https://doi.org/10.1371/journal.pcbi.1006974.s001

(TIFF)

### S2 Fig. Spike rate responses of two-compartment neurons.

A: spike rate as a function of somatic (green) and dendritic (blue) mean input, respectively, for and (cf. Fig 1H). B: amplitude of spike rate responses to sinusoidal modulations of the mean input at the soma (green) or at the dendrite (blue) as a function of modulation frequency, for baseline input statistics , and (cf. Fig 2C and 2D). Modulation amplitudes were . Columns correspond to different parametrizations of the two-compartment model, obtained by fitting ball-and-stick neurons with different morphology (see S1 Fig). The values of critical parameters are indicated; somatic and dendritic time constants are defined by *τ*_{s} ≔ *C*_{s}/(*G*_{s} + *G*_{i}), *τ*_{d} ≔ *C*_{d}/(*G*_{d} + *G*_{i}). For comparison, the default (fitted) values were *C*_{s} = 9.9 pF, *C*_{d} = 28.9 pF, *G*_{i} = 1.2 nS, *τ*_{d}/*τ*_{s} = 2.04. Dots denote results from numerical simulations, solid or dashed curves from analytical calculations. Remark: spike rate responses to a weak sinusoidal field may be directly calculated from the responses to mean input modulations at the soma and dendrite, respectively, using both response amplitudes and phases (see Eq (57)).

https://doi.org/10.1371/journal.pcbi.1006974.s002

(TIFF)

## Acknowledgments

We thank Srdjan Ostojic for an inspiring discussion on modeling aspects, and we thank Joshua Goldwyn and the two anonymous reviewers for their constructive comments and useful suggestions.

## References

- 1. Anastassiou CA, Koch C. Ephaptic coupling to endogenous electric field activity: Why bother? Curr Opin Neurobiol. 2015; 31:95–103. pmid:25265066
- 2. Polanía R, Nitsche MA, Ruff CC. Studying and modifying brain function with non-invasive brain stimulation. Nat Neurosci. 2018; 21:174–187. pmid:29311747
- 3. Liu A, Vöröslakos M, Kronberg G, Henin S, Krause MR, Huang Y, et al. Immediate neurophysiological effects of transcranial electrical stimulation. Nat Commun. 2018; 9:5092. pmid:30504921
- 4. Fröhlich F, McCormick DA. Endogenous electric fields may guide neocortical network activity. Neuron. 2010; 67:129–143. pmid:20624597
- 5. Buzsáki G, Anastassiou CA, Koch C. The origin of extracellular fields and currents—EEG, ECoG, LFP and spikes. Nat Rev Neurosci. 2012; 13:407–420. pmid:22595786
- 6. Einevoll GT, Kayser C, Logothetis NK, Panzeri S. Modelling and analysis of local field potentials for studying the function of cortical circuits. Nat Rev Neurosci. 2013; 14:770–785. pmid:24135696
- 7. Han KS, Guo C, Chen CH, Witter L, Osorno T, Regehr WG. Ephaptic Coupling Promotes Synchronous Firing of Cerebellar Purkinje Cells. Neuron. 2018; p. 1–15.
- 8. Neuling T, Wagner S, Wolters CH, Zaehle T, Herrmann CS. Finite-Element Model Predicts Current Density Distribution for Clinical Applications of tDCS and tACS. Front Psychiatry. 2012; 3:1–10.
- 9. Datta A, Bansal V, Diaz J, Patel J, Reato D, Bikson M. Gyri –precise head model of transcranial DC stimulation: Improved spatial focality using a ring electrode versus conventional rectangular pad. Brain Stimul. 2009; 2:201–207. pmid:20648973
- 10.
Bikson M, Reato D, Rahman A. Cellular and Network Effects of Transcranial Direct Current Stimulation. In: Miniussi C, Paulus W, Rossini PM, editors. Transcranial Brain Stimulation. CRC Press; 2012. p. 55–92.
- 11. Ozen S, Sirota A, Belluscio MA, Anastassiou CA, Stark E, Koch C, et al. Transcranial electric stimulation entrains cortical neuronal populations in rats. J Neurosci. 2010; 30:11476–85. pmid:20739569
- 12. Reato D, Rahman A, Bikson M, Parra LC. Low-Intensity Electrical Stimulation Affects Network Dynamics by Modulating Population Rate and Spike Timing. J Neurosci. 2010; 30:15067–15079. pmid:21068312
- 13. Anastassiou CA, Perin R, Markram H, Koch C. Ephaptic coupling of cortical neurons. Nat Neurosci. 2011; 14:217–223. pmid:21240273
- 14. Ali MM, Sellers KK, Fröhlich F. Transcranial alternating current stimulation modulates large-scale cortical network activity by network resonance. J Neurosci. 2013; 33:11262–75. pmid:23825429
- 15. Helfrich RF, Schneider TR, Rach S, Trautmann-Lengsfeld SA, Engel AK, Herrmann CS. Entrainment of brain oscillations by transcranial alternating current stimulation. Curr Biol. 2014; 24:333–339. pmid:24461998
- 16. Huang Y, Liu AA, Lafon B, Friedman D, Dayan M, Wang X, et al. Measurements and models of electric fields in the in vivo human brain during transcranial electric stimulation. eLife. 2017; 6:e18834. pmid:28169833
- 17. Deans JK, Powell AD, Jefferys JGR. Sensitivity of coherent oscillations in rat hippocampus to AC electric fields. J Physiol. 2007; 583:555–565. pmid:17599962
- 18. Radman T, Su Y, An JH, Parra LC, Bikson M. Spike timing amplifies the effect of electric fields on neurons: implications for endogenous field effects. J Neurosci. 2007; 27:3030–6. pmid:17360926
- 19. Marshall L, Helgadóttir H, Mölle M, Born J. Boosting slow oscillations during sleep potentiates memory. Nature. 2006; 444:610–613. pmid:17086200
- 20. Herrmann CS, Rach S, Neuling T, Strüber D. Transcranial alternating current stimulation: a review of the underlying mechanisms and modulation of cognitive processes. Front Hum Neurosci. 2013; 7:1–13.
- 21. Berenyi A, Belluscio M, Mao D, Buzsaki G. Closed-Loop Control of Epilepsy by Transcranial Electrical Stimulation. Science. 2012; 337:735–737. pmid:22879515
- 22. Ladenbauer J, Ladenbauer J, Külzow N, de Boor R, Avramova E, Grittner U, et al. Promoting sleep oscillations and their functional coupling by transcranial stimulation enhances memory consolidation in mild cognitive impairment. J Neurosci. 2017; 37:7111–7124. pmid:28637840
- 23. Bikson M, Inoue M, Akiyama H, Deans JK, Fox JE, Miyakawa H, et al. Effects of uniform extracellular DC electric fields on excitability in rat hippocampal slices in vitro. J Physiol. 2004; 557:175–90. pmid:14978199
- 24. Radman T, Ramos RL, Brumberg JC, Bikson M. Role of cortical cell type and morphology in subthreshold and suprathreshold uniform electric field stimulation in vitro. Brain Stimul. 2009; 2:215–28. pmid:20161507
- 25. Aspart F, Ladenbauer J, Obermayer K. Extending integrate-and-fire model neurons to account for input filtering and the effects of weak electric fields mediated by the dendrite. PLOS Comput Biol. 2016; 12:e1005206. pmid:27893786
- 26. Aspart F, Remme MWH, Obermayer K. Differential polarization of cortical pyramidal neuron dendrites through weak extracellular fields. PLOS Comput Biol. 2018; 14:e1006124. pmid:29727454
- 27. Anastassiou CA, Montgomery SM, Barahona M, Buzsáki G, Koch C. The effect of spatially inhomogeneous extracellular electric fields on neurons. J Neurosci. 2010; 30:1925–36. pmid:20130201
- 28. Tiganj Z, Chevallier S, Monacelli E. Influence of extracellular oscillations on neural communication: a computational perspective. Front Comput Neurosci. 2014; 8:1–13.
- 29. Yi GS, Wang J, Deng B, Wei XL. Morphology controls how hippocampal CA1 pyramidal neuron responds to uniform electric fields: A biophysical modeling study. Sci Rep. 2017; 7:1–13.
- 30. Brunel N. Dynamics of sparsely connected networks of excitatory and inhibitory spiking neurons. J Comput Neurosci. 2000; 8:183–208. pmid:10809012
- 31. Litwin-Kumar A, Doiron B. Slow dynamics and high variability in balanced cortical networks with clustered connections. Nat Neurosci. 2012; 15:1498–1505. pmid:23001062
- 32. Augustin M, Ladenbauer J, Baumann F, Obermayer K. Low-dimensional spike rate models derived from networks of adaptive integrate-and-fire neurons: comparison and implementation. PLOS Comput Biol. 2017; 13:e1005545. pmid:28644841
- 33. Reato D, Gasca F, Datta A, Bikson M, Marshall L, Parra LC. Transcranial electrical stimulation accelerates human sleep homeostasis. PLOS Comput Biol. 2013; 9:e1002898. pmid:23459152
- 34. Park EH, Barreto E, Gluckman BJ, Schiff SJ, So P. A model of the effects of applied electric fields on neuronal synchronization. J Comput Neurosci. 2005; 19:53–70. pmid:16133825
- 35. Yi GS, Wang J, Wei XL, Tsang KM, Chan WL, Deng B, et al. Exploring how extracellular electric field modulates neuron activity through dynamical analysis of a two-compartment neuron model. J Comput Neurosci. 2014; 36:383–399. pmid:24057225
- 36. Lafon B, Rahman A, Bikson M, Parra LC. Direct Current Stimulation Alters Neuronal Input/Output Function. Brain Stimul. 2017; 10:36–45. pmid:27717601
- 37. Ostojic S, Szapiro G, Schwartz E, Barbour B, Brunel N, Hakim V. Neuronal Morphology Generates High-Frequency Firing Resonance. J Neurosci. 2015; 35:7056–7068. pmid:25948257
- 38. Doose J, Doron G, Brecht M, Lindner B. Noisy Juxtacellular Stimulation In Vivo Leads to Reliable Spiking and Reveals High-Frequency Coding in Single Neurons. J Neurosci. 2016; 36:11120–11132. pmid:27798191
- 39. Doiron B, Zhao Y, Tzounopoulos T. Combined LTP and LTD of Modulatory Inputs Controls Neuronal Processing of Primary Sensory Inputs. J Neurosci. 2011; 31:10579–10592. pmid:21775602
- 40. Brunel N, Wang XJ. What determines the frequency of fast network oscillations with irregular neural discharges? I. Synaptic dynamics and excitation-inhibition balance. J Neurophysiol. 2003; 90:415–430. pmid:12611969
- 41. Ly C, Tranchina D. Critical analysis of dimension reduction by a moment closure method in a population density approach to neural network modeling. Neural Comput. 2007; 19:2032–2092. pmid:17571938
- 42. Ly C. A Principled Dimension-Reduction Method for the Population Density Approach to Modeling Networks of Neurons with Synaptic Dynamics. Neural Comput. 2013; 25:2682–2708. pmid:23777517
- 43. Brunel N, Hakim V, Richardson M. Firing-rate resonance in a generalized integrate-and-fire neuron with subthreshold resonance. Phys Rev E. 2003; 67:051916.
- 44. Gigante G, Del Giudice P, Mattia M. Frequency-dependent response properties of adapting spiking neurons. Math Biosci. 2007; 207:336–351. pmid:17367823
- 45. Ladenbauer J, Augustin M, Obermayer K. How adaptation currents change threshold, gain and variability of neuronal spiking. J Neurophysiol. 2014; 111:939–953. pmid:24174646
- 46. Richardson MJE. Firing-rate response of linear and nonlinear integrate-and-fire neurons to modulated current-based and conductance-based synaptic drive. Phys Rev E. 2007; 76:021919.
- 47. Reato D, Rahman A, Bikson M, Parra LC. Effects of weak transcranial alternating current stimulation on brain activity-a review of known mechanisms from animal studies. Front Hum Neurosci. 2013; 7:1–8.
- 48. Doose J, Lindner B. Evoking prescribed spike times in stochastic neurons. Phys Rev E. 2017; 96:032109. pmid:29346970
- 49. Fourcaud-Trocmé N, Hansel D, van Vreeswijk C, Brunel N. How spike generation mechanisms determine the neuronal response to fluctuating inputs. J Neurosci. 2003; 23:11628–11640. pmid:14684865
- 50. Augustin M, Ladenbauer J, Obermayer K. How adaptation shapes spike rate oscillations in recurrent neuronal networks. Front Comput Neurosci. 2013; 7:1–11.
- 51. Oliphant TE. Python for Scientific Computing. Comput Sci Eng. 2007; 9:10–20.
- 52.
Powell MJD. A Hybrid Method for Nonlinear Equations. In: Rabinowitz P, editor. Numerical Methods for Nonlinear Algebraic Equations. Gordon and Breach; 1970. p. 87–114.
- 53.
Lam SK, Pitrou A, Seibert S. Numba: A LLVM-based python JIT compiler. In: Proc. LLVM Compil. Infrastruct. HPC; 2015. p. 1–6.
- 54. Mainen ZF, Sejnowski TJ. Influence of dendritic structure on firing pattern in model neocortical neurons. Nature. 1996; 382:363–366. pmid:8684467
- 55.
Squire L, Berg D, Bloom FE, Du Lac S, Ghosh A, Spitzer NC. Fundamental Neuroscience. Waltham, MA: Academic Press; 2012.
- 56. Rattay F. The basic mechanism for the electrical stimulation of the nervous system. Neuroscience. 1999; 89:335–346. pmid:10077317
- 57. Spruston N. Pyramidal neurons: Dendritic structure and synaptic integration. Nat Rev Neurosci. 2008; 9:206–221. pmid:18270515
- 58. Badel L, Lefort S, Brette R, Petersen CCH, Gerstner W, Richardson MJE. Dynamic I-V curves are reliable predictors of naturalistic pyramidal-neuron voltage traces. J Neurophysiol. 2008; 99:656–666. pmid:18057107
- 59.
Koch C. Biophysics of Computation: Information Processing in Single Neurons. Oxford University Press; 1999.
- 60. Yang X, Wang W, Duan Y. The approximation of a Crank–Nicolson scheme for the stochastic Navier–Stokes equations. J Comput Appl Math. 2009; 225:31–43.
- 61. Valsa J, Brančik L. Approximate formulae for numerical inversion of Laplace transforms. Int J Numer Model Electron Network Dev Field. 1998; 11:153–166.
- 62.
Gerstner W, Kistler WM. Spiking Neuron Models: Single Neurons, Populations, Plasticity. Cambridge, UK: Cambridge University Press; 2002.
- 63. Stimberg M, Goodman DFM, Benichoux V, Brette R. Equation-oriented specification of neural models for simulations. Front Neuroinform. 2014; 8:1–14.