Skip to content

c++ computational solver of the hodgkin–huxley neuron model

License

Notifications You must be signed in to change notification settings

juliansalvador727/axonhh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axonhh

axonhh is an implementation of the classical Hodgkin–Huxley model using modern absolute membrane voltage convention.

All voltages are expressed in millivolts (mV), time in milliseconds (ms), capacitance in µF/cm², conductances in mS/cm², and currents in µA/cm².

State Variables

The neuron membrane is described by four time-dependent variables:

  • $V(t)$ — membrane voltage
  • $m(t)$ — sodium activation gating variable
  • $h(t)$ — sodium inactivation gating variable
  • $n(t)$ — potassium activation gating variable

Membrane Voltage Equation

The membrane is modeled as a capacitor in parallel with ion channels. Applying Kirchhoff’s current law gives:

$$C_m \frac{dV}{dt} = I_{\text{inj}}(t) - \left( I_{Na} + I_K + I_L \right)$$

Solving for the voltage derivative:

$$\frac{dV}{dt} = \frac{1}{C_m} \left[ I_{\text{inj}}(t) - \left( I_{Na} + I_K + I_L \right) \right]$$

Ionic Currents

Each ionic current follows Ohm’s law:

$$I_{\text{ion}} = g_{\text{ion}}(t) \cdot (V - E_{\text{ion}})$$

Sodium current

$$I_{Na} = \bar g_{Na} \cdot m^3 h \cdot (V - E_{Na})$$

Potassium current

$$I_K = \bar g_K \cdot n^4 \cdot (V - E_K)$$

Leak current

$$I_L = \bar g_L \cdot (V - E_L)$$

Gating Variable Dynamics

Each gating variable follows first-order kinetics derived from a two-state Markov process:

$$\frac{dx}{dt} = \alpha_x(V) \cdot (1 - x) - \beta_x(V) \cdot x \quad x \in {m,h,n}$$

Voltage-Dependent Rate Functions

Sodium activation ($m$)

$$\alpha_m(V) = \frac{0.1 \cdot (V + 40)}{1 - e^{-(V + 40)/10}}$$

$$\beta_m(V) = 4 \cdot e^{-(V + 65)/18}$$

Sodium inactivation ($h$)

$$\alpha_h(V) = 0.07 \cdot e^{-(V + 65)/20}$$

$$\beta_h(V) = \frac{1}{1 + e^{-(V + 35)/10}}$$

Potassium activation ($n$)

$$\alpha_n(V) = \frac{0.01 \cdot (V + 55)}{1 - e^{-(V + 55)/10}}$$

$$\beta_n(V) = 0.125 \cdot e^{-(V + 65)/80}$$

Removable Singularities

The rate functions $\alpha_m(V)$ and $\alpha_n(V)$ contain removable singularities at:

$$\alpha_m(-40) = 1.0$$

$$\alpha_n(-55) = 0.1$$

These limits must be handled explicitly in numerical implementations.

Complete System

The full Hodgkin–Huxley system is:

$$\frac{dV}{dt} = \frac{1}{C_m} \left[ I_{\text{inj}}(t) - \left( \bar g_{Na} \cdot m^3 h \cdot (V - E_{Na}) + \bar g_K \cdot n^4 \cdot (V - E_K) + \bar g_L \cdot (V - E_L) \right) \right]$$

$$\frac{dm}{dt} = \alpha_m(V) \cdot (1 - m) - \beta_m(V) \cdot m$$

$$\frac{dh}{dt} = \alpha_h(V) \cdot (1 - h) - \beta_h(V) \cdot h$$

$$\frac{dn}{dt} = \alpha_n(V) \cdot (1 - n) - \beta_n(V) \cdot n$$

Model Parameters

Parameter Description Value
$C_m$ Membrane capacitance $1.0\ \mu\text{F}/\text{cm}^2$
$\bar g_{Na}$ Sodium conductance $120\ \text{mS}/\text{cm}^2$
$\bar g_K$ Potassium conductance $36\ \text{mS}/\text{cm}^2$
$\bar g_L$ Leak conductance $0.3\ \text{mS}/\text{cm}^2$
$E_{Na}$ Sodium reversal potential $+50\ \text{mV}$
$E_K$ Potassium reversal potential $-77\ \text{mV}$
$E_L$ Leak reversal potential $-54.387\ \text{mV}$

Initial Conditions

The membrane is initialized at rest:

$$V(0) = -65\ \text{mV}$$

The gating variables are initialized to their steady-state values:

$$x(0) = \frac{\alpha_x(V(0))}{\alpha_x(V(0)) + \beta_x(V(0))} \quad x \in {m,h,n}$$

External Stimulus

The injected current is defined as a function of time. A common step stimulus is:

$$I_{\text{inj}}(t) = \begin{cases} A, & t_0 \le t \le t_1 \\ 0, & \text{otherwise} \end{cases}$$

Numerical Integration

This system has no closed-form solution and is solved numerically. Explicit Runge–Kutta methods with a timestep

$$\Delta t \approx 0.01\ \text{ms}$$

provide stable and accurate results.

References

  1. Hodgkin, A. L., & Huxley, A. F. (1952). A quantitative description of membrane current and its application to conduction and excitation in nerve. The Journal of Physiology, 117(4), 500–544. PubMed
  2. Hille, B. Ion Channels of Excitable Membranes. Sinauer Associates, 3rd Edition, 2001.
  3. Scholarpedia. Hodgkin–Huxley model. Link
  4. Dayan, P., & Abbott, L. F. Theoretical Neuroscience: Computational and Mathematical Modeling of Neural Systems. MIT Press, 2001.
  5. Press, W. H., Teukolsky, S. A., Vetterling, W. T., & Flannery, B. P. Numerical Recipes: The Art of Scientific Computing. Cambridge University Press.

This implementation follows the classical Hodgkin–Huxley formalism and parameterization as described in the references above, with numerical integration performed using explicit Runge–Kutta methods.

About

c++ computational solver of the hodgkin–huxley neuron model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published