# Simulating (semi-)morphological dynamics in the Hodgkin-Huxley model

**URL:** <https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060>\
**Category:** Support\
**Created:** [21 September 2023 12:48 UTC](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060 "2023-09-21T12:48:02Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [2 November 2023 15:54 UTC](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060/21 "2023-11-02T15:54:02Z")

</div>

Hi @DenisS . Your updated HH model is using the equations from here, right: [2.2 Hodgkin-Huxley Model | Neuronal Dynamics online book](https://neuronaldynamics.epfl.ch/online/Ch2.S2.html) ? For me, the spurious action potential goes away when you also use their channel densities for K and Na, i.e. g\_{Na0} = 40mS/cm^2 and g\_{K0} = 35 mS/cm^2.

---

<div class="post-metadata">

**Author:** ![DenisS](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/deniss/32/624_2.png) [@DenisS](https://brian.discourse.group/u/DenisS)\
**Post date:** [3 November 2023 10:35 UTC](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060/22 "2023-11-03T10:35:29Z")

</div>

Hi Marcel,

> [@mstimberg](#):
>
> Your updated HH model is using the equations from here, right: [2.2 Hodgkin-Huxley Model | Neuronal Dynamics online book](https://neuronaldynamics.epfl.ch/online/Ch2.S2.html) ? For me, the spurious action potential goes away when you also use their channel densities for K and Na, i.e. gNa0=40mS/cm2g\_{Na0} = 40mS/cm^2gNa0​=40mS/cm2 and gK0=35mS/cm2g\_{K0} = 35 mS/cm^2gK0​=35mS/cm2

indeed, I am learning with this book (among others), and for some reason I overlooked those values entirely, my bad! I still might consider switching over to an exprel-formulation for my rates at some point. I did achieve similar dynamics with this formulation after all:

```auto
# alpha_m = (0.182 * (v / mV + 35)) / exprel((-v+35*mV)/(9*mV))/ms : Hz
# beta_m = (-0.124 * (v / mV +35)) / (1 - exp(((v / mV +35) / 9))) / ms : Hz
#    
# alpha_h = (0.25 * exp(-(v / mV + 90 ) / 12)) / ms : Hz
# beta_h = (0.25 * exp((v / mV + 62) / 6)) / (exp((v / mV + 90) / 12)) / ms : Hz
#    
# alpha_n = (0.02/mV) * 25*mV/exprel((-v+25*mV)/(9*mV))/ms : Hz
# beta_n = (-0.002 * (v / mV - 25)) / (1 - exp((v / mV - 25) / 9)) / ms : Hz

```

I think only few questions remain, and I’d like to give my answers to these, with you making sure those are correct:

1. To stay at [that](https://neuronaldynamics.epfl.ch/online/Ch2.S2.html) page: When you look at Fig 2.6, the dynamics were achieved by a “strong short current impulse between 1 and 2ms” - in Brian2, this would translate to indeed injecting a simple (strong) current starting at 1ms _without_ really restarting the simulation with another run-command but simply keeping it going, correct? Whereas a “constant current paradigm” would translate to injecting several currents into the compartments at certain points.  
Meaning, the flag in the equation (like “point current”) doesn’t matter in that regard, but rather defines how (or if) the current is distributed over the compartments.

2. WIthin the SpatialNeruon class, both the Capacitance (C) and Resistivity are implicitly given rather than being directly used in the equations as is usually the case for HH-type equations.

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [9 November 2023 14:01 UTC](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060/23 "2023-11-09T14:01:35Z")

</div>

> [@DenisS](#):
>
> When you look at Fig 2.6, the dynamics were achieved by a “strong short current impulse between 1 and 2ms” - in Brian2, this would translate to indeed injecting a simple (strong) current starting at 1ms _without_ really restarting the simulation with another run-command but simply keeping it going, correct?

Their simulation uses a short current impulse between 1 and 2ms, and your code above uses a current injection between 10ms and 15ms:

```python
run(10 * ms, report='text')
MorphNeuron.I[morpho.dendrite[0]] = strength # Inject current into first dendrite compartment.
run(5 * ms, report='text')
MorphNeuron.I = 0 * amp
run(50 * ms, report='text')

```

It runs for 10ms without a current, injects a current and continues the simulation for 5ms (i.e. from 10ms to 15ms) with the current, switches off the current and continues the simulation for another 50ms (i.e. from 15ms to 65ms). I am not sure what you mean by “Injecting a simple (strong) current starting at 1ms _without_ really restarting the simulation with another run-command but simply keeping it going” – if you don’t have a run command, then nothing will be simulated. The `run` doesn’t restart the simulation (that’s what `restore` would do), but it continues it.

> [@DenisS](#):
>
> Meaning, the flag in the equation (like “point current”) doesn’t matter in that regard, but rather defines how (or if) the current is distributed over the compartments.

The flag does indeed not have anything to do with the timing, but it also does not define how the current is distributed over the compartments. A `point current` only means that the given current will be divided by the total surface areaof the respective compartment and added to the transmembrane current `Im`. It is just there for convenience, you could also write

```auto
"""
Im = ... + I_ext/area : amp/meter**2
I_ext : amp
"""

```

instead.

> [@DenisS](#):
>
> WIthin the SpatialNeruon class, both the Capacitance (C) and Resistivity are implicitly given rather than being directly used in the equations as is usually the case for HH-type equations.

Yes for the capacitance `C` – in the point-neuron HH model, there is no intracellular resistivity. In contrast to a point-neuron model, you cannot give the full equation for `dv/dt` which would include the division by `C`, since the longitudinal current(s) differ for each compartment. Therefore, you define `Im`, `C`, and `Ri` separately, and Brian puts everything together for each compartment depending on the morphology.

---

<div class="post-metadata">

**Author:** ![DenisS](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/deniss/32/624_2.png) [@DenisS](https://brian.discourse.group/u/DenisS)\
**Post date:** [11 November 2023 13:03 UTC](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060/24 "2023-11-11T13:03:14Z")

</div>

Yes, that definitely clears it up. Thank you again for your patience and responses!

I am certain these thorough replies will help newcomers a lot too, so we might refer them to the thread for similar questions in future. 🙂

[Previous page](https://brian.discourse.group/t/simulating-semi-morphological-dynamics-in-the-hodgkin-huxley-model/1060.md?page=1)
