GhkHH#

class braincell.channel.GhkHH(size, name=None)#

HH gating driven by a constant-field (GHK) flux.

The catalogue’s voltage-gated calcium channels do not carry an ohmic driving force: their current is a permeability times the Goldman-Hodgkin- Katz constant-field flux, sign-flipped into BrainCell’s inward-positive convention.

\[I = -P \cdot \prod_i g_i^{p_i} \cdot \Phi\!\left(V', [Ca]_i, [Ca]_o, z, T\right)\]

The twelve concrete channels that use this form vary along exactly four axes, each of which is a declaration here rather than a re-written current():

ghk

Which flux function to call. Defaults to ghk_flux(). Mechanisms transcribed from a .mod file that hardcodes its own Faraday and gas constants point this at the matching helper instead; those constants are load-bearing and differ from the shared ones by up to 2e-3 relative, so the choice must stay explicit per class.

_shifted_voltage

The voltage \(V'\) the flux is evaluated at. Inherited from HH, where it defaults to V.

freeze_drive_gradient

Whether to cut the backward pass through the driving force. Applied to V before the shift: stop_gradient(V) - V_sh leaves a live gradient path to V_sh that stop_gradient(V - V_sh) would kill, and the published frozen variants were written the first way.

permeability

The scale factor. Defaults to self.g_max, which occupies the permeability slot a textbook GHK equation writes as \(P_s\).

Note that the gating product is always evaluated at the unfrozen, unshifted V; only the flux term sees V'.

Variables:
  • ghk (callable) – Flux function, called as ghk(V=..., ci=..., co=..., z=..., temp=...).

  • freeze_drive_gradient (bool) – Freeze the driving-force gradient. Default False.

See also

OhmicHH

Sibling template for the ohmic driving force.

ghk_flux

The default constant-field flux.

freeze_gradient

The helper freeze_drive_gradient switches on.

Examples

>>> from braincell.channel import GhkHH
>>> class MyCav(GhkHH):
...     ...
>>> class MyCavFrozen(MyCav):
...     freeze_drive_gradient = True
current(V, *ions)[source]#

Return the constant-field current through the channel.

Parameters:
  • V (ArrayLike) – Membrane potential.

  • *ions (IonInfo) – Ion states; the flux reads the first one.

Returns:

-permeability() * conductance_factor(V, *ions) * flux.

Return type:

ArrayLike

static ghk(V, ci, co, z, temp)#

Compute the Goldman-Hodgkin-Katz constant-field flux, per permeability.

Evaluates the constant-field (GHK) electrodiffusion equation for a single permeant ion species, returning the flux divided through by the membrane permeability. Channels in the catalogue that use GHK-style currents (calcium channels, most notably) multiply this result by their own g_max, which occupies the permeability slot P_s that a textbook GHK flux equation would otherwise carry explicitly.

Parameters:
  • V (ArrayLike) – Membrane potential, as a voltage (for example u.mV).

  • ci (ArrayLike) – Intracellular concentration of the permeant ion, as a molar concentration (for example u.mM).

  • co (ArrayLike) – Extracellular concentration of the permeant ion, as a molar concentration (for example u.mM).

  • z (ArrayLike) – Valence of the permeant ion. Dimensionless.

  • temp (ArrayLike) – Absolute temperature, as a temperature (for example u.kelvin).

Returns:

The constant-field flux, divided through by the permeability P_s that a caller is expected to supply separately (typically as g_max). Not yet a current or a conductance on its own.

Return type:

ArrayLike

Notes

Let zeta = z * F * V / (R * T), with F the Faraday constant and R the gas constant. The function evaluates

\[\text{regular\_branch} = \frac{z \zeta F (c_i - c_o e^{-\zeta})}{1 - e^{-\zeta}}\]

which is undefined at zeta = 0 because 1 - exp(-zeta) vanishes there and the branch divides by it. To keep the function stable as zeta -> 0, a second, algebraically equivalent branch

\[\text{small\_branch} = z F (c_i - c_o e^{-\zeta}) \left(1 + \frac{\zeta}{2}\right)\]

is selected instead via u.math.where whenever abs(1 - exp(-zeta)) <= 1e-6, which both avoids the division and stays numerically well conditioned near that singularity.

Goldman (1943) [1] and Hodgkin & Katz (1949) [2] are together the origin of the name “GHK”, but they are the primary sources for two different equations. This function computes the constant-field flux/current equation, whose primary source is Goldman (1943) – hence .. [1] first. It does not compute the constant-field voltage equation, for which Hodgkin & Katz (1949) is the primary source.

References

permeability()[source]#

Return the scale multiplying the constant-field flux.

Returns:

self.g_max by default. Channels whose .mod source scales a separate permeability parameter override this.

Return type:

ArrayLike