An electrodiffusive, ion conserving Pinsky-Rinzel model with homeostatic mechanisms
The neuronal action potential (AP) is generated by a transmembrane influx of Na + , which depolarizes the neuron, followed by an efflux of K + , which repolarizes it. Likewise, all neurodynamics is fundamentally about the movement of ions, which are the charge carriers in the brain. Therefore, it might seem peculiar that most models of neuronal activity are based on the approximation that the concentrations of the main charge carriers (Na + , K + , and Cl − ) do not change over time. This approximation is, for example, incorporated in the celebrated Hodgkin-Huxley model , and a large number of later models based on a Hodgkin-Huxley type formalism (see, e.g., ). Setting the ion concentrations to not change over time is often a fairly good approximation. The reason is that the number of ions that need to cross the membrane to charge up the neuron by, say, an AP worth of millivolts, is too small to have any notable impact on ion concentrations on either side of the membrane (see, e.g., Box 2.2 in ), meaning that concentration changes on a short time scale can be neglected. On a longer time-scale, the ionic exchange due to APs (or other neuronal events), is normally reversed by a set of homeostatic mechanisms such as ion pumps and cotransporters, which work to maintain constant baseline concentrations. In Hodgkin-Huxley type models, the large number of ion pumps, cotransporters and passive ionic leakages that strive towards maintaining baseline conditions are therefore not explicitly modeled. Instead, they are simply assumed to do their job and are grouped into a single passive and non-specific leakage current I leak = g leak ( ϕ m − E leak ), which determines the cell’s resting potential (for a critical study of this approximation, see ). Another approximation commonly applied by modelers of neurons is that the extracellular potential is constant and grounded ( ϕ e = 0) so that the only voltage variable that one needs to worry about when simulating neurodynamics is the transmembrane potential ( ϕ m ). This assumption is implicit in the majority of morphologically explicit models of neurons, where the (spatial) signal propagation in dendrites and axons are computed using the cable equation (see, e.g., ). Cable-equation based, multicompartmental neuronal models are widely used within the field of neuroscience, both for understanding dendritic integration and neuronal response properties at the single neuron level (see, e.g., ) and for exploring the dynamics of large neuronal networks (see e.g., ). They are even used in the context of performing forward modeling of extracellular potentials, such as local field potentials (LFP), the electrocorticogram (ECoG), and electroencephalogram (EEG) (see, e.g., ), despite the evident inconsistency involved when first computing neurodynamics under the approximation that ϕ e = 0 , and then in the next step using this dynamics to predict a nonzero ϕ e . The approximation is nevertheless useful since ϕ e is typically so much smaller than ϕ m that the (ephaptic) effect of ϕ e on neurodynamics can be neglected without severe loss in accuracy . There are, however, scenarios where the assumptions of constant ion concentrations and a grounded extracellular space are not justifiable. Notably, large-scale extracellular ion concentration changes are a trademark of several pathological conditions, including epilepsy and spreading depression . In these cases, neurons are unable to maintain their baseline conditions because they for various reasons are too active and/or their homeostatic mechanisms are too slow. During spreading depression, the extracellular K + concentration can change from a baseline value of about 3-5 mM to pathological levels of several tens of mM, and the increased K + concentration tends to coincide with a slow, direct-current (DC) like drop in the extracellular potential, which may be several tens of millivolts in amplitude , and can give rise to large spatial gradients. For example, one experiment saw the extracellular K + -concentration and ϕ e vary by as much as 30 mM and 20 mV, respectively, over the hippocampal depth . Such dramatic gradients in the extracellular environment are likely to have a strong impact on the dynamical properties of neurons, both through the concentration-dependent changes in ion-channel reversal potentials  and putatively through a direct ephaptic effect from ϕ e on the membrane potential. The construction of accurate neuron models that include ion concentration dynamics (and conservation) poses two key challenges. Firstly, ion conserving models need a finely adjusted balance between the homeostatic machinery and all passive and active ion-specific currents so that all ion concentrations, as well as voltages, vary in a biophysically realistic way over time when the neuron is active. Secondly, in spatially extended models, ions will not move only across membranes, but also within the extracellular and intracellular space. Such ionic movement may be propelled both by diffusion and electrical drift. Ionic diffusion can, in principle, affect the electrical potential (since ions carry charge), and the electrical potential can, in principle, affect ion concentration dynamics (since ions drift along potential gradients) . Accurate modeling of such systems thus requires a unified, electrodiffusive framework that ensures a physically consistent relationship between ion concentrations, charge density, and electrical potentials. Intra- or extracellular electrodiffusion is not an issue in single-compartment models, of which there are quite a few that incorporate ion concentration dynamics in a more or less consistent way . Single compartment models are useful in many aspects. However, in order to represent morphological features of neurons, such as e.g., differential expression of ion channels in the soma versus dendrites, or account for transport processes in the space inside or outside neurons, one needs models with more than a single compartment. Among the several morphologically explicit models that have included homeostatic machinery and explicitly simulated ion concentration dynamics (see e.g., ), neither have accounted for the electrodiffusive coupling between the movement of ions and electrical potentials (see section titled Loss in accuracy when neglecting electrodiffusive effects on concentration dynamics). Hence, to our knowledge, no morphologically explicit neuron model has so far been developed that ensures biophysically consistent dynamics in ion concentrations and electrical potentials during long-time activity, although useful mathematical framework for constructing such models are available . The goal of this work is to propose what we may refer to as “a minimal neuronal model that has it all”. By “has it all”, we mean that it (1) has a spatial extension, (2) considers both extracellular- and intracellular dynamics, (3) keeps track of all ion concentrations (Na + , K + , Ca 2+ , and Cl − ) in all compartments, (4) keeps track of all electrical potentials ( ϕ m , ϕ e , and ϕ i —the latter being the intracellular potential) in all compartments, (5) has differential expression of ion channels in soma versus dendrites, and can fire somatic APs and dendritic calcium spikes, (6) contains the homeostatic machinery that ensures that it maintains a realistic dynamics in ϕ m and all ion concentrations during long-time activity, and (7) accounts for transmembrane, intracellular and extracellular ionic movements due to both diffusion and electrical migration, and thus ensures a consistent relationship between ion concentrations and electrical charge. Being based on a unified framework for intra- and extracellular dynamics , the model thus accounts for possible ephaptic effects from extracellular dynamics, as neglected in standard feedforward models based on volume conductor theory . By “minimal” we simply mean that we reduce the number of spatial compartments to the minimal, which in this case is four, i.e., two neuronal compartments (a soma and a dendrite), plus two extracellular compartments (outside soma and outside dendrite). Technically, the model was constructed by adding homeostatic mechanisms and ion concentration dynamics to an existing model, i.e., the two-compartment Pinsky-Rinzel (PR) model , and embedding in it a consistent electrodiffusive framework, i.e., the previously developed Kirchhoff-Nernst-Planck framework . For the remainder of this paper, we refer to our model as the electrodiffusive Pinsky-Rinzel (edPR) model. The remainder of this article is organized as follows. First, we present the edPR model and illustrate the numerous variables that it can simulate. Next, we show that the edPR model can reproduce the firing properties of the original PR model. By running long-time simulations (several minutes of biological time) on both models, we identify the firing conditions under which the two models maintained a similar firing pattern, and under which conditions concentration effects became important so that dynamics of the edPR model diverged from the original PR model over time. Finally, we use the edPR model to explore the validity of some important assumptions commonly made in the field of computational neuroscience, regarding the decoupling of electrical and diffusive signals. We believe that the edPR model will be of great value for the field of neuroscience, partly because it gives a deepened insight into the balance between neuronal firing and ion homeostasis, partly because it lends itself to explore under which conditions the common modeling assumption of constant ion concentrations is warranted, and most importantly because it opens for more detailed mechanistic studies of pathological conditions associated with large changes in ion concentrations, such as epilepsy and spreading depression . 

An electrodiffusive Pinsky-Rinzel model The here proposed electrodiffusive Pinsky-Rinzel (edPR) model is inspired by the original Pinsky-Rinzel (PR) model , which is a two-compartment (soma + dendrite) version of a CA3 hippocampal cell model, initially developed by Traub et al. . In the original PR model, the somatic compartment contains Na + , and K + delayed rectifier currents ( I Na and I K−DR ), while the dendritic compartment contains a voltage-dependent Ca 2+ current ( I Ca ), a voltage-dependent K + afterhyperpolarization current ( I K−AHP ), and a Ca 2+ -dependent K + current ( I K−C ). In addition, both compartments contain passive leakage currents. Despite its small number of compartments and conductances, the PR model can reproduce a variety of realistic firing patterns when responding to somatic or dendritic stimuli, including somatic APs and dendritic calcium spikes. In the edPR model, we have adopted all mechanisms from the original PR model. In addition, we have (i) made all ion channels and passive leakage currents ion-specific, (ii) included 3Na + /2K + pumps ( I pump ), K + /Cl − cotransporters ( I KCC2 ), Na + /K + /2Cl − cotransporters ( I NKCC1 ), and Ca 2+ /2Na + exchangers ( I Ca−dec ), and (iii) included two extracellular compartments (outside soma + outside dendrite). To compute the dynamics of the edPR, we used an electrodiffusive KNP-framework for consistently computing the voltage- and ion concentration dynamics in the intra- and extracellular compartments . The model is summarized in and described in details in the Methods section. Key dynamical variables in the electrodiffusive Pinsky-Rinzel model While the key variable in the original PR model is the membrane potential ϕ m , the edPR model allows us to compute a multitude of variables relevant to neurodynamics. The functionality of the edPR model is illustrated in , which shows a 60 s simulation where the model fires at 1 Hz for 10 s. We have plotted a selection of output variables, including the membrane potentials , extracellular potentials , the dynamics of all ion concentrations in all compartments , concentration effects on ionic reversal potentials , concentration effects on the electrical conductivity of the intra- and extracellular medium , and ATP consumption  of the 3Na + /2K + pumps and Ca 2+ /2Na + exchangers. Unlike neuronal models based on cable theory, where ϕ e is assumed to be zero so that ϕ m = ϕ i , the edPR model computes ϕ m , ϕ i , and ϕ e from a consistent framework where ephaptic effects from ϕ e on ϕ m are accounted for . Due to the electrical coupling between the soma and dendrite, the fluctuations in ϕ m were similar in these compartments, and a more detailed analysis of the AP shapes is found further below. While an action potential essentially gave a depolarization followed by a repolarization of ϕ m , its extracellular signature was essentially a voltage drop (to about -5 mV) followed by a voltage increase (to about +5 mV). This biphasic response of the extracellular AP signature has been seen in several studies (for an analysis, see ). In experimental recordings, amplitudes in ϕ e fluctuations are typically on the order of 100 μ V, which is much smaller than that predicted by the edPR model. The discrepancy is an artifact that is mainly due to the 1D approximation in the edPR model (see ). The dendritic extracellular potential  was by definition zero at all times, as this compartment was used as the reference point for the potential. The effect of neuronal firing on the ion concentration dynamics is illustrated in . Before the stimulus onset, the cell was resting at approximately -68 mV, and ion concentrations remained at baseline values. During AP firing, the ion concentrations varied in a jigsaw-like fashion in all compartments, except for Ca 2+ , which returned to baseline between each AP and showed notable variation only inside/outside the dendrite since the soma contained no Ca 2+ channels. As the extracellular volume was set to be half as big as the intracellular volume, changes in extracellular ion concentrations were about twice as big as the changes in intracellular ion concentrations. The jigsaw pattern was most pronounced for the K + and Na + concentrations, as these were the main mediators of the APs . The pattern reflects a cycle of (i) incremental steps away from baseline concentrations, which were mediated by the complex of mechanisms active during the APs, followed by (ii) slower decays back towards baseline, which were mediated by pumps and cotransporters working between the APs. In this simulation, the decay was incomplete, so that concentrations reached gradually larger peak values by each consecutive AP. However, as we show later (see Section titled The edPR model predicts homeostatic failure due to high firing rate), the concentrations did, in this case, approach a firing-frequency dependent steady state. When the firing ceased in , the pumps and cotransporters could work uninterruptedly to re-establish the baseline ion concentrations. The resting membrane potential of about -68 mV, was recovered quite rapidly (ms timescale). After this, the slower recovery process of the ion concentration was due to an electroneutral exchange of ions between the neuron and the extracellular space. A full recovery of the baseline concentrations took on the order of 80 s (confirmed by running a longer simulation than the one shown in ). As ion concentrations varied during the simulation, so did the ionic reversal potentials, E k . The by far largest change was seen for the Ca 2+ reversal potential in the dendrite ( E k,d ), which dropped by as much as -30 mV during an AP, (i.e., from a baseline value of 124 mV to 94 mV). The explanation is that the basal intracellular Ca 2+ -concentration is extremely low (100 nM) compared to the concentrations of other ion species (several mM), and therefore experienced a much larger relative change during the simulation. Among the main charge carriers (Na + , Cl − , K + ), the lowest concentration is found for K + in the extracellular space ( in Methods). For that reason, the second largest change in reversal potential was found for E K , which increased by about 5 mV (i.e., from a basal value of -84 mV to -79 mV) in both the soma and dendrite. The changes in E Ca and E K had a relatively minor impact on the firing pattern in the shown simulations, as the relative change in the driving force ϕ m − E k was not that severe. The conductivities ( σ ) of the intra- and extracellular bulk solutions depend on the availability of free charge carriers, and are in the edPR model functions of the ion concentrations and their mobility (cf. ). The changes in σ were minimal during the conditions simulated here , i.e., σ varied by a few μ S/m over the course of the simulation, while the basal levels were approximately 0.11 S/m and 0.59 S/m for the intra- and extracellular solutions, respectively. Finally, the 3Na + /2K + pump and Ca 2+ /2Na + exchanger use energy in the form of ATP to move ions against their gradients. The 3Na + /2K + pump exchanges 3 Na + ions for 2 K + ions, and consumes one ATP per cycle , while we assumed that the Ca 2+ /2Na + exchanger consumed 1 ATP per cycle (i.e., per Ca 2+ exchanged, as in ). As the edPR model explicitly models these processes, we could compute the ATP (energy) consumption of the pumps during the simulation. shows the accumulative number of ATP consumed from the onset of the simulation. The 3Na + /2K + pump was constantly active, as it combated leakage currents and worked to maintain the baseline concentration even before stimulus onset. Before stimulus onset, it consumed ATP at a constant rate (linear curve), which increased only slightly at t = 10 s when the neuron started to fire (small dent in the curve). As the neuron did not contain any passive leakage of Ca 2+ , the Ca 2+ /2Na + exchangers were only active while the neuron was firing. During firing, the Ca 2+ /2Na + exchanger combated the Ca 2+ entering through the dendritic Ca 2+ channels, and then consumed approximately the same amount of energy as the 3Na + /2K + pump (parallel curves). A high metabolic cost of dendritic Ca 2+ spikes has previously been reported also in cortical layer 5 pyramidal neurons . We note that the edPR model had a stable resting state before stimulus onset and that it returned to this resting state after the stimulus had been turned off. In this resting state, ion concentrations remained constant, and ϕ m was approximately -68 mV. This resting equilibrium was due to a balance between the ion-specific leakage channels, pumps, and cotransporters, which we adopted from previous studies (see ). However, the existence of a homeostatic equilibrium was not highly sensitive to the choice of model parameters. As we confirmed through a sensitivity analysis, varying membrane parameters (one by one) with ±15% of their default values did not abolish the existence of a stable resting state, but shifted the resting potential by maximally ±3 mV  and the resting concentrations by maximally 5% . The edPR model reproduces the short term firing properties of the original PR model A motivation behind basing the electrodiffusive (edPR) model on a previously developed (PR) model, was that we wanted to use the firing properties of the original PR model as a “ground truth” when constraining the edPR model. In particular, we wanted the edPR model to qualitatively reproduce the interplay between somatic action potentials and dendritic Ca 2+ spikes, as this was an essential feature of the original PR model . In the PR model, this interplay depended strongly on the coupling strength (coupling conductance) between the soma and dendrite compartment. A weak coupling resulted in a wobbly ping-pong effect, where a somatic AP triggered a dendritic Ca 2+ spike, which in turn fed back to the soma, giving rise to secondary oscillations in ϕ m . With a strong (about five times stronger) coupling, the somatic and dendritic responses became more similar in shape, as expected . Since the edPR model contained membrane mechanisms and ephaptic effects not present in the PR model, selected parameters in the edPR model had to be re-tuned in order to obtain similar firing as the PR model (see ). With the selected parameterization of the edPR model (see the Parameterizations section), we were able to reproduce the characteristic features seen in the PR model for a weak  and strong (about five times stronger) coupling between the soma and dendrite . The edPR model predicts homeostatic failure due to high firing rate As previously discussed, the PR model was, as most existing neuronal models, constructed under the assumption that ion concentration effects are negligible, an assumption that is justified for short term neurodynamics, and for long term dynamics provided that the activity level is sufficiently low for the homeostatic mechanisms to maintain concentrations close to baseline over time. Hence, we expect there to be a scenario (S1) with a moderately low firing rate, where the PR and edPR models can fire continuously and regularly over a long time exhibiting similar firing properties, and another scenario (S2) with a higher firing rate, where the PR and edPR models exhibit similar firing properties initially in the simulation, but where the dynamics of the two models diverge over time due to homeostatic failure accounted for by the edPR model, but not the PR model (which ad hoc assume perfect homeostasis). Simulations of two such scenarios are shown in Figs and . To simulate scenario S1, the PR model  and edPR model  were given a constant input (see figure caption) that gave them a firing rate of 1 Hz. Both models settled at a regular firing rate, and in neither of them the firing pattern changed over time, even in simulations of as much as an hour of biological time. For the edPR model, the S1 scenario is the same as that simulated for only a brief period in . There, we observed that the ion concentrations gradually changed during the first seconds after the onset of stimulus . However, for endured firing, the ion concentrations and reversal potentials settled on a (new) dynamic steady state , where they deviated by ∼1-5 mM from the baseline concentrations during rest (i.e., for edPR receiving no input). The apparent “thickness” of the curves (e.g., the red curve for K + in ) is due to concentration fluctuations at the short time scale of AP firing. However, after each AP, the homeostatic mechanisms managed to re-establish ionic gradients before the next AP occurred, so that no slow concentration-dependent effect developed in the edPR model at a long time scale. To simulate scenario S2, the PR model  and edPR model  were given a constant input (see figure caption) that gave them a firing rate of about 3 Hz. The PR model, which included no concentration-dependent effects, settled on a regular firing rate that it could maintain for an arbitrarily long time. Unlike the PR model, the edPR model did not settle at a steady state, but had a firing rate of ∼ 3 Hz only for a period of ∼ 5 s after stimulus onset. During this period, the ion concentrations gradually diverged from the baseline levels . The corresponding changes in ionic reversal potentials  affected the neuron’s firing properties and caused its firing rate to gradually increase before it eventually entered the depolarization block and got stuck at about ϕ m = −30mV. The main explanation behind the altered firing pattern was the change in the K + reversal potential, which, for example, at 9 s after stimulus onset ( t = 19 s) had increased by as much as 20 mV from baseline. This shift led to a depolarization of the neuron, which explains both the (gradually) increased firing rate and the (final) depolarization block, i.e., the condition where ϕ m could no longer repolarize to levels below the firing threshold, and AP firing was abolished due to a permanent inactivation of active Na + channels. Neuronal depolarization block is a well-studied phenomenon, which is often caused by high extracellular K + concentrations . The homeostatic failure in S2 was due to the edPR model having a too high firing rate for the ion pumps and cotransporters to maintain ion concentrations close to baseline. The firing rate of 3 Hz was the limiting case (found by trial and error), i.e., for lower firing rates than this, the model could maintain regular firing for an arbitrarily long time. As many neurons can fire at quite high frequencies, a tolerance level of 3 Hz might seem a bit low, and we here provide some comments to this. Firstly, we note that the edPR model could fire at 3 Hz (and gradually higher frequencies) for about 9 s, and could also maintain a higher firing rate than this for a limited time. Secondly, the PR model, and thus the edPR model, represented a hippocampal CA3 neuron, which has been found to have an average firing rate of less than 0.5 Hz , so that endured firing of ≥ 3 Hz may be abnormal for these neurons. Thirdly, under biological conditions, glial cells, and in particular astrocytes, provide additional homeostatic functions  that were not accounted for in the edPR model, and the inclusion of such functions would probably increase the tolerance level of the neuron. Fourthly, the (3 Hz) tolerance level was a consequence of modeling choices and could be made higher, e.g., by increasing pump rates or compartment volumes. However, we did not do any model tuning in order to increase the tolerance level, as we, in light of the above arguments, considered a 3 Hz tolerance level to be acceptable. The edPR model predicts homeostatic failure due to impaired homeostatic mechanisms Above we simulated homeostatic failure occurring because the firing rate became too high for the homeostatic mechanisms to keep up (S2). Homeostatic failure may also occur due to impairment of the homeostatic mechanisms, either due to genetic mutations (see, e.g., ) or because the energy supply is reduced, such as after a stroke (see, e.g., ). Here, we have used the edPR model to simulate a version of this, i.e., a third scenario (S3) where the ATP-dependent mechanisms, that is, the 3Na + /2K + pumps and the Ca 2+ /2Na + exchangers, were turned off. In S3, the neuron received no external input, so that the dynamics of the neuron was solely due to gradually dissipating transmembrane ion concentration gradients. After an initial transient, we observed a slow and gradual increase in the membrane potential for about 48 s . This coincided with a slow and gradual change in the ion concentrations  and ionic reversal potentials  due to predominantly passive leakage over the membrane. At about t = 48 s, the membrane potential reached the firing threshold, at which point the active channels started to use what was left of the concentration gradients to generate action potentials and Ca 2+ spikes. This resulted in a burst of activity. During this bursts of activity, the concentration gradients dissipated even faster, since both active and passive channels were then open. As a consequence, the “resting” membrane potential was further depolarized and the neuron went into depolarization block . After this, the neuron continued to “leak” until it settled at a new steady state. The non-zero final equilibrium potential is known as the Donnan equilibrium or the Gibbs-Donnan equilibrium . The reason why the cell did not approach an equilibrium with ϕ m = 0 and identical ion concentrations on both side of the membrane, is that the model contained static residual charges, representing negatively charged macromolecules typically residing in the intracellular environment (see ), the sum of which resulted in a final state with a negatively charged inside. In addition, since the Ca 2+ channel inactivated, and since the model had no passive Ca 2+ leakage, Ca 2+ could end up being trapped inside/outside the membrane and did not by necessity approach the Donnan equilibrium, although it was close to it. As the Ca 2+ dynamics in may seem counterintuitive, we here give some additional explanation of it. During the burst and initial stages of the depolarization block, the dendritic Ca 2+ channels were open. Extracellular Ca 2+ then diffused from the soma towards the dendrite, where it flowed into the neuron. This resulted in a low Ca 2+ concentration in both extracellular compartments and a high Ca 2+ concentration in the intracellular dendritic compartment. The reason why the intracellular Ca 2+ equilibrated more slowly than the extracellular, was that, by assumption, only 1% of the intracellular Ca 2+ concentration was unbuffered and free to diffuse (see ), hence, the effective intracellular concentration gradient was a factor 100 lower than it “appears” in . A pattern resembling that in , i.e., a period of silence, followed by a burst of activity, and then silence again, has been seen in experimental EEG recordings of decapitated rats , where the activity burst was referred to as “the wave of death”, and the phenomenon was ascribed to the lack of energy supply to homeostatic mechanisms. The simulation in represents the single-cell correspondence to this death wave. We note that this phenomenon has been simulated and analyzed thoroughly in a previous modeling study, using a simpler, single compartmental model with ion conservation . We, therefore, do not analyze it further here. Loss in accuracy when neglecting electrodiffusive effects on concentration dynamics The concentration-dependent effects studied in the previous subsection were predominantly due to changes in ionic reversal potentials. Effects like this could, therefore, be accounted for by any model that in some way incorporates ion concentration dynamics , provided that the ion concentration dynamics is accurately modeled. As we argued in the Introduction, previous multicompartmental neuron models that do incorporate ion concentration dynamics have not done it in a complete, ion conserving way that ensures a biophysically consistent relationship between ion concentration, electrical charge, and electrical potentials (see, e.g., ). To specify, the change in the ion concentration in a given compartment will, in reality, depend on (i) the transmembrane influx of ions into this compartment, (ii) the diffusion of ions between this compartment and its neighboring compartment(s), and (iii) the electrical drift of ions between this compartment and its neighboring compartment(s). Some of the cited models account for only (i) , others account for (i) and (ii) , but neither account for (iii). When (iii) is not accounted for, electrical and diffusive processes are implicitly treated as independent processes, a simplifying assumption which is also incorporated in the reaction-diffusion module  in the NEURON simulation environment . In models that apply this assumption, there will therefore be drift currents (along axons and dendrites) that affect ϕ m (through the cable equation), but not the ion concentration dynamics, although they should, since also the drift currents are mediated by ions. Here, we use simulations on the edPR model to test the inaccuracy introduced when not accounting for the effect of drift currents on ion concentration dynamics. We do so by comparing how many ions that were transferred from the somatic to the dendritic compartment through the intracellular  and extracellular  space, due to ionic diffusion (orange curves) versus electrical drift (blue curves), throughout the simulation in . We note that shows the accumulatively moved number of ions (from time zero to t ) due to axial fluxes exclusively. That is, the large number of, for example, Na + ions transported intracellularly from the dendrite to the soma (negative sign) in , does not by necessity mean that Na + ions were piling up in the soma compartment, as the membrane efflux of Na + was not accounted for in the figure. Although diffusion tended to dominate the intracellular transport of ions on the long time scale , the transport due to electrical drift was not vanishingly small. For example, the number of K + and Cl − ions transported by electrical drift was at the end of the stimulus period ( t = 20 s) about 35% of the transport due to diffusion for both species. In the extracellular space, diffusion was the clearly dominant transporter of Na + and K + , while diffusion and electrical drift were of comparable magnitude for the other ion species . Of course, these estimates are all specific to the edPR model, as they will depend strongly on the included ion channels, ion pumps and cotransporters, and on how they are distributed between the soma and dendrite. In general, however, the simulations in suggest that electrical drift is likely to have a non-negligible effect on ion concentration dynamics, and that ignoring this effect will give rise to rather inaccurate estimates. Finally, we also converted the sum of ionic fluxes in into an effective current, represented as the number of transported unit charges, e + . Interestingly, diffusion and drift contributed almost equally to the axial charge transport in the system. We note, however, that the movement of charges per time unit is indicated by the slope of the curves, which was much larger for the drift case (blue curve) than for diffusion (orange curve). The drift curve had a jigsaw shape, which shows that drift was moving charges back and forth in the system, while the diffusion always went in the same direction, explaining why it, despite being smaller than the drift current, had a comparably large accumulative effect on charge transport. The temporally averaged picture of charge transport that emerges from is that of a slow current loop where charge is transferred intracellularly from the soma to the dendrite , where it crosses the membrane (outward current), and then is transferred extracellularly back from the dendrite to the soma , before crossing the membrane again (inward current). This configuration is similar to the slow loop current seen during spatial buffering by astrocytes (see, e.g. Fig 1 in ). Loss in accuracy when neglecting electrodiffusive effects on voltage dynamics In the previous section, we investigated the consequences of neglecting (iii) the contribution of drift currents on ion concentration dynamics. Here, we investigate the consequences of neglecting the effect of ionic diffusion (along dendrites) on the electrical potential, focusing on the extracellular potential ϕ e . Forward modeling of extracellular potentials is typically based on volume conductor (VC) theory , which assumes that diffusive effects on electrical potentials are negligible. Being based on a unified electrodiffusive KNP framework , the edPR model accounts for the effects of ionic diffusion on the electrical potentials, and can thus be used to address the validity of this assumption. To illustrate the effect of diffusion on ϕ e , we may split it into a component ϕ VC,e explained by standard VC-theory, and a component ϕ diff,e representing the additional contribution caused by diffusive currents . In the simulation in , the diffusive contribution was found to be very small compared to the VC-component . However, while ϕ VC,e fluctuated rapidly from negative to positive values during neuronal activity, ϕ diff,e varied on a slower time scale and had the same directionality throughout the simulation. This is equivalent to what we saw in , i.e., that diffusion always moved charge in the same direction. Moreover, if we take the temporal averages of the potentials over the time series in , we find that they are -0.0023 mV, 0.0037 mV, and -0.0060 mV for ϕ e , ϕ diff,e , and ϕ VC,e , respectively. This shows that the average diffusion- and VC-components of the total potential were of the same order of magnitude. As we also have demonstrated in previous studies, diffusion is thus likely to be important for the low-frequency components of extracellular potentials . Albeit small, the slowly varying diffusion evoked shifts in ϕ e are putatively important for explaining the direct-current (DC) like shifts and long-time concentration dynamics reported during, e.g., spreading depression . 

The here proposed electrodiffusive Pinsky-Rinzel (edPR) model is inspired by the original Pinsky-Rinzel (PR) model , which is a two-compartment (soma + dendrite) version of a CA3 hippocampal cell model, initially developed by Traub et al. . In the original PR model, the somatic compartment contains Na + , and K + delayed rectifier currents ( I Na and I K−DR ), while the dendritic compartment contains a voltage-dependent Ca 2+ current ( I Ca ), a voltage-dependent K + afterhyperpolarization current ( I K−AHP ), and a Ca 2+ -dependent K + current ( I K−C ). In addition, both compartments contain passive leakage currents. Despite its small number of compartments and conductances, the PR model can reproduce a variety of realistic firing patterns when responding to somatic or dendritic stimuli, including somatic APs and dendritic calcium spikes. In the edPR model, we have adopted all mechanisms from the original PR model. In addition, we have (i) made all ion channels and passive leakage currents ion-specific, (ii) included 3Na + /2K + pumps ( I pump ), K + /Cl − cotransporters ( I KCC2 ), Na + /K + /2Cl − cotransporters ( I NKCC1 ), and Ca 2+ /2Na + exchangers ( I Ca−dec ), and (iii) included two extracellular compartments (outside soma + outside dendrite). To compute the dynamics of the edPR, we used an electrodiffusive KNP-framework for consistently computing the voltage- and ion concentration dynamics in the intra- and extracellular compartments . The model is summarized in and described in details in the Methods section. 

While the key variable in the original PR model is the membrane potential ϕ m , the edPR model allows us to compute a multitude of variables relevant to neurodynamics. The functionality of the edPR model is illustrated in , which shows a 60 s simulation where the model fires at 1 Hz for 10 s. We have plotted a selection of output variables, including the membrane potentials , extracellular potentials , the dynamics of all ion concentrations in all compartments , concentration effects on ionic reversal potentials , concentration effects on the electrical conductivity of the intra- and extracellular medium , and ATP consumption  of the 3Na + /2K + pumps and Ca 2+ /2Na + exchangers. Unlike neuronal models based on cable theory, where ϕ e is assumed to be zero so that ϕ m = ϕ i , the edPR model computes ϕ m , ϕ i , and ϕ e from a consistent framework where ephaptic effects from ϕ e on ϕ m are accounted for . Due to the electrical coupling between the soma and dendrite, the fluctuations in ϕ m were similar in these compartments, and a more detailed analysis of the AP shapes is found further below. While an action potential essentially gave a depolarization followed by a repolarization of ϕ m , its extracellular signature was essentially a voltage drop (to about -5 mV) followed by a voltage increase (to about +5 mV). This biphasic response of the extracellular AP signature has been seen in several studies (for an analysis, see ). In experimental recordings, amplitudes in ϕ e fluctuations are typically on the order of 100 μ V, which is much smaller than that predicted by the edPR model. The discrepancy is an artifact that is mainly due to the 1D approximation in the edPR model (see ). The dendritic extracellular potential  was by definition zero at all times, as this compartment was used as the reference point for the potential. The effect of neuronal firing on the ion concentration dynamics is illustrated in . Before the stimulus onset, the cell was resting at approximately -68 mV, and ion concentrations remained at baseline values. During AP firing, the ion concentrations varied in a jigsaw-like fashion in all compartments, except for Ca 2+ , which returned to baseline between each AP and showed notable variation only inside/outside the dendrite since the soma contained no Ca 2+ channels. As the extracellular volume was set to be half as big as the intracellular volume, changes in extracellular ion concentrations were about twice as big as the changes in intracellular ion concentrations. The jigsaw pattern was most pronounced for the K + and Na + concentrations, as these were the main mediators of the APs . The pattern reflects a cycle of (i) incremental steps away from baseline concentrations, which were mediated by the complex of mechanisms active during the APs, followed by (ii) slower decays back towards baseline, which were mediated by pumps and cotransporters working between the APs. In this simulation, the decay was incomplete, so that concentrations reached gradually larger peak values by each consecutive AP. However, as we show later (see Section titled The edPR model predicts homeostatic failure due to high firing rate), the concentrations did, in this case, approach a firing-frequency dependent steady state. When the firing ceased in , the pumps and cotransporters could work uninterruptedly to re-establish the baseline ion concentrations. The resting membrane potential of about -68 mV, was recovered quite rapidly (ms timescale). After this, the slower recovery process of the ion concentration was due to an electroneutral exchange of ions between the neuron and the extracellular space. A full recovery of the baseline concentrations took on the order of 80 s (confirmed by running a longer simulation than the one shown in ). As ion concentrations varied during the simulation, so did the ionic reversal potentials, E k . The by far largest change was seen for the Ca 2+ reversal potential in the dendrite ( E k,d ), which dropped by as much as -30 mV during an AP, (i.e., from a baseline value of 124 mV to 94 mV). The explanation is that the basal intracellular Ca 2+ -concentration is extremely low (100 nM) compared to the concentrations of other ion species (several mM), and therefore experienced a much larger relative change during the simulation. Among the main charge carriers (Na + , Cl − , K + ), the lowest concentration is found for K + in the extracellular space ( in Methods). For that reason, the second largest change in reversal potential was found for E K , which increased by about 5 mV (i.e., from a basal value of -84 mV to -79 mV) in both the soma and dendrite. The changes in E Ca and E K had a relatively minor impact on the firing pattern in the shown simulations, as the relative change in the driving force ϕ m − E k was not that severe. The conductivities ( σ ) of the intra- and extracellular bulk solutions depend on the availability of free charge carriers, and are in the edPR model functions of the ion concentrations and their mobility (cf. ). The changes in σ were minimal during the conditions simulated here , i.e., σ varied by a few μ S/m over the course of the simulation, while the basal levels were approximately 0.11 S/m and 0.59 S/m for the intra- and extracellular solutions, respectively. Finally, the 3Na + /2K + pump and Ca 2+ /2Na + exchanger use energy in the form of ATP to move ions against their gradients. The 3Na + /2K + pump exchanges 3 Na + ions for 2 K + ions, and consumes one ATP per cycle , while we assumed that the Ca 2+ /2Na + exchanger consumed 1 ATP per cycle (i.e., per Ca 2+ exchanged, as in ). As the edPR model explicitly models these processes, we could compute the ATP (energy) consumption of the pumps during the simulation. shows the accumulative number of ATP consumed from the onset of the simulation. The 3Na + /2K + pump was constantly active, as it combated leakage currents and worked to maintain the baseline concentration even before stimulus onset. Before stimulus onset, it consumed ATP at a constant rate (linear curve), which increased only slightly at t = 10 s when the neuron started to fire (small dent in the curve). As the neuron did not contain any passive leakage of Ca 2+ , the Ca 2+ /2Na + exchangers were only active while the neuron was firing. During firing, the Ca 2+ /2Na + exchanger combated the Ca 2+ entering through the dendritic Ca 2+ channels, and then consumed approximately the same amount of energy as the 3Na + /2K + pump (parallel curves). A high metabolic cost of dendritic Ca 2+ spikes has previously been reported also in cortical layer 5 pyramidal neurons . We note that the edPR model had a stable resting state before stimulus onset and that it returned to this resting state after the stimulus had been turned off. In this resting state, ion concentrations remained constant, and ϕ m was approximately -68 mV. This resting equilibrium was due to a balance between the ion-specific leakage channels, pumps, and cotransporters, which we adopted from previous studies (see ). However, the existence of a homeostatic equilibrium was not highly sensitive to the choice of model parameters. As we confirmed through a sensitivity analysis, varying membrane parameters (one by one) with ±15% of their default values did not abolish the existence of a stable resting state, but shifted the resting potential by maximally ±3 mV  and the resting concentrations by maximally 5% . 

A motivation behind basing the electrodiffusive (edPR) model on a previously developed (PR) model, was that we wanted to use the firing properties of the original PR model as a “ground truth” when constraining the edPR model. In particular, we wanted the edPR model to qualitatively reproduce the interplay between somatic action potentials and dendritic Ca 2+ spikes, as this was an essential feature of the original PR model . In the PR model, this interplay depended strongly on the coupling strength (coupling conductance) between the soma and dendrite compartment. A weak coupling resulted in a wobbly ping-pong effect, where a somatic AP triggered a dendritic Ca 2+ spike, which in turn fed back to the soma, giving rise to secondary oscillations in ϕ m . With a strong (about five times stronger) coupling, the somatic and dendritic responses became more similar in shape, as expected . Since the edPR model contained membrane mechanisms and ephaptic effects not present in the PR model, selected parameters in the edPR model had to be re-tuned in order to obtain similar firing as the PR model (see ). With the selected parameterization of the edPR model (see the Parameterizations section), we were able to reproduce the characteristic features seen in the PR model for a weak  and strong (about five times stronger) coupling between the soma and dendrite . 

As previously discussed, the PR model was, as most existing neuronal models, constructed under the assumption that ion concentration effects are negligible, an assumption that is justified for short term neurodynamics, and for long term dynamics provided that the activity level is sufficiently low for the homeostatic mechanisms to maintain concentrations close to baseline over time. Hence, we expect there to be a scenario (S1) with a moderately low firing rate, where the PR and edPR models can fire continuously and regularly over a long time exhibiting similar firing properties, and another scenario (S2) with a higher firing rate, where the PR and edPR models exhibit similar firing properties initially in the simulation, but where the dynamics of the two models diverge over time due to homeostatic failure accounted for by the edPR model, but not the PR model (which ad hoc assume perfect homeostasis). Simulations of two such scenarios are shown in Figs and . To simulate scenario S1, the PR model  and edPR model  were given a constant input (see figure caption) that gave them a firing rate of 1 Hz. Both models settled at a regular firing rate, and in neither of them the firing pattern changed over time, even in simulations of as much as an hour of biological time. For the edPR model, the S1 scenario is the same as that simulated for only a brief period in . There, we observed that the ion concentrations gradually changed during the first seconds after the onset of stimulus . However, for endured firing, the ion concentrations and reversal potentials settled on a (new) dynamic steady state , where they deviated by ∼1-5 mM from the baseline concentrations during rest (i.e., for edPR receiving no input). The apparent “thickness” of the curves (e.g., the red curve for K + in ) is due to concentration fluctuations at the short time scale of AP firing. However, after each AP, the homeostatic mechanisms managed to re-establish ionic gradients before the next AP occurred, so that no slow concentration-dependent effect developed in the edPR model at a long time scale. To simulate scenario S2, the PR model  and edPR model  were given a constant input (see figure caption) that gave them a firing rate of about 3 Hz. The PR model, which included no concentration-dependent effects, settled on a regular firing rate that it could maintain for an arbitrarily long time. Unlike the PR model, the edPR model did not settle at a steady state, but had a firing rate of ∼ 3 Hz only for a period of ∼ 5 s after stimulus onset. During this period, the ion concentrations gradually diverged from the baseline levels . The corresponding changes in ionic reversal potentials  affected the neuron’s firing properties and caused its firing rate to gradually increase before it eventually entered the depolarization block and got stuck at about ϕ m = −30mV. The main explanation behind the altered firing pattern was the change in the K + reversal potential, which, for example, at 9 s after stimulus onset ( t = 19 s) had increased by as much as 20 mV from baseline. This shift led to a depolarization of the neuron, which explains both the (gradually) increased firing rate and the (final) depolarization block, i.e., the condition where ϕ m could no longer repolarize to levels below the firing threshold, and AP firing was abolished due to a permanent inactivation of active Na + channels. Neuronal depolarization block is a well-studied phenomenon, which is often caused by high extracellular K + concentrations . The homeostatic failure in S2 was due to the edPR model having a too high firing rate for the ion pumps and cotransporters to maintain ion concentrations close to baseline. The firing rate of 3 Hz was the limiting case (found by trial and error), i.e., for lower firing rates than this, the model could maintain regular firing for an arbitrarily long time. As many neurons can fire at quite high frequencies, a tolerance level of 3 Hz might seem a bit low, and we here provide some comments to this. Firstly, we note that the edPR model could fire at 3 Hz (and gradually higher frequencies) for about 9 s, and could also maintain a higher firing rate than this for a limited time. Secondly, the PR model, and thus the edPR model, represented a hippocampal CA3 neuron, which has been found to have an average firing rate of less than 0.5 Hz , so that endured firing of ≥ 3 Hz may be abnormal for these neurons. Thirdly, under biological conditions, glial cells, and in particular astrocytes, provide additional homeostatic functions  that were not accounted for in the edPR model, and the inclusion of such functions would probably increase the tolerance level of the neuron. Fourthly, the (3 Hz) tolerance level was a consequence of modeling choices and could be made higher, e.g., by increasing pump rates or compartment volumes. However, we did not do any model tuning in order to increase the tolerance level, as we, in light of the above arguments, considered a 3 Hz tolerance level to be acceptable. 

Above we simulated homeostatic failure occurring because the firing rate became too high for the homeostatic mechanisms to keep up (S2). Homeostatic failure may also occur due to impairment of the homeostatic mechanisms, either due to genetic mutations (see, e.g., ) or because the energy supply is reduced, such as after a stroke (see, e.g., ). Here, we have used the edPR model to simulate a version of this, i.e., a third scenario (S3) where the ATP-dependent mechanisms, that is, the 3Na + /2K + pumps and the Ca 2+ /2Na + exchangers, were turned off. In S3, the neuron received no external input, so that the dynamics of the neuron was solely due to gradually dissipating transmembrane ion concentration gradients. After an initial transient, we observed a slow and gradual increase in the membrane potential for about 48 s . This coincided with a slow and gradual change in the ion concentrations  and ionic reversal potentials  due to predominantly passive leakage over the membrane. At about t = 48 s, the membrane potential reached the firing threshold, at which point the active channels started to use what was left of the concentration gradients to generate action potentials and Ca 2+ spikes. This resulted in a burst of activity. During this bursts of activity, the concentration gradients dissipated even faster, since both active and passive channels were then open. As a consequence, the “resting” membrane potential was further depolarized and the neuron went into depolarization block . After this, the neuron continued to “leak” until it settled at a new steady state. The non-zero final equilibrium potential is known as the Donnan equilibrium or the Gibbs-Donnan equilibrium . The reason why the cell did not approach an equilibrium with ϕ m = 0 and identical ion concentrations on both side of the membrane, is that the model contained static residual charges, representing negatively charged macromolecules typically residing in the intracellular environment (see ), the sum of which resulted in a final state with a negatively charged inside. In addition, since the Ca 2+ channel inactivated, and since the model had no passive Ca 2+ leakage, Ca 2+ could end up being trapped inside/outside the membrane and did not by necessity approach the Donnan equilibrium, although it was close to it. As the Ca 2+ dynamics in may seem counterintuitive, we here give some additional explanation of it. During the burst and initial stages of the depolarization block, the dendritic Ca 2+ channels were open. Extracellular Ca 2+ then diffused from the soma towards the dendrite, where it flowed into the neuron. This resulted in a low Ca 2+ concentration in both extracellular compartments and a high Ca 2+ concentration in the intracellular dendritic compartment. The reason why the intracellular Ca 2+ equilibrated more slowly than the extracellular, was that, by assumption, only 1% of the intracellular Ca 2+ concentration was unbuffered and free to diffuse (see ), hence, the effective intracellular concentration gradient was a factor 100 lower than it “appears” in . A pattern resembling that in , i.e., a period of silence, followed by a burst of activity, and then silence again, has been seen in experimental EEG recordings of decapitated rats , where the activity burst was referred to as “the wave of death”, and the phenomenon was ascribed to the lack of energy supply to homeostatic mechanisms. The simulation in represents the single-cell correspondence to this death wave. We note that this phenomenon has been simulated and analyzed thoroughly in a previous modeling study, using a simpler, single compartmental model with ion conservation . We, therefore, do not analyze it further here. 

The concentration-dependent effects studied in the previous subsection were predominantly due to changes in ionic reversal potentials. Effects like this could, therefore, be accounted for by any model that in some way incorporates ion concentration dynamics , provided that the ion concentration dynamics is accurately modeled. As we argued in the Introduction, previous multicompartmental neuron models that do incorporate ion concentration dynamics have not done it in a complete, ion conserving way that ensures a biophysically consistent relationship between ion concentration, electrical charge, and electrical potentials (see, e.g., ). To specify, the change in the ion concentration in a given compartment will, in reality, depend on (i) the transmembrane influx of ions into this compartment, (ii) the diffusion of ions between this compartment and its neighboring compartment(s), and (iii) the electrical drift of ions between this compartment and its neighboring compartment(s). Some of the cited models account for only (i) , others account for (i) and (ii) , but neither account for (iii). When (iii) is not accounted for, electrical and diffusive processes are implicitly treated as independent processes, a simplifying assumption which is also incorporated in the reaction-diffusion module  in the NEURON simulation environment . In models that apply this assumption, there will therefore be drift currents (along axons and dendrites) that affect ϕ m (through the cable equation), but not the ion concentration dynamics, although they should, since also the drift currents are mediated by ions. Here, we use simulations on the edPR model to test the inaccuracy introduced when not accounting for the effect of drift currents on ion concentration dynamics. We do so by comparing how many ions that were transferred from the somatic to the dendritic compartment through the intracellular  and extracellular  space, due to ionic diffusion (orange curves) versus electrical drift (blue curves), throughout the simulation in . We note that shows the accumulatively moved number of ions (from time zero to t ) due to axial fluxes exclusively. That is, the large number of, for example, Na + ions transported intracellularly from the dendrite to the soma (negative sign) in , does not by necessity mean that Na + ions were piling up in the soma compartment, as the membrane efflux of Na + was not accounted for in the figure. Although diffusion tended to dominate the intracellular transport of ions on the long time scale , the transport due to electrical drift was not vanishingly small. For example, the number of K + and Cl − ions transported by electrical drift was at the end of the stimulus period ( t = 20 s) about 35% of the transport due to diffusion for both species. In the extracellular space, diffusion was the clearly dominant transporter of Na + and K + , while diffusion and electrical drift were of comparable magnitude for the other ion species . Of course, these estimates are all specific to the edPR model, as they will depend strongly on the included ion channels, ion pumps and cotransporters, and on how they are distributed between the soma and dendrite. In general, however, the simulations in suggest that electrical drift is likely to have a non-negligible effect on ion concentration dynamics, and that ignoring this effect will give rise to rather inaccurate estimates. Finally, we also converted the sum of ionic fluxes in into an effective current, represented as the number of transported unit charges, e + . Interestingly, diffusion and drift contributed almost equally to the axial charge transport in the system. We note, however, that the movement of charges per time unit is indicated by the slope of the curves, which was much larger for the drift case (blue curve) than for diffusion (orange curve). The drift curve had a jigsaw shape, which shows that drift was moving charges back and forth in the system, while the diffusion always went in the same direction, explaining why it, despite being smaller than the drift current, had a comparably large accumulative effect on charge transport. The temporally averaged picture of charge transport that emerges from is that of a slow current loop where charge is transferred intracellularly from the soma to the dendrite , where it crosses the membrane (outward current), and then is transferred extracellularly back from the dendrite to the soma , before crossing the membrane again (inward current). This configuration is similar to the slow loop current seen during spatial buffering by astrocytes (see, e.g. Fig 1 in ). 

In the previous section, we investigated the consequences of neglecting (iii) the contribution of drift currents on ion concentration dynamics. Here, we investigate the consequences of neglecting the effect of ionic diffusion (along dendrites) on the electrical potential, focusing on the extracellular potential ϕ e . Forward modeling of extracellular potentials is typically based on volume conductor (VC) theory , which assumes that diffusive effects on electrical potentials are negligible. Being based on a unified electrodiffusive KNP framework , the edPR model accounts for the effects of ionic diffusion on the electrical potentials, and can thus be used to address the validity of this assumption. To illustrate the effect of diffusion on ϕ e , we may split it into a component ϕ VC,e explained by standard VC-theory, and a component ϕ diff,e representing the additional contribution caused by diffusive currents . In the simulation in , the diffusive contribution was found to be very small compared to the VC-component . However, while ϕ VC,e fluctuated rapidly from negative to positive values during neuronal activity, ϕ diff,e varied on a slower time scale and had the same directionality throughout the simulation. This is equivalent to what we saw in , i.e., that diffusion always moved charge in the same direction. Moreover, if we take the temporal averages of the potentials over the time series in , we find that they are -0.0023 mV, 0.0037 mV, and -0.0060 mV for ϕ e , ϕ diff,e , and ϕ VC,e , respectively. This shows that the average diffusion- and VC-components of the total potential were of the same order of magnitude. As we also have demonstrated in previous studies, diffusion is thus likely to be important for the low-frequency components of extracellular potentials . Albeit small, the slowly varying diffusion evoked shifts in ϕ e are putatively important for explaining the direct-current (DC) like shifts and long-time concentration dynamics reported during, e.g., spreading depression . 

The original Pinsky-Rinzel (PR) is a reduced model of a hippocampal neuron, which reproduces the essential somatodendritic firing properties of CA3 neurons despite having only two compartments . Simplified neuron models like that are useful, partly because their reduced complexity makes them easier to analyze, and as such, can lead to insight in key neuronal mechanisms, and partly because they demand less computer power and can be used as modules in large scale network simulations. Whereas the PR model, as most available neuron models, assumes that ion concentrations remain constant during the simulated period, the electrodiffusive Pinsky-Rinzel (edPR) model proposed here models ion concentration dynamics explicitly. The edPR model may thus be seen as a supplement to the PR model, which should be applied to simulate conditions where ion concentrations are expected to vary with time. In the results section, we showed that the edPR model closely reproduced the firing properties of the PR model for short term dynamics , and for long term dynamics provided that the firing rate was sufficiently low for the homeostatic mechanisms to maintain ion concentrations close to baseline . We also showed that if the firing rate became too high , or if the homeostatic mechanisms were impaired , unsuccessful homeostasis would cause ion concentrations to gradually shift over time, and lead to slowly developing changes in the firing properties of the edPR model, changes that were not accounted for by the original PR model. The edPR model was based on an electrodiffusive framework , which ensured a consistent relationship between ion concentrations, electrical charge, and electrical potential in four compartments. To our knowledge, the edPR model is the first multicompartmental neuronal model that ensures complete and consistent ion concentration and charge conservation. Model assumptions The construction of the edPR model naturally involved making a set of modeling choices, and the most important of these are discussed here. Firstly, in the construction of the model, we focused on morphological simplicity, biophysical rigor, and mechanistic understanding, rather than on replicating any specific biological scenario and incorporating biological details. Secondly, simultaneous data of variations in all intra- and extracellular concentrations during neuronal firing are not available, and it might not even be feasible to obtain such data. Consequently, computational modeling based on biophysical constraints may be the best means to estimate it. The concentration dynamics in the edPR model were thus not directly constrained to data but constrained so that there was, at all times, an internally consistent relationship between all ion concentrations and all electrical potentials, ensuring an electroneutral bulk solution. Thirdly, to include extracellular dynamics to models of neurons or networks of such is computationally challenging, since the extracellular space, in reality, is an un-confined three-dimensional continuum, locally affected by populations of nearby neurons and glial cells. As we wanted to keep things simple and conceptual, we chose to use closed boundary conditions, i.e., no ions and no charge were allowed to leave or enter the system consisting of the single (2-compartment) neuron and its local and confined (2-compartment) surrounding . Tecnically, it would be straightforward to increase the number of compartments (i.e., the spatial resolution) in the model. A consequence of using closed boundary conditions was that the extracellular (like the intracellular) currents became one-dimensional (from soma to dendrite), while in reality, extracellular currents pass through a three-dimensional volume conductor. The edPR model could be made three dimensional if embedded in a bi- or tri-domain model (as discussed below). However, currently, it is 1D, and the effect of the 1D assumption was essentially an increase in the total resistance (fewer degrees of freedom) for extracellular currents, which gave rise to an artificially high amplitude in extracellular AP signatures . We note, however, that the closed boundary is actually equivalent to assuming periodic boundary conditions, so that the edPR model essentially simulates the hypothetical case of a population of perfectly synchronized neurons, i.e., one where all neurons are doing exactly the same as the simulated neuron, so that no spatial variation occurs. Likely, this may give accurate predictions for ion concentration shifts over time, as these reflect a temporal average of activity, but less accurate predictions for brief and unique electrical events, such as action potentials, which are not likely to be elicited in perfect synchrony by a large population . Fourthly, to faithfully represent a morphologically complex neuron with a reduced number of compartments is a non-trivial task. Available analytical theory for collapsing branching dendrites into equivalent cylinders are generally based on certain assumptions about branching symmetries, and on preserving electrotonic distances . However, it is unlikely that the length constants of electrodynamics and ion concentration dynamics scale in the same way. Hence, in the edPR model, the volumes and membrane areas of, and cross-section areas between, the two neuronal compartments were here introduced as rather arbitrary model choices, fixed at values that were verified to give agreement between the firing properties of the edPR model and the PR model. Outlook Being applicable to simulate conditions with failed homeostasis, the edPR model opens up for simulating a range of pathological conditions, such as spreading depression or epilepsy , which are associated with large scale shifts in extracellular ion concentrations. A particular context in which we anticipate the edPR model to be useful is that of simulating spreading depression. Previous spatial, electrodiffusive, and biophysically consistent models of spreading depression have targeted the problem at a large-scale tissue-level, using a mean-field approach . These models were inspired by the bi-domain model , which has been successfully applied in simulations of cardiac tissue . The bi-domain model is a coarse-grained model, in which the tissue is considered as a bi-phasic continuum consisting of an intracellular and extracellular domain. That is, a set of intra- and extracellular variables (i.e., voltages and ion concentrations), and the ionic exchange between the intra- and extracellular domains, are defined at each point in space. This simplification allows for large scale simulations of signals that propagate through tissue but sacrifices morphological detail. In the context of spreading depression, a shortcoming with this simplification is that the leading edge of the spreading depression wave in both the hippocampus and cortex is in the layers containing the apical dendrites . This suggests that the different expression of membrane mechanisms in deeper (somatic) and higher (dendritic) layers may be crucial for fully understanding the propagation and genesis of the wave. In this context, the edPR model could enter as a module in a, let us say, bi-times-two-domain model, where each point in ( xy ) space contains a set of (i) somatic intracellular variables, (ii) somatic extracellular variables, (iii) dendritic intracellular variables, and (iv) dendritic extracellular variables, and thus accounts for the differences between the higher and lower layers. We should note that the state of the art models of spreading depression are not bi-domain models but rather tri-domain models, as they also include a glial domain to account especially for the work done by astrocytes in K + buffering . Hence, to use the edPR model to expand the current spreading depression models, a natural first step would be to include a glial (astrocytic) compartment in it, so that it eventually could be implemented as a tri-times-two-domain model. 

The construction of the edPR model naturally involved making a set of modeling choices, and the most important of these are discussed here. Firstly, in the construction of the model, we focused on morphological simplicity, biophysical rigor, and mechanistic understanding, rather than on replicating any specific biological scenario and incorporating biological details. Secondly, simultaneous data of variations in all intra- and extracellular concentrations during neuronal firing are not available, and it might not even be feasible to obtain such data. Consequently, computational modeling based on biophysical constraints may be the best means to estimate it. The concentration dynamics in the edPR model were thus not directly constrained to data but constrained so that there was, at all times, an internally consistent relationship between all ion concentrations and all electrical potentials, ensuring an electroneutral bulk solution. Thirdly, to include extracellular dynamics to models of neurons or networks of such is computationally challenging, since the extracellular space, in reality, is an un-confined three-dimensional continuum, locally affected by populations of nearby neurons and glial cells. As we wanted to keep things simple and conceptual, we chose to use closed boundary conditions, i.e., no ions and no charge were allowed to leave or enter the system consisting of the single (2-compartment) neuron and its local and confined (2-compartment) surrounding . Tecnically, it would be straightforward to increase the number of compartments (i.e., the spatial resolution) in the model. A consequence of using closed boundary conditions was that the extracellular (like the intracellular) currents became one-dimensional (from soma to dendrite), while in reality, extracellular currents pass through a three-dimensional volume conductor. The edPR model could be made three dimensional if embedded in a bi- or tri-domain model (as discussed below). However, currently, it is 1D, and the effect of the 1D assumption was essentially an increase in the total resistance (fewer degrees of freedom) for extracellular currents, which gave rise to an artificially high amplitude in extracellular AP signatures . We note, however, that the closed boundary is actually equivalent to assuming periodic boundary conditions, so that the edPR model essentially simulates the hypothetical case of a population of perfectly synchronized neurons, i.e., one where all neurons are doing exactly the same as the simulated neuron, so that no spatial variation occurs. Likely, this may give accurate predictions for ion concentration shifts over time, as these reflect a temporal average of activity, but less accurate predictions for brief and unique electrical events, such as action potentials, which are not likely to be elicited in perfect synchrony by a large population . Fourthly, to faithfully represent a morphologically complex neuron with a reduced number of compartments is a non-trivial task. Available analytical theory for collapsing branching dendrites into equivalent cylinders are generally based on certain assumptions about branching symmetries, and on preserving electrotonic distances . However, it is unlikely that the length constants of electrodynamics and ion concentration dynamics scale in the same way. Hence, in the edPR model, the volumes and membrane areas of, and cross-section areas between, the two neuronal compartments were here introduced as rather arbitrary model choices, fixed at values that were verified to give agreement between the firing properties of the edPR model and the PR model. 

Being applicable to simulate conditions with failed homeostasis, the edPR model opens up for simulating a range of pathological conditions, such as spreading depression or epilepsy , which are associated with large scale shifts in extracellular ion concentrations. A particular context in which we anticipate the edPR model to be useful is that of simulating spreading depression. Previous spatial, electrodiffusive, and biophysically consistent models of spreading depression have targeted the problem at a large-scale tissue-level, using a mean-field approach . These models were inspired by the bi-domain model , which has been successfully applied in simulations of cardiac tissue . The bi-domain model is a coarse-grained model, in which the tissue is considered as a bi-phasic continuum consisting of an intracellular and extracellular domain. That is, a set of intra- and extracellular variables (i.e., voltages and ion concentrations), and the ionic exchange between the intra- and extracellular domains, are defined at each point in space. This simplification allows for large scale simulations of signals that propagate through tissue but sacrifices morphological detail. In the context of spreading depression, a shortcoming with this simplification is that the leading edge of the spreading depression wave in both the hippocampus and cortex is in the layers containing the apical dendrites . This suggests that the different expression of membrane mechanisms in deeper (somatic) and higher (dendritic) layers may be crucial for fully understanding the propagation and genesis of the wave. In this context, the edPR model could enter as a module in a, let us say, bi-times-two-domain model, where each point in ( xy ) space contains a set of (i) somatic intracellular variables, (ii) somatic extracellular variables, (iii) dendritic intracellular variables, and (iv) dendritic extracellular variables, and thus accounts for the differences between the higher and lower layers. We should note that the state of the art models of spreading depression are not bi-domain models but rather tri-domain models, as they also include a glial domain to account especially for the work done by astrocytes in K + buffering . Hence, to use the edPR model to expand the current spreading depression models, a natural first step would be to include a glial (astrocytic) compartment in it, so that it eventually could be implemented as a tri-times-two-domain model. 

The Kirchoff-Nernst-Planck (KNP) framework In the following section, we derive the KNP continuity equations for a one-dimensional system containing two plus two compartments , with sealed boundary conditions (i.e., no ions can enter or leave the system). The geometrical parameters used in the edPR model were as defined in . Since typical neuronal/extracellular/glial volume fractions in neuronal tissue are 0.4/0.2/0.4 , we let the extracellular space be half as voluminous as the intracellular neuronal space. Two kinds of fluxes are involved: transmembrane fluxes and intra- and extracellular fluxes. The framework is general to the choice of the transmembrane fluxes. A transmembrane flux of ion species k ( j k,m ) represents the sum of all fluxes through all membrane mechanisms that allow ion k to cross the membrane. Intracellular flux densities are described by the Nernst-Planck equation: j k , i = - D k λ i 2 γ k ( [ k ] di - [ k ] si ) Δ x - D k z k F λ i 2 R T [ k ] ¯ i ϕ di - ϕ si Δ x . (1) In , D k is the diffusion constant, γ k is the fraction of freely moving ions, that is, ions that are not buffered or taken up by the ER, λ i is the tortuosity, which represents the slowing down of diffusion due to obstacles, γ k ([k] di −[k] si )/Δx is the axial concentration gradient, z k is the charge number of ion species k, F is the Faraday constant, R is the gas constant, T is the absolute temperature, [ k ] ¯ i is the average concentration, that is, γ k ([k] di + [k] si )/2, and ( ϕ di − ϕ si )/Δx is the axial potential gradient. Similarly, the extracellular flux densities are described by j k , e = - D k λ e 2 [ k ] de - [ k ] se Δ x - D k z k F λ e 2 R T [ k ] ¯ e ϕ de - ϕ se Δ x . (2) In , we do not include γ k , as all ions can move freely in the extracellular space. Diffusion constants, tortuosities, and intracellular fractions of freely moving ions used in the edPR model were as in . Ion conservation The KNP framework is based on the constraint of ion conservation. To keep track of ion concentrations we solve four differential equations for each ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (3) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (4) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (5) d [ k ] de d t = + j k , dm · A d V de + j k , e · A e V de . (6) For each compartment, all flux densities are multiplied by the area they go through and divided by the volume they enter to calculate the change in ion concentration. If we insert the Nernst-Planck equation  for the intracellular flux density, the first of these equations becomes: d [ k ] si d t = - j k , sm · A s V si + A i D k V si λ i 2 Δ x [ γ k ( [ k ] di - [ k ] si ) + z k F R T [ k ] ¯ i ( ϕ di - ϕ si ) ] , (7) where the voltage variables so far are undefined. Four constraints to derive ϕ If we have four ion species (Na + , K + , Cl − , and Ca 2+ ) in four compartments, we have 20 unknown parameters (16 for [k] and four for ϕ ), while Eqs – for four ion species give us only 16 equations. To solve this, we need to define additional constraints that allow us to express the potentials ϕ in terms of ion concentrations. As we may define an arbitrary reference point for ϕ , we take ϕ de = 0 , (8) as our first constraint, i.e., (i) the potential outside the dendrite is defined to be zero. The second constraint is that (ii) the membrane is a parallel plate capacitor that always separates a charge Q on one side from an opposite charge − Q on the other side, giving rise to a voltage difference ϕ m = Q / C m . (9) Here, C m is the total capacitance of the membrane, i.e., C m = c m A m , where c m is the more commonly used capacitance per membrane area. As, by definition, ϕ m = ϕ i − ϕ e , we get: ϕ dm = ϕ di = Q di / C m , (10) in the dendrite (since ϕ de = 0), and ϕ sm = ϕ si - ϕ se = Q si / C m , (11) in the soma. The third constraint is that (iii) we assume bulk electroneutrality. This means that the net charge associated with the ion concentrations in a given compartment by constraint must be identical to the membrane charge in this compartment. The intracellular dendritic charge is thus Q di = F ∑ k z k [ k ] di V di . By inserting this into , we obtain the final expression for ϕ di : ϕ di = ( F ∑ k z k [ k ] di V di ) / ( c m A d ) . (12) By inserting the equivalent expression for Q si into , we get ϕ si - ϕ se = Q si / C m = ( F ∑ k z k [ k ] si V si ) / ( c m A s ) . (13) Here, the extracellular potential is not set to zero, so we need a fourth constraint to determine ϕ si and ϕ se separately. The fourth and final constraint is that (iv) we must ensure charge anti-symmetry. For the charge anti-symmetry between the two sides of the capacitive membrane ( Q i = − Q e ) to be preserved in time, we must define our initial conditions so that this is the case at t = 0, and the system dynamics so that this stays the case. Hence, the system dynamics must ensure that dQ di / dt = − dQ de / dt and dQ si / dt = − dQ se / dt . The membrane currents (in isolation) will always fulfill this criterion, as any charge that crosses the membrane by definition disappears from one side of it and pops up at the other. Hence, we thus need to make sure that also the axial currents (in isolation) fulfill the criterion. The system must thus be constrained so that, if an extracellular current transports a charge δq into a given extracellular compartment, the intracellular current must transport the opposite charge − δq into the adjoint intracellular compartment. That is, we must have that: A i i i = - A e i e , (14) where i i and i e are the intra- and extracellular current densities, respectively. To find an expression for these, we multiply Eqs and by Fz k and sum over all ion species k. The expressions for the intra- and extracellular current densities then become: i i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) - F 2 R T λ i 2 Δ x ∑ k D k z k 2 [ k ] ¯ i ( ϕ di - ϕ si ) , (15) i e = - F λ e 2 Δ x ∑ k D k z k ( [ k ] de - [ k ] se ) - F 2 R T λ e 2 Δ x ∑ k D k z k 2 [ k ] ¯ e ( ϕ de - ϕ se ) . (16) In , the first term is the diffusion current density: i diff , i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) , (17) which is defined by the ion concentrations. The second term is the field driven current density i field , i = - σ i ( ϕ di - ϕ si ) Δ x , (18) where we have identified the conductivity as σ i = F 2 R T λ i 2 ∑ k D k z k 2 [ k ] ¯ i . (19) Similarly, can be written in terms of i diff,e , i field,e , and σ e . By combining Eqs , and , we obtain: - A i i diff , i + A i σ i · ( ϕ di - ϕ si ) Δ x = A e i diff , e - A e σ e · ( ϕ de - ϕ se ) Δ x . (20) In , ϕ di and ϕ de are already known from Eqs and , while i diff and σ are expressed in terms of ion concentrations. We may thus solve Eqs and for the last two voltage variables ϕ se and ϕ si : ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (21) ϕ si = Q si c m A s + ϕ se . (22) Membrane mechanics Leakage channels In the original PR model, the membrane leak current represents the combined contribution from all ion species. When using the KNP framework, on the other hand, where we keep track of all ions separately, the leak current must be ion-specific. We modeled this as in , that is, for each ion species k, we implemented a passive flux density across the membrane j k , leak = g ¯ k , leak ( ϕ m - E k ) / ( F z k ) , (23) where g ¯ k , leak is the ion conductance, ϕ m is the membrane potential, E k is the reversal potential, F is the Faraday constant, and z k is the charge number. The reversal potential is a function of ion concentrations, and is calculated using the Nernst equation: E k = R T z k F ln [ k ] e γ k [ k ] i . (24) Here, R is the gas constant, T is the absolute temperature, γ k is the intracellular fraction of free ions, and [k] e and [k] i are the concentrations of ion k outside and inside the cell, respectively. We included Na + , K + , and Cl − leak currents in both compartments. Active ion channels All active ion channel currents were adopted from the original PR model , as they were described in , and converted to ion channel fluxes. The soma compartment contained a Na + flux ( j Na ) and a K + delayed rectifier flux ( j K−DR ), while the dendrite contained a voltage-dependent Ca 2+ flux ( j Ca ), a voltage-dependent K + AHP flux ( j K−AHP ), and a Ca 2+ -dependent K + flux ( j K−C ): j Na = g Na ( ϕ sm - E Na , s ) / ( F z Na ) , (25) j K - DR = g DR ( ϕ sm - E K , s ) / ( F z K ) , (26) j Ca = g Ca ( ϕ dm - E Ca , d ) / ( F z Ca ) , (27) j K - AHP = g AHP ( ϕ dm - E K , d ) / ( F z K ) , (28) j K - C = g C ( ϕ dm - E K , d ) / ( F z K ) . (29) The voltage-dependent conductances were modeled using the Hodkin-Huxley formalism with differential equations for the gating variables: d x d t = α x ( 1 - x ) - β x x , with x = m , h , n , s , c , q , (30) d z d t = z ∞ - z τ z . (31) The conductances and gating variables were given by: g Na = g ¯ Na m ∞ 2 h , (32) g DR = g ¯ DR n , (33) g Ca = g ¯ Ca s 2 z , (34) g C = g ¯ C c χ ( [ Ca 2 + ] ) , (35) g AHP = g ¯ AHP q , (36) α m = - 3 . 2 · 10 5 · ϕ 1 exp ( - ϕ 1 / 0 . 004 ) - 1 , with ϕ 1 = ϕ m + 0 . 0469 (37) β m = 2 . 8 · 10 5 · ϕ 2 exp ( ϕ 2 / 0 . 005 ) - 1 , with ϕ 2 = ϕ m + 0 . 0199 (38) m ∞ = α m α m + β m (39) α h = 128 exp - 0 . 043 - ϕ m 0 . 018 , (40) β h = 4000 1 + exp ( - ϕ 3 / 0 . 005 ) , with ϕ 3 = ϕ m + 0 . 02 (41) α n = - 1 . 6 · 10 4 · ϕ 4 exp ( - ϕ 4 / 0 . 005 ) - 1 , with ϕ 4 = ϕ m + 0 . 0249 (42) β n = 250 exp ( - ϕ 5 / 0 . 04 ) , with ϕ 5 = ϕ m + 0 . 04 (43) α s = 1600 1 + exp ( - 72 ( ϕ m - 0 . 005 ) ) , (44) β s = 2 · 10 4 · ϕ 6 exp ( ϕ 6 / 0 . 005 ) - 1 , with ϕ 6 = ϕ m + 0 . 0089 (45) z ∞ = 1 1 + exp ( ϕ 7 / 0 . 001 ) , with ϕ 7 = ϕ m + 0 . 03 (46) τ z = 1 , (47) α c = { 52 . 7 exp ( ϕ 8 0 . 011 - ϕ 9 0 . 027 ) , if ϕ m ≤ - 0 . 01 V 2000 exp ( - ϕ 9 / 0 . 027 ) , otherwise (48) with ϕ 8 = ϕ m + 0 . 05 and ϕ 9 = ϕ m + 0 . 0535 (49) β c = { 2000 exp ( - ϕ 9 / 0 . 027 ) - α c , if ϕ m ≤ - 0 . 01 V 0 , otherwise (50) χ = min ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 2 . 5 · 10 - 4 , 1 ) , (51) α q = min ( 2 · 10 4 ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 ) , 10 ) , (52) β q = 1 . (53) All these equations were taken from  (with errata ) and converted so that values are given in SI units: units for rates ( α ’s, β ’s) are 1/s, unit for τ z is s, and units for voltages ϕ are V. The equations were used in their original form, except those related to Ca 2+ dynamics, where we made the following changes: Firstly, as a large fraction of intracellular Ca 2+ is buffered or taken up by the ER, we multiplied [Ca 2+ ] in Eqs and by a factor γ Ca , which refers to the fraction of free Ca 2+ within the cell, and set this to be 0.01. As [Ca 2+ ] in Eqs and were multiplied with 0.01, only the free Ca 2+ could affect the Ca 2+ activated ion channels. We further assumed that only the free Ca 2+ could move between the intracellular compartments  and affect the Ca 2+ reversal potential . Secondly, the original PR model had an abstract and unitless variable for the intracellular Ca 2+ concentration, with a basal concentration of 0.2, while we defined a (biophysically realistic) baseline concentration of 0.01 mM, which corresponds to a concentration of free Ca 2+ of 100 nM. In Eqs and we therefore subtracted 99.8⋅10 −6 (mol/m 3 ) from the Ca 2+ concentration to correct for the shift in baseline. Thirdly, we modified the voltage-dependent Ca 2+ current to include an inactivation variable z (Eqs and ). We implemented this inactivation like they did in  (Eqs A2-A3), but set the time constant to 1 s, the half-activation voltage to -30 mV, and the slope of the steady-state Boltzmann fit to z ∞ to 0.001. In the original PR model, inactivation was neglected due to the argument that it was too slow to have an impact on simulation outcomes . However, in our simulations, we observed that it had a significant impact, and therefore we included it. Homeostatic mechanisms To maintain baseline ion concentrations for low frequency activity we added 3Na + /2K + pumps, K + /Cl − cotransporters (KCC2), and Na + /K + /2Cl − cotransporters (NKCC1). Their functional forms were taken from . j pump = ρ 1 . 0 + exp ( ( 25 - [ Na + ] i ) / 3 ) · 1 . 0 1 . 0 + exp ( 3 . 5 - [ K + ] e ) , (54) j kcc 2 = U kcc 2 ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) , (55) j nkcc 1 = U nkcc 1 f ( [ K + ] e ) ( ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) + ln ( [ Na + ] i [ Cl - ] i [ Na + ] e [ Cl - ] e ) ) , (56) f ( [ K + ] e ) = 1 1 + exp ( 16 - [ K + ] e ) , (57) where ρ , U kcc2 , and U nkcc1 are pump and cotransporter strengths. We assumed optimal pump functionality and set ρ to be the pump strength used in  for the fully oxygenated state with normal bath potassium ( ρ max ). Intracellular Ca 2+ decay was modeled in a similar fashion as in , but to ensure ion conservation we modeled it as an electroneutral Ca 2+ /2Na + exchanger, exchanging one Ca 2+ (outward) for two Na + (inward). Putatively, this phenomenological model for the decay could represent the joint effect of several mechanisms in a real system, such as the Ca 2+ /3Na + exchanger, a Ca 2+ leakage current, SERCA pumps, etc. The decay flux density was defined as: j Ca - dec = U Ca - dec ( [ Ca 2 + ] i - [ Ca 2 + ] i , b ) · V i A m (58) where U Ca−dec is the decay rate, and [Ca 2+ ] i,b is the basal Ca 2+ concentration, set to 0.01 mM. Model summary We summarize the model here for easy reference. In short, we solved four differential equations for all ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (59) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (60) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (61) d [ k ] de d t = + j k , dm · A d V se + j k , e · A e V de . (62) At each time step, ϕ in all four compartments was derived algebraically: ϕ de = 0 , (63) ϕ di = Q di / ( c m A d ) (64) ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (65) ϕ si = Q si c m A s + ϕ se . (66) The total membrane flux densities were as follows: j Na , sm = j Na + j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (67) j K , sm = j K - DR + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (68) j Cl , sm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (69) j Ca , sm = j Ca - dec , (70) j Na , dm = j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (71) j K , dm = j K - AHP + j K - C + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (72) j Cl , dm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (73) j Ca , dm = j Ca + j Ca - dec . (74) summarizes the model. The parameters involved in this model and their values used in this study are listed in Tables – . Original Pinsky-Rinzel model We implemented the original Pinsky-Rinzel equations from Box 8.1 in . The reversal potential of the leak current, not specified in , was set to -68 mV to ensure a resting potential close to that of the edPR model. We also used this as the initial potentials, that is, ϕ sm,0 = −68mV and ϕ dm,0 = −68mV. The other initial conditions were n 0 = 0.001, h 0 = 0.999, s 0 = 0.009, c 0 = 0.007, q 0 = 0.01, and [Ca 2+ ] 0 = 0.2, same as in . Simulations Parameterizations The parameters listed in Tables – were used in all the simulations of the electrodiffusive Pinsky-Rinzel (edPR) model. We tuned the Ca 2+ conductance g ¯ Ca manually to obtain comparable spike shapes between the edPR model and the original PR model, as well as the fraction of free Ca 2+ inside the cell, and the coupling strength between the soma and the dendrite. In the edPR model, the coupling strength between the soma and dendrite was proportional to the ratio A i /Δx, and all model outputs depended on this ratio, and not on A i or Δ x in isolation. By choice, we adjusted the coupling strength by varying A i = αA m through adjusting the parameter α . We could have obtained the equivalent effect by varying Δ x instead. The default value of α was set to 2. All simulations were run using this value, except in where α was set to 0.43. In the original PR model, the coupling strength between the soma and dendrite was represented by a coupling conductance g c , which had a default value of 10.5mS/cm 2 . In , g c was set to 2.26mS/cm 2 . Initial conditions The initial conditions for the edPR model were obtained through a two-step procedure. In the first step, we specified a set of pre-calibration initial values: We set (i) the initial membrane potential, ϕ m,0 , to -68 mV, (ii) the concentrations to the pre-calibrated values in , and (iii) the gating variables  to the same initial values as in . Based on the initial concentration values, we also defined (iv) a set of static intracellular and extracellular residual charges, representing negatively charged macromolecules present in real neurons. We represented these as constant concentrations ([ X − ] i,0 and [ X − ] e,0 ) of anions with charge number z X = −1 (assuming this to be the mean charge number of the real macromolecules) and diffusion constants D X = 0 (assuming immobility). The residual charges were introduced to ensure consistency between the initial membrane potential and the charge density associated with the initial ion concentrations: [ X - ] i , 0 = z Na [ Na + ] i , 0 + z K [ K + ] i , 0 + z Cl [ Cl - ] i , 0 + z Ca [ Ca 2 + ] i , 0 - ϕ m , 0 c m A m V i F , (75) [ X - ] e , 0 = z Na [ Na + ] e , 0 + z K [ K + ] e , 0 + z Cl [ Cl - ] e , 0 + z Ca [ Ca 2 + ] e , 0 + ϕ m , 0 c m A m V e F . (76) In the next step, we calibrated the model by running it for 1800 s to obtain the post-calibrated values of all the state variables . These post-calibrated values were written to file and used as initial conditions in all simulations shown throughout this paper. For technical reasons, we did not read the constant residual concentrations, [ X − ] i,0 and [ X − ] e,0 , to/from file, but re-calculated them from Eqs and in the beginning of each simulation to minimize rounding errors and ensure strict electroneutrality. While the pre-calibrated initial conditions were identical in the somatic and dendritic compartment, the post-calibration values were not strictly identical, but identical up to the decimal place included in . Hence, the indicated values apply for both the soma and dendrite compartments. The post-calibrated values of the ion concentrations gave us the following reversal potentials: E Na = 57mV, E K = −84mV, E Cl = −79mV, and E Ca = 124mV. The pre-calibration values for the ion concentrations were taken from Table 2.1 in , which lists the ranges of typical intra- and extracellular concentrations in mammalian neurons. From the ranges given in this table, we selected values that made the edPR model (throughout the calibration period) reside close to the selected initial membrane potential of -68 mV, a typical value found for CA3 pyramidal cells in adult rats . Stimulus current We stimulated the cell by injecting a K + current i stim into the soma. Previous computational modeling of a cardiac cell has shown that stimulus with K + causes the least physiological disruption . To ensure ion conservation, we removed the same amount of K + ions from the corresponding extracellular compartment: d [ K + ] si d t + = i stim F z K V si , (77) d [ K + ] se d t - = i stim F z K V se . (78) Analysis : To calculate the accumulative transport of ion species k in the intracellular solution (from time zero to t ) due to diffusion, we integrated A i N A j k,diff,i from time zero to t, where N A is the Avogadro constant. Similarly, we integrated A e N A j k,diff,e to calculate the accumulative transport of ions in the extracellular solution due to diffusion. We did the same calculations with j k,drift to study the accumulative transport of ions due to drift. When knowing the accumulative transport of each ion species, k akkum , we calculated the total transport of e + from their weighted sum: e akkum + = z Na Na akkum + + z K K akkum + + z Cl Cl akkum - + z Ca Ca akkum 2 + . (79) : To calculate ϕ VC,e and ϕ diff,e , we looked at the extracellular axial current as it is given in the KNP formalism: i e = i diff , e + i field , e = i diff , e + σ e ϕ se Δ x , (80) where the last equality follows when we insert for the extracellular field-driven current density i field,e , and use that ϕ de = 0. As in , we may split ϕ se into two components: ϕ se = ϕ VC , se + ϕ diff , se , (81) where ϕ VC,se is the potential as it would be predicted from standard volume conductor (VC) theory , and ϕ diff,se is the additional contribution from diffusion . With this, can be written: i e = i diff , e + σ e ϕ VC , se Δ x + σ e ϕ diff , se Δ x . (82) We may split this into two equations if we recognize that i e = σ e ϕ VC , se Δ x , (83) is the standard formula used in VC theory, which is based on the assumption that the extracellular current is exclusively due to a drop in the extracellular VC-potential ϕ VC,se . The remainder of then leaves us with i diff , e = - σ e ϕ diff , se Δ x . (84) Since we already knew i e and i diff,e from simulations with the KNP framework, we used Eqs and to calculate ϕ VC,se and ϕ diff,se separately. Numerical implementation We implemented the differential equations in Python 3.6 and solved them using the solve_ivp function from SciPy. We used its default Runge-Kutta method of order 5(4), and set the maximal allowed step size to 10 −4 . The code is made available at https://github.com/CINPLA/EDPRmodel and https://github.com/CINPLA/EDPRmodel_analysis . 

In the following section, we derive the KNP continuity equations for a one-dimensional system containing two plus two compartments , with sealed boundary conditions (i.e., no ions can enter or leave the system). The geometrical parameters used in the edPR model were as defined in . Since typical neuronal/extracellular/glial volume fractions in neuronal tissue are 0.4/0.2/0.4 , we let the extracellular space be half as voluminous as the intracellular neuronal space. Two kinds of fluxes are involved: transmembrane fluxes and intra- and extracellular fluxes. The framework is general to the choice of the transmembrane fluxes. A transmembrane flux of ion species k ( j k,m ) represents the sum of all fluxes through all membrane mechanisms that allow ion k to cross the membrane. Intracellular flux densities are described by the Nernst-Planck equation: j k , i = - D k λ i 2 γ k ( [ k ] di - [ k ] si ) Δ x - D k z k F λ i 2 R T [ k ] ¯ i ϕ di - ϕ si Δ x . (1) In , D k is the diffusion constant, γ k is the fraction of freely moving ions, that is, ions that are not buffered or taken up by the ER, λ i is the tortuosity, which represents the slowing down of diffusion due to obstacles, γ k ([k] di −[k] si )/Δx is the axial concentration gradient, z k is the charge number of ion species k, F is the Faraday constant, R is the gas constant, T is the absolute temperature, [ k ] ¯ i is the average concentration, that is, γ k ([k] di + [k] si )/2, and ( ϕ di − ϕ si )/Δx is the axial potential gradient. Similarly, the extracellular flux densities are described by j k , e = - D k λ e 2 [ k ] de - [ k ] se Δ x - D k z k F λ e 2 R T [ k ] ¯ e ϕ de - ϕ se Δ x . (2) In , we do not include γ k , as all ions can move freely in the extracellular space. Diffusion constants, tortuosities, and intracellular fractions of freely moving ions used in the edPR model were as in . Ion conservation The KNP framework is based on the constraint of ion conservation. To keep track of ion concentrations we solve four differential equations for each ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (3) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (4) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (5) d [ k ] de d t = + j k , dm · A d V de + j k , e · A e V de . (6) For each compartment, all flux densities are multiplied by the area they go through and divided by the volume they enter to calculate the change in ion concentration. If we insert the Nernst-Planck equation  for the intracellular flux density, the first of these equations becomes: d [ k ] si d t = - j k , sm · A s V si + A i D k V si λ i 2 Δ x [ γ k ( [ k ] di - [ k ] si ) + z k F R T [ k ] ¯ i ( ϕ di - ϕ si ) ] , (7) where the voltage variables so far are undefined. Four constraints to derive ϕ If we have four ion species (Na + , K + , Cl − , and Ca 2+ ) in four compartments, we have 20 unknown parameters (16 for [k] and four for ϕ ), while Eqs – for four ion species give us only 16 equations. To solve this, we need to define additional constraints that allow us to express the potentials ϕ in terms of ion concentrations. As we may define an arbitrary reference point for ϕ , we take ϕ de = 0 , (8) as our first constraint, i.e., (i) the potential outside the dendrite is defined to be zero. The second constraint is that (ii) the membrane is a parallel plate capacitor that always separates a charge Q on one side from an opposite charge − Q on the other side, giving rise to a voltage difference ϕ m = Q / C m . (9) Here, C m is the total capacitance of the membrane, i.e., C m = c m A m , where c m is the more commonly used capacitance per membrane area. As, by definition, ϕ m = ϕ i − ϕ e , we get: ϕ dm = ϕ di = Q di / C m , (10) in the dendrite (since ϕ de = 0), and ϕ sm = ϕ si - ϕ se = Q si / C m , (11) in the soma. The third constraint is that (iii) we assume bulk electroneutrality. This means that the net charge associated with the ion concentrations in a given compartment by constraint must be identical to the membrane charge in this compartment. The intracellular dendritic charge is thus Q di = F ∑ k z k [ k ] di V di . By inserting this into , we obtain the final expression for ϕ di : ϕ di = ( F ∑ k z k [ k ] di V di ) / ( c m A d ) . (12) By inserting the equivalent expression for Q si into , we get ϕ si - ϕ se = Q si / C m = ( F ∑ k z k [ k ] si V si ) / ( c m A s ) . (13) Here, the extracellular potential is not set to zero, so we need a fourth constraint to determine ϕ si and ϕ se separately. The fourth and final constraint is that (iv) we must ensure charge anti-symmetry. For the charge anti-symmetry between the two sides of the capacitive membrane ( Q i = − Q e ) to be preserved in time, we must define our initial conditions so that this is the case at t = 0, and the system dynamics so that this stays the case. Hence, the system dynamics must ensure that dQ di / dt = − dQ de / dt and dQ si / dt = − dQ se / dt . The membrane currents (in isolation) will always fulfill this criterion, as any charge that crosses the membrane by definition disappears from one side of it and pops up at the other. Hence, we thus need to make sure that also the axial currents (in isolation) fulfill the criterion. The system must thus be constrained so that, if an extracellular current transports a charge δq into a given extracellular compartment, the intracellular current must transport the opposite charge − δq into the adjoint intracellular compartment. That is, we must have that: A i i i = - A e i e , (14) where i i and i e are the intra- and extracellular current densities, respectively. To find an expression for these, we multiply Eqs and by Fz k and sum over all ion species k. The expressions for the intra- and extracellular current densities then become: i i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) - F 2 R T λ i 2 Δ x ∑ k D k z k 2 [ k ] ¯ i ( ϕ di - ϕ si ) , (15) i e = - F λ e 2 Δ x ∑ k D k z k ( [ k ] de - [ k ] se ) - F 2 R T λ e 2 Δ x ∑ k D k z k 2 [ k ] ¯ e ( ϕ de - ϕ se ) . (16) In , the first term is the diffusion current density: i diff , i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) , (17) which is defined by the ion concentrations. The second term is the field driven current density i field , i = - σ i ( ϕ di - ϕ si ) Δ x , (18) where we have identified the conductivity as σ i = F 2 R T λ i 2 ∑ k D k z k 2 [ k ] ¯ i . (19) Similarly, can be written in terms of i diff,e , i field,e , and σ e . By combining Eqs , and , we obtain: - A i i diff , i + A i σ i · ( ϕ di - ϕ si ) Δ x = A e i diff , e - A e σ e · ( ϕ de - ϕ se ) Δ x . (20) In , ϕ di and ϕ de are already known from Eqs and , while i diff and σ are expressed in terms of ion concentrations. We may thus solve Eqs and for the last two voltage variables ϕ se and ϕ si : ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (21) ϕ si = Q si c m A s + ϕ se . (22) 

The KNP framework is based on the constraint of ion conservation. To keep track of ion concentrations we solve four differential equations for each ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (3) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (4) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (5) d [ k ] de d t = + j k , dm · A d V de + j k , e · A e V de . (6) For each compartment, all flux densities are multiplied by the area they go through and divided by the volume they enter to calculate the change in ion concentration. If we insert the Nernst-Planck equation  for the intracellular flux density, the first of these equations becomes: d [ k ] si d t = - j k , sm · A s V si + A i D k V si λ i 2 Δ x [ γ k ( [ k ] di - [ k ] si ) + z k F R T [ k ] ¯ i ( ϕ di - ϕ si ) ] , (7) where the voltage variables so far are undefined. 

ϕ If we have four ion species (Na + , K + , Cl − , and Ca 2+ ) in four compartments, we have 20 unknown parameters (16 for [k] and four for ϕ ), while Eqs – for four ion species give us only 16 equations. To solve this, we need to define additional constraints that allow us to express the potentials ϕ in terms of ion concentrations. As we may define an arbitrary reference point for ϕ , we take ϕ de = 0 , (8) as our first constraint, i.e., (i) the potential outside the dendrite is defined to be zero. The second constraint is that (ii) the membrane is a parallel plate capacitor that always separates a charge Q on one side from an opposite charge − Q on the other side, giving rise to a voltage difference ϕ m = Q / C m . (9) Here, C m is the total capacitance of the membrane, i.e., C m = c m A m , where c m is the more commonly used capacitance per membrane area. As, by definition, ϕ m = ϕ i − ϕ e , we get: ϕ dm = ϕ di = Q di / C m , (10) in the dendrite (since ϕ de = 0), and ϕ sm = ϕ si - ϕ se = Q si / C m , (11) in the soma. The third constraint is that (iii) we assume bulk electroneutrality. This means that the net charge associated with the ion concentrations in a given compartment by constraint must be identical to the membrane charge in this compartment. The intracellular dendritic charge is thus Q di = F ∑ k z k [ k ] di V di . By inserting this into , we obtain the final expression for ϕ di : ϕ di = ( F ∑ k z k [ k ] di V di ) / ( c m A d ) . (12) By inserting the equivalent expression for Q si into , we get ϕ si - ϕ se = Q si / C m = ( F ∑ k z k [ k ] si V si ) / ( c m A s ) . (13) Here, the extracellular potential is not set to zero, so we need a fourth constraint to determine ϕ si and ϕ se separately. The fourth and final constraint is that (iv) we must ensure charge anti-symmetry. For the charge anti-symmetry between the two sides of the capacitive membrane ( Q i = − Q e ) to be preserved in time, we must define our initial conditions so that this is the case at t = 0, and the system dynamics so that this stays the case. Hence, the system dynamics must ensure that dQ di / dt = − dQ de / dt and dQ si / dt = − dQ se / dt . The membrane currents (in isolation) will always fulfill this criterion, as any charge that crosses the membrane by definition disappears from one side of it and pops up at the other. Hence, we thus need to make sure that also the axial currents (in isolation) fulfill the criterion. The system must thus be constrained so that, if an extracellular current transports a charge δq into a given extracellular compartment, the intracellular current must transport the opposite charge − δq into the adjoint intracellular compartment. That is, we must have that: A i i i = - A e i e , (14) where i i and i e are the intra- and extracellular current densities, respectively. To find an expression for these, we multiply Eqs and by Fz k and sum over all ion species k. The expressions for the intra- and extracellular current densities then become: i i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) - F 2 R T λ i 2 Δ x ∑ k D k z k 2 [ k ] ¯ i ( ϕ di - ϕ si ) , (15) i e = - F λ e 2 Δ x ∑ k D k z k ( [ k ] de - [ k ] se ) - F 2 R T λ e 2 Δ x ∑ k D k z k 2 [ k ] ¯ e ( ϕ de - ϕ se ) . (16) In , the first term is the diffusion current density: i diff , i = - F λ i 2 Δ x ∑ k D k z k γ k ( [ k ] di - [ k ] si ) , (17) which is defined by the ion concentrations. The second term is the field driven current density i field , i = - σ i ( ϕ di - ϕ si ) Δ x , (18) where we have identified the conductivity as σ i = F 2 R T λ i 2 ∑ k D k z k 2 [ k ] ¯ i . (19) Similarly, can be written in terms of i diff,e , i field,e , and σ e . By combining Eqs , and , we obtain: - A i i diff , i + A i σ i · ( ϕ di - ϕ si ) Δ x = A e i diff , e - A e σ e · ( ϕ de - ϕ se ) Δ x . (20) In , ϕ di and ϕ de are already known from Eqs and , while i diff and σ are expressed in terms of ion concentrations. We may thus solve Eqs and for the last two voltage variables ϕ se and ϕ si : ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (21) ϕ si = Q si c m A s + ϕ se . (22) 

Leakage channels In the original PR model, the membrane leak current represents the combined contribution from all ion species. When using the KNP framework, on the other hand, where we keep track of all ions separately, the leak current must be ion-specific. We modeled this as in , that is, for each ion species k, we implemented a passive flux density across the membrane j k , leak = g ¯ k , leak ( ϕ m - E k ) / ( F z k ) , (23) where g ¯ k , leak is the ion conductance, ϕ m is the membrane potential, E k is the reversal potential, F is the Faraday constant, and z k is the charge number. The reversal potential is a function of ion concentrations, and is calculated using the Nernst equation: E k = R T z k F ln [ k ] e γ k [ k ] i . (24) Here, R is the gas constant, T is the absolute temperature, γ k is the intracellular fraction of free ions, and [k] e and [k] i are the concentrations of ion k outside and inside the cell, respectively. We included Na + , K + , and Cl − leak currents in both compartments. Active ion channels All active ion channel currents were adopted from the original PR model , as they were described in , and converted to ion channel fluxes. The soma compartment contained a Na + flux ( j Na ) and a K + delayed rectifier flux ( j K−DR ), while the dendrite contained a voltage-dependent Ca 2+ flux ( j Ca ), a voltage-dependent K + AHP flux ( j K−AHP ), and a Ca 2+ -dependent K + flux ( j K−C ): j Na = g Na ( ϕ sm - E Na , s ) / ( F z Na ) , (25) j K - DR = g DR ( ϕ sm - E K , s ) / ( F z K ) , (26) j Ca = g Ca ( ϕ dm - E Ca , d ) / ( F z Ca ) , (27) j K - AHP = g AHP ( ϕ dm - E K , d ) / ( F z K ) , (28) j K - C = g C ( ϕ dm - E K , d ) / ( F z K ) . (29) The voltage-dependent conductances were modeled using the Hodkin-Huxley formalism with differential equations for the gating variables: d x d t = α x ( 1 - x ) - β x x , with x = m , h , n , s , c , q , (30) d z d t = z ∞ - z τ z . (31) The conductances and gating variables were given by: g Na = g ¯ Na m ∞ 2 h , (32) g DR = g ¯ DR n , (33) g Ca = g ¯ Ca s 2 z , (34) g C = g ¯ C c χ ( [ Ca 2 + ] ) , (35) g AHP = g ¯ AHP q , (36) α m = - 3 . 2 · 10 5 · ϕ 1 exp ( - ϕ 1 / 0 . 004 ) - 1 , with ϕ 1 = ϕ m + 0 . 0469 (37) β m = 2 . 8 · 10 5 · ϕ 2 exp ( ϕ 2 / 0 . 005 ) - 1 , with ϕ 2 = ϕ m + 0 . 0199 (38) m ∞ = α m α m + β m (39) α h = 128 exp - 0 . 043 - ϕ m 0 . 018 , (40) β h = 4000 1 + exp ( - ϕ 3 / 0 . 005 ) , with ϕ 3 = ϕ m + 0 . 02 (41) α n = - 1 . 6 · 10 4 · ϕ 4 exp ( - ϕ 4 / 0 . 005 ) - 1 , with ϕ 4 = ϕ m + 0 . 0249 (42) β n = 250 exp ( - ϕ 5 / 0 . 04 ) , with ϕ 5 = ϕ m + 0 . 04 (43) α s = 1600 1 + exp ( - 72 ( ϕ m - 0 . 005 ) ) , (44) β s = 2 · 10 4 · ϕ 6 exp ( ϕ 6 / 0 . 005 ) - 1 , with ϕ 6 = ϕ m + 0 . 0089 (45) z ∞ = 1 1 + exp ( ϕ 7 / 0 . 001 ) , with ϕ 7 = ϕ m + 0 . 03 (46) τ z = 1 , (47) α c = { 52 . 7 exp ( ϕ 8 0 . 011 - ϕ 9 0 . 027 ) , if ϕ m ≤ - 0 . 01 V 2000 exp ( - ϕ 9 / 0 . 027 ) , otherwise (48) with ϕ 8 = ϕ m + 0 . 05 and ϕ 9 = ϕ m + 0 . 0535 (49) β c = { 2000 exp ( - ϕ 9 / 0 . 027 ) - α c , if ϕ m ≤ - 0 . 01 V 0 , otherwise (50) χ = min ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 2 . 5 · 10 - 4 , 1 ) , (51) α q = min ( 2 · 10 4 ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 ) , 10 ) , (52) β q = 1 . (53) All these equations were taken from  (with errata ) and converted so that values are given in SI units: units for rates ( α ’s, β ’s) are 1/s, unit for τ z is s, and units for voltages ϕ are V. The equations were used in their original form, except those related to Ca 2+ dynamics, where we made the following changes: Firstly, as a large fraction of intracellular Ca 2+ is buffered or taken up by the ER, we multiplied [Ca 2+ ] in Eqs and by a factor γ Ca , which refers to the fraction of free Ca 2+ within the cell, and set this to be 0.01. As [Ca 2+ ] in Eqs and were multiplied with 0.01, only the free Ca 2+ could affect the Ca 2+ activated ion channels. We further assumed that only the free Ca 2+ could move between the intracellular compartments  and affect the Ca 2+ reversal potential . Secondly, the original PR model had an abstract and unitless variable for the intracellular Ca 2+ concentration, with a basal concentration of 0.2, while we defined a (biophysically realistic) baseline concentration of 0.01 mM, which corresponds to a concentration of free Ca 2+ of 100 nM. In Eqs and we therefore subtracted 99.8⋅10 −6 (mol/m 3 ) from the Ca 2+ concentration to correct for the shift in baseline. Thirdly, we modified the voltage-dependent Ca 2+ current to include an inactivation variable z (Eqs and ). We implemented this inactivation like they did in  (Eqs A2-A3), but set the time constant to 1 s, the half-activation voltage to -30 mV, and the slope of the steady-state Boltzmann fit to z ∞ to 0.001. In the original PR model, inactivation was neglected due to the argument that it was too slow to have an impact on simulation outcomes . However, in our simulations, we observed that it had a significant impact, and therefore we included it. Homeostatic mechanisms To maintain baseline ion concentrations for low frequency activity we added 3Na + /2K + pumps, K + /Cl − cotransporters (KCC2), and Na + /K + /2Cl − cotransporters (NKCC1). Their functional forms were taken from . j pump = ρ 1 . 0 + exp ( ( 25 - [ Na + ] i ) / 3 ) · 1 . 0 1 . 0 + exp ( 3 . 5 - [ K + ] e ) , (54) j kcc 2 = U kcc 2 ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) , (55) j nkcc 1 = U nkcc 1 f ( [ K + ] e ) ( ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) + ln ( [ Na + ] i [ Cl - ] i [ Na + ] e [ Cl - ] e ) ) , (56) f ( [ K + ] e ) = 1 1 + exp ( 16 - [ K + ] e ) , (57) where ρ , U kcc2 , and U nkcc1 are pump and cotransporter strengths. We assumed optimal pump functionality and set ρ to be the pump strength used in  for the fully oxygenated state with normal bath potassium ( ρ max ). Intracellular Ca 2+ decay was modeled in a similar fashion as in , but to ensure ion conservation we modeled it as an electroneutral Ca 2+ /2Na + exchanger, exchanging one Ca 2+ (outward) for two Na + (inward). Putatively, this phenomenological model for the decay could represent the joint effect of several mechanisms in a real system, such as the Ca 2+ /3Na + exchanger, a Ca 2+ leakage current, SERCA pumps, etc. The decay flux density was defined as: j Ca - dec = U Ca - dec ( [ Ca 2 + ] i - [ Ca 2 + ] i , b ) · V i A m (58) where U Ca−dec is the decay rate, and [Ca 2+ ] i,b is the basal Ca 2+ concentration, set to 0.01 mM. Model summary We summarize the model here for easy reference. In short, we solved four differential equations for all ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (59) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (60) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (61) d [ k ] de d t = + j k , dm · A d V se + j k , e · A e V de . (62) At each time step, ϕ in all four compartments was derived algebraically: ϕ de = 0 , (63) ϕ di = Q di / ( c m A d ) (64) ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (65) ϕ si = Q si c m A s + ϕ se . (66) The total membrane flux densities were as follows: j Na , sm = j Na + j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (67) j K , sm = j K - DR + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (68) j Cl , sm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (69) j Ca , sm = j Ca - dec , (70) j Na , dm = j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (71) j K , dm = j K - AHP + j K - C + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (72) j Cl , dm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (73) j Ca , dm = j Ca + j Ca - dec . (74) summarizes the model. The parameters involved in this model and their values used in this study are listed in Tables – . 

In the original PR model, the membrane leak current represents the combined contribution from all ion species. When using the KNP framework, on the other hand, where we keep track of all ions separately, the leak current must be ion-specific. We modeled this as in , that is, for each ion species k, we implemented a passive flux density across the membrane j k , leak = g ¯ k , leak ( ϕ m - E k ) / ( F z k ) , (23) where g ¯ k , leak is the ion conductance, ϕ m is the membrane potential, E k is the reversal potential, F is the Faraday constant, and z k is the charge number. The reversal potential is a function of ion concentrations, and is calculated using the Nernst equation: E k = R T z k F ln [ k ] e γ k [ k ] i . (24) Here, R is the gas constant, T is the absolute temperature, γ k is the intracellular fraction of free ions, and [k] e and [k] i are the concentrations of ion k outside and inside the cell, respectively. We included Na + , K + , and Cl − leak currents in both compartments. 

All active ion channel currents were adopted from the original PR model , as they were described in , and converted to ion channel fluxes. The soma compartment contained a Na + flux ( j Na ) and a K + delayed rectifier flux ( j K−DR ), while the dendrite contained a voltage-dependent Ca 2+ flux ( j Ca ), a voltage-dependent K + AHP flux ( j K−AHP ), and a Ca 2+ -dependent K + flux ( j K−C ): j Na = g Na ( ϕ sm - E Na , s ) / ( F z Na ) , (25) j K - DR = g DR ( ϕ sm - E K , s ) / ( F z K ) , (26) j Ca = g Ca ( ϕ dm - E Ca , d ) / ( F z Ca ) , (27) j K - AHP = g AHP ( ϕ dm - E K , d ) / ( F z K ) , (28) j K - C = g C ( ϕ dm - E K , d ) / ( F z K ) . (29) The voltage-dependent conductances were modeled using the Hodkin-Huxley formalism with differential equations for the gating variables: d x d t = α x ( 1 - x ) - β x x , with x = m , h , n , s , c , q , (30) d z d t = z ∞ - z τ z . (31) The conductances and gating variables were given by: g Na = g ¯ Na m ∞ 2 h , (32) g DR = g ¯ DR n , (33) g Ca = g ¯ Ca s 2 z , (34) g C = g ¯ C c χ ( [ Ca 2 + ] ) , (35) g AHP = g ¯ AHP q , (36) α m = - 3 . 2 · 10 5 · ϕ 1 exp ( - ϕ 1 / 0 . 004 ) - 1 , with ϕ 1 = ϕ m + 0 . 0469 (37) β m = 2 . 8 · 10 5 · ϕ 2 exp ( ϕ 2 / 0 . 005 ) - 1 , with ϕ 2 = ϕ m + 0 . 0199 (38) m ∞ = α m α m + β m (39) α h = 128 exp - 0 . 043 - ϕ m 0 . 018 , (40) β h = 4000 1 + exp ( - ϕ 3 / 0 . 005 ) , with ϕ 3 = ϕ m + 0 . 02 (41) α n = - 1 . 6 · 10 4 · ϕ 4 exp ( - ϕ 4 / 0 . 005 ) - 1 , with ϕ 4 = ϕ m + 0 . 0249 (42) β n = 250 exp ( - ϕ 5 / 0 . 04 ) , with ϕ 5 = ϕ m + 0 . 04 (43) α s = 1600 1 + exp ( - 72 ( ϕ m - 0 . 005 ) ) , (44) β s = 2 · 10 4 · ϕ 6 exp ( ϕ 6 / 0 . 005 ) - 1 , with ϕ 6 = ϕ m + 0 . 0089 (45) z ∞ = 1 1 + exp ( ϕ 7 / 0 . 001 ) , with ϕ 7 = ϕ m + 0 . 03 (46) τ z = 1 , (47) α c = { 52 . 7 exp ( ϕ 8 0 . 011 - ϕ 9 0 . 027 ) , if ϕ m ≤ - 0 . 01 V 2000 exp ( - ϕ 9 / 0 . 027 ) , otherwise (48) with ϕ 8 = ϕ m + 0 . 05 and ϕ 9 = ϕ m + 0 . 0535 (49) β c = { 2000 exp ( - ϕ 9 / 0 . 027 ) - α c , if ϕ m ≤ - 0 . 01 V 0 , otherwise (50) χ = min ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 2 . 5 · 10 - 4 , 1 ) , (51) α q = min ( 2 · 10 4 ( γ Ca [ Ca 2 + ] - 99 . 8 · 10 - 6 ) , 10 ) , (52) β q = 1 . (53) All these equations were taken from  (with errata ) and converted so that values are given in SI units: units for rates ( α ’s, β ’s) are 1/s, unit for τ z is s, and units for voltages ϕ are V. The equations were used in their original form, except those related to Ca 2+ dynamics, where we made the following changes: Firstly, as a large fraction of intracellular Ca 2+ is buffered or taken up by the ER, we multiplied [Ca 2+ ] in Eqs and by a factor γ Ca , which refers to the fraction of free Ca 2+ within the cell, and set this to be 0.01. As [Ca 2+ ] in Eqs and were multiplied with 0.01, only the free Ca 2+ could affect the Ca 2+ activated ion channels. We further assumed that only the free Ca 2+ could move between the intracellular compartments  and affect the Ca 2+ reversal potential . Secondly, the original PR model had an abstract and unitless variable for the intracellular Ca 2+ concentration, with a basal concentration of 0.2, while we defined a (biophysically realistic) baseline concentration of 0.01 mM, which corresponds to a concentration of free Ca 2+ of 100 nM. In Eqs and we therefore subtracted 99.8⋅10 −6 (mol/m 3 ) from the Ca 2+ concentration to correct for the shift in baseline. Thirdly, we modified the voltage-dependent Ca 2+ current to include an inactivation variable z (Eqs and ). We implemented this inactivation like they did in  (Eqs A2-A3), but set the time constant to 1 s, the half-activation voltage to -30 mV, and the slope of the steady-state Boltzmann fit to z ∞ to 0.001. In the original PR model, inactivation was neglected due to the argument that it was too slow to have an impact on simulation outcomes . However, in our simulations, we observed that it had a significant impact, and therefore we included it. 

To maintain baseline ion concentrations for low frequency activity we added 3Na + /2K + pumps, K + /Cl − cotransporters (KCC2), and Na + /K + /2Cl − cotransporters (NKCC1). Their functional forms were taken from . j pump = ρ 1 . 0 + exp ( ( 25 - [ Na + ] i ) / 3 ) · 1 . 0 1 . 0 + exp ( 3 . 5 - [ K + ] e ) , (54) j kcc 2 = U kcc 2 ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) , (55) j nkcc 1 = U nkcc 1 f ( [ K + ] e ) ( ln ( [ K + ] i [ Cl - ] i [ K + ] e [ Cl - ] e ) + ln ( [ Na + ] i [ Cl - ] i [ Na + ] e [ Cl - ] e ) ) , (56) f ( [ K + ] e ) = 1 1 + exp ( 16 - [ K + ] e ) , (57) where ρ , U kcc2 , and U nkcc1 are pump and cotransporter strengths. We assumed optimal pump functionality and set ρ to be the pump strength used in  for the fully oxygenated state with normal bath potassium ( ρ max ). Intracellular Ca 2+ decay was modeled in a similar fashion as in , but to ensure ion conservation we modeled it as an electroneutral Ca 2+ /2Na + exchanger, exchanging one Ca 2+ (outward) for two Na + (inward). Putatively, this phenomenological model for the decay could represent the joint effect of several mechanisms in a real system, such as the Ca 2+ /3Na + exchanger, a Ca 2+ leakage current, SERCA pumps, etc. The decay flux density was defined as: j Ca - dec = U Ca - dec ( [ Ca 2 + ] i - [ Ca 2 + ] i , b ) · V i A m (58) where U Ca−dec is the decay rate, and [Ca 2+ ] i,b is the basal Ca 2+ concentration, set to 0.01 mM. 

We summarize the model here for easy reference. In short, we solved four differential equations for all ion species k: d [ k ] si d t = - j k , sm · A s V si - j k , i · A i V si , (59) d [ k ] di d t = - j k , dm · A d V di + j k , i · A i V di , (60) d [ k ] se d t = + j k , sm · A s V se - j k , e · A e V se , (61) d [ k ] de d t = + j k , dm · A d V se + j k , e · A e V de . (62) At each time step, ϕ in all four compartments was derived algebraically: ϕ de = 0 , (63) ϕ di = Q di / ( c m A d ) (64) ϕ se = ( ϕ di - Δ x σ i · i diff , i - A e Δ x A i σ i · i diff , e - Q si c m A s ) / ( 1 + A e σ e A i σ i ) , (65) ϕ si = Q si c m A s + ϕ se . (66) The total membrane flux densities were as follows: j Na , sm = j Na + j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (67) j K , sm = j K - DR + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (68) j Cl , sm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (69) j Ca , sm = j Ca - dec , (70) j Na , dm = j Na , leak + 3 j pump + j nkcc 1 - 2 j Ca - dec , (71) j K , dm = j K - AHP + j K - C + j K , leak - 2 j pump + j nkcc 1 + j kcc 2 , (72) j Cl , dm = j Cl , leak + 2 j nkcc 1 + j kcc 2 , (73) j Ca , dm = j Ca + j Ca - dec . (74) summarizes the model. The parameters involved in this model and their values used in this study are listed in Tables – . 

We implemented the original Pinsky-Rinzel equations from Box 8.1 in . The reversal potential of the leak current, not specified in , was set to -68 mV to ensure a resting potential close to that of the edPR model. We also used this as the initial potentials, that is, ϕ sm,0 = −68mV and ϕ dm,0 = −68mV. The other initial conditions were n 0 = 0.001, h 0 = 0.999, s 0 = 0.009, c 0 = 0.007, q 0 = 0.01, and [Ca 2+ ] 0 = 0.2, same as in . 

Parameterizations The parameters listed in Tables – were used in all the simulations of the electrodiffusive Pinsky-Rinzel (edPR) model. We tuned the Ca 2+ conductance g ¯ Ca manually to obtain comparable spike shapes between the edPR model and the original PR model, as well as the fraction of free Ca 2+ inside the cell, and the coupling strength between the soma and the dendrite. In the edPR model, the coupling strength between the soma and dendrite was proportional to the ratio A i /Δx, and all model outputs depended on this ratio, and not on A i or Δ x in isolation. By choice, we adjusted the coupling strength by varying A i = αA m through adjusting the parameter α . We could have obtained the equivalent effect by varying Δ x instead. The default value of α was set to 2. All simulations were run using this value, except in where α was set to 0.43. In the original PR model, the coupling strength between the soma and dendrite was represented by a coupling conductance g c , which had a default value of 10.5mS/cm 2 . In , g c was set to 2.26mS/cm 2 . Initial conditions The initial conditions for the edPR model were obtained through a two-step procedure. In the first step, we specified a set of pre-calibration initial values: We set (i) the initial membrane potential, ϕ m,0 , to -68 mV, (ii) the concentrations to the pre-calibrated values in , and (iii) the gating variables  to the same initial values as in . Based on the initial concentration values, we also defined (iv) a set of static intracellular and extracellular residual charges, representing negatively charged macromolecules present in real neurons. We represented these as constant concentrations ([ X − ] i,0 and [ X − ] e,0 ) of anions with charge number z X = −1 (assuming this to be the mean charge number of the real macromolecules) and diffusion constants D X = 0 (assuming immobility). The residual charges were introduced to ensure consistency between the initial membrane potential and the charge density associated with the initial ion concentrations: [ X - ] i , 0 = z Na [ Na + ] i , 0 + z K [ K + ] i , 0 + z Cl [ Cl - ] i , 0 + z Ca [ Ca 2 + ] i , 0 - ϕ m , 0 c m A m V i F , (75) [ X - ] e , 0 = z Na [ Na + ] e , 0 + z K [ K + ] e , 0 + z Cl [ Cl - ] e , 0 + z Ca [ Ca 2 + ] e , 0 + ϕ m , 0 c m A m V e F . (76) In the next step, we calibrated the model by running it for 1800 s to obtain the post-calibrated values of all the state variables . These post-calibrated values were written to file and used as initial conditions in all simulations shown throughout this paper. For technical reasons, we did not read the constant residual concentrations, [ X − ] i,0 and [ X − ] e,0 , to/from file, but re-calculated them from Eqs and in the beginning of each simulation to minimize rounding errors and ensure strict electroneutrality. While the pre-calibrated initial conditions were identical in the somatic and dendritic compartment, the post-calibration values were not strictly identical, but identical up to the decimal place included in . Hence, the indicated values apply for both the soma and dendrite compartments. The post-calibrated values of the ion concentrations gave us the following reversal potentials: E Na = 57mV, E K = −84mV, E Cl = −79mV, and E Ca = 124mV. The pre-calibration values for the ion concentrations were taken from Table 2.1 in , which lists the ranges of typical intra- and extracellular concentrations in mammalian neurons. From the ranges given in this table, we selected values that made the edPR model (throughout the calibration period) reside close to the selected initial membrane potential of -68 mV, a typical value found for CA3 pyramidal cells in adult rats . Stimulus current We stimulated the cell by injecting a K + current i stim into the soma. Previous computational modeling of a cardiac cell has shown that stimulus with K + causes the least physiological disruption . To ensure ion conservation, we removed the same amount of K + ions from the corresponding extracellular compartment: d [ K + ] si d t + = i stim F z K V si , (77) d [ K + ] se d t - = i stim F z K V se . (78) Analysis : To calculate the accumulative transport of ion species k in the intracellular solution (from time zero to t ) due to diffusion, we integrated A i N A j k,diff,i from time zero to t, where N A is the Avogadro constant. Similarly, we integrated A e N A j k,diff,e to calculate the accumulative transport of ions in the extracellular solution due to diffusion. We did the same calculations with j k,drift to study the accumulative transport of ions due to drift. When knowing the accumulative transport of each ion species, k akkum , we calculated the total transport of e + from their weighted sum: e akkum + = z Na Na akkum + + z K K akkum + + z Cl Cl akkum - + z Ca Ca akkum 2 + . (79) : To calculate ϕ VC,e and ϕ diff,e , we looked at the extracellular axial current as it is given in the KNP formalism: i e = i diff , e + i field , e = i diff , e + σ e ϕ se Δ x , (80) where the last equality follows when we insert for the extracellular field-driven current density i field,e , and use that ϕ de = 0. As in , we may split ϕ se into two components: ϕ se = ϕ VC , se + ϕ diff , se , (81) where ϕ VC,se is the potential as it would be predicted from standard volume conductor (VC) theory , and ϕ diff,se is the additional contribution from diffusion . With this, can be written: i e = i diff , e + σ e ϕ VC , se Δ x + σ e ϕ diff , se Δ x . (82) We may split this into two equations if we recognize that i e = σ e ϕ VC , se Δ x , (83) is the standard formula used in VC theory, which is based on the assumption that the extracellular current is exclusively due to a drop in the extracellular VC-potential ϕ VC,se . The remainder of then leaves us with i diff , e = - σ e ϕ diff , se Δ x . (84) Since we already knew i e and i diff,e from simulations with the KNP framework, we used Eqs and to calculate ϕ VC,se and ϕ diff,se separately. Numerical implementation We implemented the differential equations in Python 3.6 and solved them using the solve_ivp function from SciPy. We used its default Runge-Kutta method of order 5(4), and set the maximal allowed step size to 10 −4 . The code is made available at https://github.com/CINPLA/EDPRmodel and https://github.com/CINPLA/EDPRmodel_analysis . 

The parameters listed in Tables – were used in all the simulations of the electrodiffusive Pinsky-Rinzel (edPR) model. We tuned the Ca 2+ conductance g ¯ Ca manually to obtain comparable spike shapes between the edPR model and the original PR model, as well as the fraction of free Ca 2+ inside the cell, and the coupling strength between the soma and the dendrite. In the edPR model, the coupling strength between the soma and dendrite was proportional to the ratio A i /Δx, and all model outputs depended on this ratio, and not on A i or Δ x in isolation. By choice, we adjusted the coupling strength by varying A i = αA m through adjusting the parameter α . We could have obtained the equivalent effect by varying Δ x instead. The default value of α was set to 2. All simulations were run using this value, except in where α was set to 0.43. In the original PR model, the coupling strength between the soma and dendrite was represented by a coupling conductance g c , which had a default value of 10.5mS/cm 2 . In , g c was set to 2.26mS/cm 2 . 

The initial conditions for the edPR model were obtained through a two-step procedure. In the first step, we specified a set of pre-calibration initial values: We set (i) the initial membrane potential, ϕ m,0 , to -68 mV, (ii) the concentrations to the pre-calibrated values in , and (iii) the gating variables  to the same initial values as in . Based on the initial concentration values, we also defined (iv) a set of static intracellular and extracellular residual charges, representing negatively charged macromolecules present in real neurons. We represented these as constant concentrations ([ X − ] i,0 and [ X − ] e,0 ) of anions with charge number z X = −1 (assuming this to be the mean charge number of the real macromolecules) and diffusion constants D X = 0 (assuming immobility). The residual charges were introduced to ensure consistency between the initial membrane potential and the charge density associated with the initial ion concentrations: [ X - ] i , 0 = z Na [ Na + ] i , 0 + z K [ K + ] i , 0 + z Cl [ Cl - ] i , 0 + z Ca [ Ca 2 + ] i , 0 - ϕ m , 0 c m A m V i F , (75) [ X - ] e , 0 = z Na [ Na + ] e , 0 + z K [ K + ] e , 0 + z Cl [ Cl - ] e , 0 + z Ca [ Ca 2 + ] e , 0 + ϕ m , 0 c m A m V e F . (76) In the next step, we calibrated the model by running it for 1800 s to obtain the post-calibrated values of all the state variables . These post-calibrated values were written to file and used as initial conditions in all simulations shown throughout this paper. For technical reasons, we did not read the constant residual concentrations, [ X − ] i,0 and [ X − ] e,0 , to/from file, but re-calculated them from Eqs and in the beginning of each simulation to minimize rounding errors and ensure strict electroneutrality. While the pre-calibrated initial conditions were identical in the somatic and dendritic compartment, the post-calibration values were not strictly identical, but identical up to the decimal place included in . Hence, the indicated values apply for both the soma and dendrite compartments. The post-calibrated values of the ion concentrations gave us the following reversal potentials: E Na = 57mV, E K = −84mV, E Cl = −79mV, and E Ca = 124mV. The pre-calibration values for the ion concentrations were taken from Table 2.1 in , which lists the ranges of typical intra- and extracellular concentrations in mammalian neurons. From the ranges given in this table, we selected values that made the edPR model (throughout the calibration period) reside close to the selected initial membrane potential of -68 mV, a typical value found for CA3 pyramidal cells in adult rats . 

We stimulated the cell by injecting a K + current i stim into the soma. Previous computational modeling of a cardiac cell has shown that stimulus with K + causes the least physiological disruption . To ensure ion conservation, we removed the same amount of K + ions from the corresponding extracellular compartment: d [ K + ] si d t + = i stim F z K V si , (77) d [ K + ] se d t - = i stim F z K V se . (78) 

: To calculate the accumulative transport of ion species k in the intracellular solution (from time zero to t ) due to diffusion, we integrated A i N A j k,diff,i from time zero to t, where N A is the Avogadro constant. Similarly, we integrated A e N A j k,diff,e to calculate the accumulative transport of ions in the extracellular solution due to diffusion. We did the same calculations with j k,drift to study the accumulative transport of ions due to drift. When knowing the accumulative transport of each ion species, k akkum , we calculated the total transport of e + from their weighted sum: e akkum + = z Na Na akkum + + z K K akkum + + z Cl Cl akkum - + z Ca Ca akkum 2 + . (79) : To calculate ϕ VC,e and ϕ diff,e , we looked at the extracellular axial current as it is given in the KNP formalism: i e = i diff , e + i field , e = i diff , e + σ e ϕ se Δ x , (80) where the last equality follows when we insert for the extracellular field-driven current density i field,e , and use that ϕ de = 0. As in , we may split ϕ se into two components: ϕ se = ϕ VC , se + ϕ diff , se , (81) where ϕ VC,se is the potential as it would be predicted from standard volume conductor (VC) theory , and ϕ diff,se is the additional contribution from diffusion . With this, can be written: i e = i diff , e + σ e ϕ VC , se Δ x + σ e ϕ diff , se Δ x . (82) We may split this into two equations if we recognize that i e = σ e ϕ VC , se Δ x , (83) is the standard formula used in VC theory, which is based on the assumption that the extracellular current is exclusively due to a drop in the extracellular VC-potential ϕ VC,se . The remainder of then leaves us with i diff , e = - σ e ϕ diff , se Δ x . (84) Since we already knew i e and i diff,e from simulations with the KNP framework, we used Eqs and to calculate ϕ VC,se and ϕ diff,se separately. 

We implemented the differential equations in Python 3.6 and solved them using the solve_ivp function from SciPy. We used its default Runge-Kutta method of order 5(4), and set the maximal allowed step size to 10 −4 . The code is made available at https://github.com/CINPLA/EDPRmodel and https://github.com/CINPLA/EDPRmodel_analysis . 

