示例#1
0
文件: hh.py 项目: vogdb/nrn
mgate = rxd.State([cyt, mem], name='mgate', initial=0.028905534475191907)
hgate = rxd.State([cyt, mem], name='hgate', initial=0.7540796658225246)

# somaA parameter
pA = rxd.Parameter([cyt, mem],
                   name='paramA',
                   initial=lambda nd: 1 if nd.segment in somaA else 0)

#What
# gates
m_gate = rxd.Rate(mgate, (minf - mgate) / mtau)
h_gate = rxd.Rate(hgate, (hinf - hgate) / htau)
n_gate = rxd.Rate(ngate, (ninf - ngate) / ntau)

# Nernst potentials
ena = 1e3 * h.R * (h.celsius + 273.15) * log(nao / nai) / h.FARADAY
ek = 1e3 * h.R * (h.celsius + 273.15) * log(ko / ki) / h.FARADAY

gna = pA * gnabar * mgate**3 * hgate
gk = pA * gkbar * ngate**4

na_current = rxd.MultiCompartmentReaction(nai,
                                          nao,
                                          gna * (v - ena),
                                          mass_action=False,
                                          membrane=mem,
                                          membrane_flux=True)
k_current = rxd.MultiCompartmentReaction(ki,
                                         ko,
                                         gk * (v - ek),
                                         mass_action=False,
示例#2
0
# extracellular oxygen concentration
o2ecs = rxd.Species([ecs], name="o2ecs", initial=oa_bath)

# STATES-------------------------------------------------------------------------------------------------------------------------

# gating variables (m, h, n)
mgate = rxd.State([cyt, mem], name="mgate", initial=0.00787013592322398)
hgate = rxd.State([cyt, mem], name="hgate", initial=0.9981099795551048)
ngate = rxd.State([cyt, mem], name="ngate", initial=0.02284760152971809)

# ALL EQUATIONS------------------------------------------------------------------------------------------------------------------

gna = gnabar * mgate**3 * hgate
gk = gkbar * ngate**4
fko = 1.0 / (1.0 + exp(16.0 - ko))
nkcc1 = unkcc1 * fko * (log((ki * cli) / (ko * clo)) + log(
    (nai * cli) / (nao * clo)))
kcc2 = ukcc2 * log((ki * cli) / (ko * clo))
ena = 26.64 * log(nao / nai)  # nerst equation - reversal potentials
ek = 26.64 * log(ko / ki)  # ^^^^^
ecl = 26.64 * log(cli / clo)  # ^^^
p = p_max / (1.0 + exp((20.0 - oa_bath * alpha) / 3))
pump = (p / (1.0 + exp((25.0 - nai) / 3))) * (1.0 / (1.0 + exp(3.5 - ko)))
gliapump = ((1.0 / 3.0) * (p / (1.0 + exp(
    (25.0 - gnai) / 3.0))) * (1.0 / (1.0 + exp(3.5 - ko))))
g_glia = g_gliamax / (1.0 + exp(-oa_bath * alpha - 2.5) / 0.2)
glia12 = g_glia / 1.0 + exp((18.0 - ko) / 2.5)

# RATES--------------------------------------------------------------------------------------------------------------------------

# m_gate = rxd.Rate(mgate, (minf - mgate)/mtau)