# AUTOMATICALLY GENERATED FILE!
# Edit ``src/models/compile.py`` or the model definitions in
# ``src/models/`` instead, run ``make`` in the main directory to compile.

"""
Pre-defined models
------------------
"""

from typing import Any

available: dict[str, dict[str, Any]] = {'aliev1996simple': {'name': 'Aliev & Panfilov 1996', 'description': 'This simple two-variable model was created by modifying the model by FitzHugh\n& Nagumo to describe cardiac excitation waves. It models restitution of\naction potential duration, i.e., its dependence on cycle length. It was\noriginally designed for canine ventricles, but is considered a\nphenomenological model.\n', 'dois': ['https://doi.org/10.1016/0960-0779(95)00089-5'], 'keywords': ['excitable media', 'electrophysiology', 'heart', 'phenomenological'], 'variables': {'u': 0.0, 'v': 0.0}, 'diffusivity': {'u': 1.0}, 'parameters': {'eps0': 0.002, 'mu1': 0.2, 'mu2': 0.3, 'a': 0.15, 'k': 8.0}, 'code': 'const Real eps = eps0 + mu1 * v / (u + mu2);\nconst Real _react_u = -k * u * (u - a) * (u - 1.0) - u * v;\nconst Real _react_v = eps * (-v - k * u * (u - a - 1.0));\n*_new_u = u + dt * (_react_u + _diffuse_u);\n*_new_v = v + dt * _react_v;\n'}, 'barkley1991model': {'name': 'Barkley 1991', 'description': 'This early phenomenological model of excitable media is one of the\nsimplest models describing both excitation and recovery enabling\nspiral waves.\n', 'dois': ['https://doi.org/10.1016/0167-2789(91)90194-E'], 'keywords': ['excitable media', 'phenomenological'], 'variables': {'u': 0.0, 'v': 0.0}, 'diffusivity': {'u': 1.0, 'v': 0.0}, 'parameters': {'a': 0.75, 'b': 0.02, 'eps': 0.02}, 'code': 'const Real _react_u = u*(1 - u)*(u - (v + b)/a)/eps;\nconst Real _react_v = u - v;\n*_new_u = u + dt * (_react_u + _diffuse_u);\n*_new_v = v + dt * (_react_v + _diffuse_v);\n'}, 'bueno2008minimal': {'name': 'Bueno-Orovio et al. 2008', 'description': 'This cardiac electrophysiology model by Bueno-Orovio, Cherry, and Fenton is a\nfour-variable extension of the model by Fenton & Karma 1998. It was designed\nto reproduce action potential shapes and the restitution characteristics of\ntheir duration and of conduction velocity.\n\nThe model comes with parameter sets for the epi- (default) and\nendocardium of the human ventricule, as well as a midwall parameter sets.\nAdditionally, the authors provide parameter sets emulating the models by\nPriebe & Beuckelmann 1998 (PB) and Ten Tusscher et al. 2004 (TNNP).\n', 'dois': ['https://doi.org/10.1016/j.jtbi.2008.03.029', 'https://doi.org/10.1063/1.166311', 'https://doi.org/10.1161/01.RES.82.11.1206', 'https://doi.org/10.1152/ajpheart.00794.2003.'], 'keywords': ['excitable media', 'electrophysiology', 'heart', 'generic'], 'variables': {'u': 0.0, 'v': 1.0, 'w': 1.0, 's': 0.0}, 'diffusivity': {'u': 0.1171}, 'parameters': {'u0': 0, 'u_u': 1.55, 'theta_v': 0.3, 'theta_w': 0.13, 'theta_vm': 0.006, 'theta_0': 0.006, 'tau_v1m': 60, 'tau_v2m': 1150, 'tau_vp': 1.4506, 'tau_w1m': 60, 'tau_w2m': 15, 'k_wm': 65, 'u_wm': 0.03, 'tau_wp': 200, 'tau_fi': 0.11, 'tau_o1': 400, 'tau_o2': 6, 'tau_so1': 30.0181, 'tau_so2': 0.9957, 'k_so': 2.0458, 'u_so': 0.65, 'tau_s1': 2.7342, 'tau_s2': 16, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 1.8875, 'tau_winf': 0.07, 'w_infstar': 0.94}, 'parameter sets': {'EPI': {'u0': 0, 'u_u': 1.55, 'theta_v': 0.3, 'theta_w': 0.13, 'theta_vm': 0.006, 'theta_0': 0.006, 'tau_v1m': 60, 'tau_v2m': 1150, 'tau_vp': 1.4506, 'tau_w1m': 60, 'tau_w2m': 15, 'k_wm': 65, 'u_wm': 0.03, 'tau_wp': 200, 'tau_fi': 0.11, 'tau_o1': 400, 'tau_o2': 6, 'tau_so1': 30.0181, 'tau_so2': 0.9957, 'k_so': 2.0458, 'u_so': 0.65, 'tau_s1': 2.7342, 'tau_s2': 16, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 1.8875, 'tau_winf': 0.07, 'w_infstar': 0.94}, 'ENDO': {'u0': 0, 'u_u': 1.56, 'theta_v': 0.3, 'theta_w': 0.13, 'theta_vm': 0.2, 'theta_0': 0.006, 'tau_v1m': 75, 'tau_v2m': 10, 'tau_vp': 1.4506, 'tau_w1m': 6, 'tau_w2m': 140, 'k_wm': 200, 'u_wm': 0.016, 'tau_wp': 280, 'tau_fi': 0.1, 'tau_o1': 470, 'tau_o2': 6, 'tau_so1': 40, 'tau_so2': 1.2, 'k_so': 2, 'u_so': 0.65, 'tau_s1': 2.7342, 'tau_s2': 2, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 2.9013, 'tau_winf': 0.0273, 'w_infstar': 0.78}, 'Midwall': {'u0': 0, 'u_u': 1.61, 'theta_v': 0.3, 'theta_w': 0.13, 'theta_vm': 0.1, 'theta_0': 0.005, 'tau_v1m': 80, 'tau_v2m': 1.4506, 'tau_vp': 1.4506, 'tau_w1m': 70, 'tau_w2m': 8, 'k_wm': 200, 'u_wm': 0.016, 'tau_wp': 280, 'tau_fi': 0.078, 'tau_o1': 410, 'tau_o2': 7, 'tau_so1': 91, 'tau_so2': 0.8, 'k_so': 2.1, 'u_so': 0.6, 'tau_s1': 2.7342, 'tau_s2': 4, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 3.3849, 'tau_winf': 0.01, 'w_infstar': 0.5}, 'PB': {'u0': 0, 'u_u': 1.45, 'theta_v': 0.35, 'theta_w': 0.13, 'theta_vm': 0.175, 'theta_0': 0.006, 'tau_v1m': 10, 'tau_v2m': 1150, 'tau_vp': 1.4506, 'tau_w1m': 140, 'tau_w2m': 6.25, 'k_wm': 65, 'u_wm': 0.015, 'tau_wp': 326, 'tau_fi': 0.105, 'tau_o1': 400, 'tau_o2': 6, 'tau_so1': 30.0181, 'tau_so2': 0.9957, 'k_so': 2.0458, 'u_so': 0.65, 'tau_s1': 2.7342, 'tau_s2': 16, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 1.8875, 'tau_winf': 0.175, 'w_infstar': 0.9}, 'TNNP': {'u0': 0, 'u_u': 1.58, 'theta_v': 0.3, 'theta_w': 0.015, 'theta_vm': 0.015, 'theta_0': 0.006, 'tau_v1m': 60, 'tau_v2m': 1150, 'tau_vp': 1.4506, 'tau_w1m': 70, 'tau_w2m': 20, 'k_wm': 65, 'u_wm': 0.03, 'tau_wp': 280, 'tau_fi': 0.11, 'tau_o1': 6, 'tau_o2': 6, 'tau_so1': 43, 'tau_so2': 0.2, 'k_so': 2, 'u_so': 0.65, 'tau_s1': 2.7342, 'tau_s2': 3, 'k_s': 2.0994, 'u_s': 0.9087, 'tau_si': 2.8723, 'tau_winf': 0.07, 'w_infstar': 0.94}}, 'code': 'const Real Hthvm = (u - theta_vm > 0) ? 1 : 0;\nconst Real Hthw = (u - theta_w > 0) ? 1 : 0;\nconst Real Hth0 = (u - theta_0 > 0) ? 1 : 0;\nconst Real Hthv = (u - theta_v > 0) ? 1 : 0;\n\nconst Real Hkm = (1 + tanh(k_wm * (u-u_wm))) / 2;\nconst Real Hko = (1 + tanh(k_so * (u-u_so))) / 2;\nconst Real Hks = (1 + tanh(k_s * (u-u_s))) / 2;\n\nconst Real tau_vm = tau_v1m + Hthvm*(tau_v2m-tau_v1m);\nconst Real tau_wm = tau_w1m + (tau_w2m-tau_w1m)*Hkm;\nconst Real tau_so = tau_so1 + (tau_so2-tau_so1)*Hko;\nconst Real tau_s = tau_s1 + Hthw*(tau_s2-tau_s1);\nconst Real tau_o = tau_o1 + Hth0*(tau_o2-tau_o1);\n\nconst Real vinf = 1 - Hthvm;\nconst Real winf = (1-Hth0)*(1-u/tau_winf) + Hth0*w_infstar;\n\nconst Real Jfi = -v*Hthv*(u-theta_v)*(u_u-u)/tau_fi;\nconst Real Jso = (theta_w>u) ? (u-u0)/tau_o : 1.0/tau_so;\nconst Real Jsi = -Hthw*w*s/tau_si;\n\nconst Real U = -(Jfi + Jso + Jsi);\nconst Real V = (theta_v>u) ? (vinf-v)/tau_vm : - v/tau_vp;\nconst Real W = (theta_w>u) ? (winf-w)/tau_wm : - w/tau_wp;\nconst Real S = (Hks-s)/tau_s;\n\n*_new_u = u + dt * (U + _diffuse_u);\n*_new_v = v + dt * V;\n*_new_w = w + dt * W;\n*_new_s = s + dt * S;\n'}, 'courtemanche1998ionic': {'name': 'Courtemanche et al. 1998', 'description': 'The human atrial electrophysiology model by Courtemanche, Ramirez and Nattel\n1998 is widely used in both single-cell and tissue-level simulations,\nparticularly in studies of atrial fibrillation and action potential dynamics.\nAs one of the first detailed and extensively validated atrial model, it is\nconsidered a benchmark in the field of cardiac electrophysiology.\n\nSuggested parameters: dt = 0.005ms, dx = 0.25mm, diffusivity = 0.1544 mm^2/ms.\n', 'dois': ['https://doi.org/10.1152/ajpheart.1998.275.1.H301'], 'keywords': ['excitable media', 'electrophysiology', 'heart', 'human', 'atria'], 'diffusivity': {'V': 1.0}, 'variables': {'V': -81.18, 'Na_i': 11.17, 'K_i': 139.0, 'Ca_i': 0.0001013, 'Ca_up': 1.488, 'Ca_rel': 1.488, 'm': 0.002908, 'h': 0.9649, 'j': 0.9775, 'oa': 0.03043, 'oi': 0.9992, 'ua': 0.004966, 'ui': 0.9986, 'xr': 3.296e-05, 'xs': 0.01869, 'd': 0.0001367, 'f': 0.9996, 'f_Ca': 0.7755, 'u': 0.0, 'v': 1.0, 'w': 0.9992}, 'parameters': {'T': 310.0, 'F': 96.4867, 'R': 8.3143, 'V_cell': 20100.0, 'Cm': 100.0, 'V_rel': 96.48, 'V_i': 13668.0, 'V_up': 1109.52, 'sigma': 1.0009103049457284, 'Ca_o': 1.8, 'K_o': 5.4, 'Na_o': 140.0, 'g_Na': 7.8, 'g_K1': 0.09, 'g_to': 0.1652, 'K_Q10': 3.0, 'g_Kr': 0.029411765, 'g_Ks': 0.12941176, 'g_Ca_L': 0.12375, 'ical_f_Ca_tau': 2.0, 'i_NaK_max': 0.59933874, 'Km_Na_i': 10.0, 'Km_K_o': 1.5, 'I_NaCa_max': 1600.0, 'inaca_gamma': 0.35, 'K_mNa': 87.5, 'K_mCa': 1.38, 'K_sat': 0.1, 'g_B_Na': 0.0006744375, 'g_B_Ca': 0.001131, 'g_B_K': 0.0, 'i_PCa_max': 0.275, 'I_up_max': 0.005, 'K_up': 0.00092, 'Ca_up_max': 15.0, 'cajsr_u_tau': 8.0, 'tau_tr': 180.0, 'K_rel': 30.0, 'CMDN_max': 0.05, 'CSQN_max': 10.0, 'TRPN_max': 0.07, 'Km_CMDN': 0.00238, 'Km_CSQN': 0.8, 'Km_TRPN': 0.0005}, 'code': '// extracellular currents\n// calculate i_Na\nconst Real ina_j_beta = ((V < -(Real)(40.0)) ? (Real)(0.1212) * exp(-(Real)(0.01052) * V) / ((Real)(1.0) + exp(-(Real)(0.1378) * (V + (Real)(40.14)))) : (Real)(0.3) * exp(-(Real)(2.535e-07) * V) / ((Real)(1.0) + exp(-(Real)(0.1) * (V + (Real)(32.0)))));\nconst Real ina_j_alpha = ((V < -(Real)(40.0)) ? (-(Real)(127140.0) * exp((Real)(0.2444) * V) - (Real)(3.474e-05) * exp(-(Real)(0.04391) * V)) * (V + (Real)(37.78)) / ((Real)(1.0) + exp((Real)(0.311) * (V + (Real)(79.23)))) : (Real)(0.0));\nconst Real ina_j_tau = (Real)(1.0) / (ina_j_alpha + ina_j_beta);\nconst Real ina_j_inf = ina_j_alpha / (ina_j_alpha + ina_j_beta);\n*_new_j = ina_j_inf + (j - ina_j_inf)*exp(-dt/ina_j_tau);\n\nconst Real ina_m_beta = (Real)(0.08) * exp(-V / (Real)(11.0));\n// (singularity)\nconst Real ina_m_alpha = ((fabs(V + (Real)(47.13)) < (Real)(1e-5)) ? (Real)(3.2) : (Real)(0.32) * (V + (Real)(47.13)) / ((Real)(1.0) - exp(-(Real)(0.1) * (V + (Real)(47.13)))));\nconst Real ina_m_inf = ina_m_alpha / (ina_m_alpha + ina_m_beta);\nconst Real ina_m_tau = (Real)(1.0) / (ina_m_alpha + ina_m_beta);\n*_new_m = ina_m_inf + (m - ina_m_inf)*exp(-dt/ina_m_tau);\n\nconst Real ina_h_alpha = ((V < -(Real)(40.0)) ? (Real)(0.135) * exp((V + (Real)(80.0)) / -(Real)(6.8)) : (Real)(0.0));\nconst Real ina_h_beta = ((V < -(Real)(40.0)) ? (Real)(3.56) * exp((Real)(0.079) * V) + (Real)(310000.0) * exp((Real)(0.35) * V) : (Real)(1.0) / ((Real)(0.13) * ((Real)(1.0) + exp((V + (Real)(10.66)) / -(Real)(11.1)))));\nconst Real ina_h_inf = ina_h_alpha / (ina_h_alpha + ina_h_beta);\nconst Real ina_h_tau = (Real)(1.0) / (ina_h_alpha + ina_h_beta);\n*_new_h = ina_h_inf + (h - ina_h_inf)*exp(-dt/ina_h_tau);\n\nconst Real E_Na = R * T / F * log(Na_o / Na_i);\nconst Real i_Na =  Cm * g_Na * m*m*m * h * j * (V - E_Na);\n\n// calculate i_K1\nconst Real E_K = R * T / F * log(K_o / K_i);\nconst Real i_K1 = Cm * g_K1 * (V - E_K) / ((Real)(1.0) + exp((Real)(0.07) * (V + (Real)(80.0))));\n\n// calculate i_to\nconst Real ito_oi_beta = pow((Real)(35.56) + (Real)(1.0) * exp((V - -(Real)(10.0) - (Real)(8.74)) / -(Real)(7.44)), -(Real)(1.0));\nconst Real ito_oi_alpha = pow((Real)(18.53) + (Real)(1.0) * exp((V - -(Real)(10.0) + (Real)(103.7)) / (Real)(10.95)), -(Real)(1.0));\nconst Real ito_oi_inf = pow((Real)(1.0) + exp((V - -(Real)(10.0) + (Real)(33.1)) / (Real)(5.3)), -(Real)(1.0));\nconst Real ito_oi_tau = pow(ito_oi_alpha + ito_oi_beta, -(Real)(1.0)) / K_Q10;\n*_new_oi = ito_oi_inf + (oi - ito_oi_inf)*exp(-dt/ito_oi_tau);\n\nconst Real ito_oa_alpha = (Real)(0.65) / (exp((V - -(Real)(10.0)) / -(Real)(8.5)) + exp((V - -(Real)(10.0) - (Real)(40.0)) / -(Real)(59.0)));\nconst Real ito_oa_beta = (Real)(0.65) / ((Real)(2.5) + exp((V - -(Real)(10.0) + (Real)(72.0)) / (Real)(17.0)));\nconst Real ito_oa_inf = pow((Real)(1.0) + exp((V - -(Real)(10.0) + (Real)(10.47)) / -(Real)(17.54)), -(Real)(1.0));\nconst Real ito_oa_tau = pow(ito_oa_alpha + ito_oa_beta, -(Real)(1.0)) / K_Q10;\n*_new_oa = ito_oa_inf + (oa - ito_oa_inf)*exp(-dt/ito_oa_tau);\n\nconst Real i_to = Cm * g_to * oa*oa*oa * oi * (V - E_K);\n\n// calculate i_Kur\nconst Real ikur_ua_inf = pow((Real)(1.0) + exp((V - -(Real)(10.0) + (Real)(20.3)) / -(Real)(9.6)), -(Real)(1.0));\nconst Real ikur_ua_beta = (Real)(0.65) / ((Real)(2.5) + exp((V - -(Real)(10.0) + (Real)(72.0)) / (Real)(17.0)));\nconst Real ikur_ua_alpha = (Real)(0.65) / (exp((V - -(Real)(10.0)) / -(Real)(8.5)) + exp((V - -(Real)(10.0) - (Real)(40.0)) / -(Real)(59.0)));\nconst Real ikur_ua_tau = pow(ikur_ua_alpha + ikur_ua_beta, -(Real)(1.0)) / K_Q10;\n*_new_ua = ikur_ua_inf + (ua - ikur_ua_inf)*exp(-dt/ikur_ua_tau);\n\nconst Real ikur_ui_inf = pow((Real)(1.0) + exp((V - -(Real)(10.0) - (Real)(109.45)) / (Real)(27.48)), -(Real)(1.0));\nconst Real ikur_ui_tau_alpha = pow((Real)(21.0) + (Real)(1.0) * exp((V - -(Real)(10.0) - (Real)(195.0)) / -(Real)(28.0)), -(Real)(1.0));\nconst Real ikur_ui_tau_beta = (Real)(1.0) / exp((V - -(Real)(10.0) - (Real)(168.0)) / -(Real)(16.0));\nconst Real ikur_ui_tau = pow(ikur_ui_tau_alpha + ikur_ui_tau_beta, -(Real)(1.0)) / K_Q10;\n*_new_ui = ikur_ui_inf + (ui - ikur_ui_inf)*exp(-dt/ikur_ui_tau);\n\nconst Real g_Kur = (Real)(0.005) + (Real)(0.05) / ((Real)(1.0) + exp((V - (Real)(15.0)) / -(Real)(13.0)));\n\nconst Real i_Kur = Cm * g_Kur * ua*ua*ua * ui * (V - E_K);\n\n// calculate i_Kr\nconst Real ikr_xr_inf = pow((Real)(1.0) + exp((V + (Real)(14.1)) / -(Real)(6.5)), -(Real)(1.0));\n// (singularity)\nconst Real ikr_xr_tau_beta = ((fabs(V - (Real)(3.3328)) < (Real)(1e-5)) ? (Real)(3.78361180000000004e-04) : (Real)(7.38980000000000030e-05) * (V - (Real)(3.3328)) / (exp((V - (Real)(3.3328)) / (Real)(5.1237)) - (Real)(1.0)));\nconst Real ikr_xr_tau_alpha = ((fabs(V + (Real)(14.1)) < (Real)(1e-5)) ? (Real)(0.0015) : (Real)(0.0003) * (V + (Real)(14.1)) / ((Real)(1.0) - exp((V + (Real)(14.1)) / -(Real)(5.0))));\nconst Real ikr_xr_tau = pow(ikr_xr_tau_alpha + ikr_xr_tau_beta, -(Real)(1.0));\n*_new_xr = ikr_xr_inf + (xr - ikr_xr_inf)*exp(-dt/ikr_xr_tau);\n\nconst Real i_Kr = Cm * g_Kr * xr * (V - E_K) / ((Real)(1.0) + exp((V + (Real)(15.0)) / (Real)(22.4)));\n\n// calculate i_Ks\nconst Real iks_xs_inf = pow((Real)(1.0) + exp((V - (Real)(19.9)) / -(Real)(12.7)), -(Real)(0.5));\n// (singularity)\nconst Real iks_xs_tau_beta = ((fabs(V - (Real)(19.9)) < (Real)(1e-5)) ? (Real)(0.000315) : (Real)(3.5e-05) * (V - (Real)(19.9)) / (exp((V - (Real)(19.9)) / (Real)(9.0)) - (Real)(1.0)));\nconst Real iks_xs_tau_alpha = ((fabs(V - (Real)(19.9)) < (Real)(1e-5)) ? (Real)(0.00068) : (Real)(4e-05) * (V - (Real)(19.9)) / ((Real)(1.0) - exp((V - (Real)(19.9)) / -(Real)(17.0))));\nconst Real iks_xs_tau = (Real)(0.5) / (iks_xs_tau_alpha + iks_xs_tau_beta);\n*_new_xs = iks_xs_inf + (xs - iks_xs_inf)*exp(-dt/iks_xs_tau);\nconst Real i_Ks = Cm * g_Ks * xs*xs * (V - E_K);\n\n// calculate i_Ca_L\nconst Real ical_f_inf = exp(-(V + (Real)(28.0)) / (Real)(6.9)) / ((Real)(1.0) + exp(-(V + (Real)(28.0)) / (Real)(6.9)));\nconst Real ical_f_tau = (Real)(9.0) * pow((Real)(0.0197) * exp(-pow((Real)(0.0337), (Real)(2.0)) * pow(V + (Real)(10.0), (Real)(2.0))) + (Real)(0.02), -(Real)(1.0));\n*_new_f = ical_f_inf + (f - ical_f_inf)*exp(-dt/ical_f_tau);\n\nconst Real ical_f_Ca_inf = pow((Real)(1.0) + Ca_i / (Real)(0.00035), -(Real)(1.0));\n*_new_f_Ca = ical_f_Ca_inf + (f_Ca - ical_f_Ca_inf)*exp(-dt/ical_f_Ca_tau);\n\nconst Real ical_d_inf = pow((Real)(1.0) + exp((V + (Real)(10.0)) / -(Real)(8.0)), -(Real)(1.0));\nconst Real ical_d_tau = ((fabs(V + (Real)(10.0)) < (Real)(1e-10)) ? (Real)(4.579) / ((Real)(1.0) + exp((V + (Real)(10.0)) / -(Real)(6.24))) : ((Real)(1.0) - exp((V + (Real)(10.0)) / -(Real)(6.24))) / ((Real)(0.035) * (V + (Real)(10.0)) * ((Real)(1.0) + exp((V + (Real)(10.0)) / -(Real)(6.24)))));\n*_new_d = ical_d_inf + (d - ical_d_inf)*exp(-dt/ical_d_tau);\n\nconst Real i_Ca_L = Cm * g_Ca_L * d * f * f_Ca * (V - (Real)(65.0));\n\n// calculate I_B_*\nconst Real E_Ca = R * T / ((Real)(2.0) * F) * log(Ca_o / Ca_i);\nconst Real i_B_K = Cm * g_B_K * (V - E_K);\nconst Real i_B_Ca = Cm * g_B_Ca * (V - E_Ca);\nconst Real i_B_Na = Cm * g_B_Na * (V - E_Na);\n\n// calculate i_NaK\nconst Real f_NaK = pow((Real)(1.0) + (Real)(0.1245) * exp(-(Real)(0.1) * F * V / (R * T)) + (Real)(0.0365) * sigma * exp(-F * V / (R * T)), -(Real)(1.0));\nconst Real i_NaK = Cm * i_NaK_max * f_NaK * (Real)(1.0) / ((Real)(1.0) + pow(Km_Na_i / Na_i, (Real)(1.5))) * K_o / (K_o + Km_K_o);\n\n// calculate i_PCa\nconst Real i_PCa = Cm * i_PCa_max * Ca_i / ((Real)(0.0005) + Ca_i);\n\n// calculate i_NaCa\nconst Real i_NaCa = Cm * I_NaCa_max * (exp(inaca_gamma * F * V / (R * T)) * Na_i*Na_i*Na_i * Ca_o - exp((inaca_gamma - (Real)(1.0)) * F * V / (R * T)) * Na_o*Na_o*Na_o * Ca_i) / ((K_mNa*K_mNa*K_mNa + Na_o*Na_o*Na_o) * (K_mCa + Ca_o) * ((Real)(1.0) + K_sat * exp((inaca_gamma - (Real)(1.0)) * V * F / (R * T))));\n\n// misc\nconst Real i_up = I_up_max / ((Real)(1.0) + K_up / Ca_i);\nconst Real i_up_leak = I_up_max * Ca_up / Ca_up_max;\nconst Real i_tr = (Ca_up - Ca_rel) / tau_tr;\n\n// intracellular Ca-currents\nconst Real i_rel = K_rel * u*u * v * w * (Ca_rel - Ca_i);\nconst Real cajsr_w_inf = (Real)(1.0) - pow((Real)(1.0) + exp(-(V - (Real)(40.0)) / (Real)(17.0)), -(Real)(1.0));\nconst Real cajsr_w_tau = ((fabs(V - (Real)(7.9)) < (Real)(1e-10)) ? (Real)(6.0) * (Real)(0.2) / (Real)(1.3) : (Real)(6.0) * ((Real)(1.0) - exp(-(V - (Real)(7.9)) / (Real)(5.0))) / (((Real)(1.0) + (Real)(0.3) * exp(-(V - (Real)(7.9)) / (Real)(5.0))) * (Real)(1.0) * (V - (Real)(7.9))));\n*_new_w = cajsr_w_inf + (w - cajsr_w_inf)*exp(-dt/cajsr_w_tau);\n\nconst Real Fn = (Real)(1000.0) * ((Real)(1e-15) * V_rel * i_rel - (Real)(1e-15) / ((Real)(2.0) * F) * ((Real)(0.5) * i_Ca_L - (Real)(0.2) * i_NaCa));\nconst Real cajsr_v_inf = (Real)(1.0) - pow((Real)(1.0) + exp(-(Fn - (Real)(6.835e-14)) / (Real)(1.367e-15)), -(Real)(1.0));\nconst Real cajsr_v_tau = (Real)(1.91) + (Real)(2.09) / ((Real)(1.0) + exp(-(Fn - (Real)(3.41749999999999983e-13)) / (Real)(1.367e-15)));\n*_new_v = cajsr_v_inf + (v - cajsr_v_inf)*exp(-dt/cajsr_v_tau);\n\nconst Real cajsr_u_inf = pow((Real)(1.0) + exp(-(Fn - (Real)(3.41749999999999983e-13)) / (Real)(1.367e-15)), -(Real)(1.0));\n*_new_u = cajsr_u_inf + (u - cajsr_u_inf)*exp(-dt/cajsr_u_tau);\n\n// total current\nconst Real i_ion = i_Na + i_K1 + i_to + i_Kur + i_Kr + i_Ks + i_B_Na + i_B_Ca + i_NaK + i_PCa + i_NaCa + i_Ca_L;\n\n// update concentrations\n*_new_Na_i = Na_i + dt * ((-(Real)(3.0) * i_NaK - ((Real)(3.0) * i_NaCa + i_B_Na + i_Na)) / (V_i * F));\n*_new_K_i = K_i + dt * (((Real)(2.0) * i_NaK - (i_K1 + i_to + i_Kur + i_Kr + i_Ks + i_B_K)) / (V_i * F));\n*_new_Ca_rel = Ca_rel + dt * ((i_tr - i_rel) * pow((Real)(1.0) + CSQN_max * Km_CSQN / pow(Ca_rel + Km_CSQN, (Real)(2.0)), -(Real)(1.0)));\n*_new_Ca_up = Ca_up + dt * (i_up - (i_up_leak + i_tr * V_rel / V_up));\n*_new_Ca_i = Ca_i + dt * (((Real)(2.0) * i_NaCa - (i_PCa + i_Ca_L + i_B_Ca)) / ((Real)(2.0) * V_i * F) + (V_up * (i_up_leak - i_up) + i_rel * V_rel) / V_i) / ((Real)(1.0) + TRPN_max * Km_TRPN / pow(Ca_i + Km_TRPN, (Real)(2.0)) + CMDN_max * Km_CMDN / pow(Ca_i + Km_CMDN, (Real)(2.0)));\n\n// update voltage\n*_new_V = V + dt * (_diffuse_V - i_ion/Cm);\n'}, 'gray1983autocatalytic': {'name': 'Gray & Scott 1982', 'description': 'One of the two variable reaction-diffusion models presented in the article\n"Autocatalytic reactions in the isothermal, continuous stirred tank\nreactor: isolas and other forms of multistability". Depending on the\nparameters, different patterns can be seen to form in its solutions.\n\nIt describes the chemical reactions:\n\n.. math::\n\n  U + 2V &\\to 3V\n  \\\\\n  V &\\to P\n\n- ``u``, ``v``: concentrations of :math:`U`, :math:`V`.\n- ``k``: rate of conversion of :math:`V` to :math:`P`.\n- ``f``: rate of the process that feeds :math:`U` and\n  drains :math:`U`, :math:`V`, and :math:`P`.\n', 'keywords': ['pattern formation'], 'dois': ['https://doi.org/10.1016/0009-2509(83)80132-8'], 'variables': {'u': 1.0, 'v': 0.0}, 'diffusivity': {'u': 1, 'v': 0.5}, 'parameters': {'f': 0.055, 'k': 0.062}, 'code': 'const Real uvv = u * v * v;\nconst Real U = -uvv + f * (1 - u);\nconst Real V = uvv - (f + k) * v;\n\n*_new_u = u + dt * (U + _diffuse_u);\n*_new_v = v + dt * (V + _diffuse_v);\n'}, 'hodgkin1952quantitative': {'name': 'Hodgkin & Huxley 1952', 'description': 'This model describes the electrical conduction in giant nerve fibre of\nsquids. It is one of the first mathematical models of electrophysiology.\n', 'dois': ['https://doi.org/10.1113/jphysiol.1952.sp004764'], 'variables': {'E': -75.0, 'n': 0.317, 'm': 0.05, 'h': 0.595}, 'parameters': {'engine_pace': 0.0, 'engine_time': 0.0, 'membrane_C': 1.0, 'membrane_E_rest': -75.0, 'membrane_Vshock': -15.0, 'potassium_Vk': 12.0, 'potassium_g_max': 36.0, 'sodium_VNa': -115.0, 'sodium_g_max': 120.0, 'leak_Vleak': -10.613, 'leak_g_max': 0.3}, 'keywords': ['excitable media', 'electrophysiology'], 'diffusivity': {'E': 1.0}, 'code': '// membrane\nconst Real membrane_V = E - membrane_E_rest;\n\n// potassium\nconst Real potassium_n_a = 0.01f * (membrane_V + 10.0f) / ((fabs(native_exp((membrane_V + 10.0f) / 10.0f) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp((membrane_V + 10.0f) / 10.0f) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp((membrane_V + 10.0f) / 10.0f) - 1.0f);\nconst Real potassium_n_b = 0.125f * native_exp(membrane_V / 80.0f);\n*_new_n = n + dt*(potassium_n_a * (1.0f - n) - potassium_n_b * n);\nconst Real potassium_i = potassium_g_max * pow(n, 4.0f) * (membrane_V - potassium_Vk);\n\n// sodium\nconst Real sodium_h_a = 0.07f * native_exp(membrane_V / 20.0f);\nconst Real sodium_h_b = 1.0f / ((fabs(native_exp((membrane_V + 30.0f) / 10.0f) + 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp((membrane_V + 30.0f) / 10.0f) + 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp((membrane_V + 30.0f) / 10.0f) + 1.0f);\n*_new_h = h + dt*(sodium_h_a * (1.0f - h) - sodium_h_b * h);\nconst Real sodium_m_a = 0.1f * (membrane_V + 25.0f) / ((fabs(native_exp((membrane_V + 25.0f) / 10.0f) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp((membrane_V + 25.0f) / 10.0f) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp((membrane_V + 25.0f) / 10.0f) - 1.0f);\nconst Real sodium_m_b = 4.0f * native_exp(membrane_V / 18.0f);\n*_new_m = m + dt*(sodium_m_a * (1.0f - m) - sodium_m_b * m);\nconst Real sodium_i = sodium_g_max * pow(m, 3.0f) * h * (membrane_V - sodium_VNa);\n\n// leak\nconst Real leak_i = leak_g_max * (membrane_V - leak_Vleak);\n\n// *remaining*\n*_new_E = E + dt*(((engine_pace > 0.0f) ? (membrane_Vshock - (E - membrane_E_rest)) * 100.0f : -(1.0f / membrane_C) * (sodium_i + potassium_i + leak_i)) + _diffuse_E);', 'code_double': '// membrane\nconst Real membrane_V = E - membrane_E_rest;\n\n// potassium\nconst Real potassium_n_a = 0.01 * (membrane_V + 10.0) / ((fabs(exp((membrane_V + 10.0) / 10.0) - 1.0) < VERY_SMALL_NUMBER) ? ((exp((membrane_V + 10.0) / 10.0) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp((membrane_V + 10.0) / 10.0) - 1.0);\nconst Real potassium_n_b = 0.125 * exp(membrane_V / 80.0);\n*_new_n = n + dt*(potassium_n_a * (1.0 - n) - potassium_n_b * n);\nconst Real potassium_i = potassium_g_max * pow(n, 4.0) * (membrane_V - potassium_Vk);\n\n// sodium\nconst Real sodium_h_a = 0.07 * exp(membrane_V / 20.0);\nconst Real sodium_h_b = 1.0 / ((fabs(exp((membrane_V + 30.0) / 10.0) + 1.0) < VERY_SMALL_NUMBER) ? ((exp((membrane_V + 30.0) / 10.0) + 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp((membrane_V + 30.0) / 10.0) + 1.0);\n*_new_h = h + dt*(sodium_h_a * (1.0 - h) - sodium_h_b * h);\nconst Real sodium_m_a = 0.1 * (membrane_V + 25.0) / ((fabs(exp((membrane_V + 25.0) / 10.0) - 1.0) < VERY_SMALL_NUMBER) ? ((exp((membrane_V + 25.0) / 10.0) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp((membrane_V + 25.0) / 10.0) - 1.0);\nconst Real sodium_m_b = 4.0 * exp(membrane_V / 18.0);\n*_new_m = m + dt*(sodium_m_a * (1.0 - m) - sodium_m_b * m);\nconst Real sodium_i = sodium_g_max * pow(m, 3.0) * h * (membrane_V - sodium_VNa);\n\n// leak\nconst Real leak_i = leak_g_max * (membrane_V - leak_Vleak);\n\n// *remaining*\n*_new_E = E + dt*(((engine_pace > 0.0) ? (membrane_Vshock - (E - membrane_E_rest)) * 100.0 : -(1.0 / membrane_C) * (sodium_i + potassium_i + leak_i)) + _diffuse_E);'}, 'majumder2016mathematical': {'name': 'Majumder et al. 2016', 'description': 'The model described in the original publication by Majumder et al. 2016\n[1].\n\n[1] Majumder R, Jangsangthong W, Feola I, Ypey DL, Pijnappels DA, Panfilov\nAV (2016) A Mathematical Model of Neonatal Rat Atrial Monolayers with\nConstitutively Active Acetylcholine- Mediated K+ Current. PLoS Comput Biol\n12(6): e1004946. doi:10.1371/journal.pcbi.1004946', 'dois': ['https://doi.org/10.1371/journal.pcbi.1004946'], 'variables': {'membrane_V': -72.3, 'intra_Ca': 0.137822, 'intra_CaNSR': 794.054383, 'intra_CaJSR': 790.502388, 'CaL_gate_d_gate': 0.000109, 'CaL_gate_f_gate': 0.999929, 'CaL_gate_fCa_gate': 1.001951, 'CaT_gate_b_gate': 0.000708, 'CaT_gate_g_gate': 0.914717, 'Kr_gate_Xr_gate': 0.025742210977, 'Ks_gate_Xs1_gate': 0.012668791315, 'Ks_gate_Xs2_gate': 0.028399873909, 'Kur_gate_ua_gate': 0.000554, 'Kur_gate_ui_gate': 1.0, 'Na_gate_h_gate': 0.624946, 'Na_gate_j_gate': 0.624946, 'Na_gate_m_gate': 0.001729, 'funny_gate_y_gate': 0.562306, 'rel_gate_Po1_gate': 0.002247, 'to_gate_r_gate': 0.003223, 'to_gate_s_gate': 0.999969, 'to_gate_s_slow_gate': 0.999969}, 'parameters': {'const_F': 96.5, 'const_R': 8.314, 'const_T': 310.0, 'const_pi': 3.141592653589793, 'const_Q_Q10': 1.8, 'const_Q': 1.8, 'const_RTpF': 26.70818652849741, 'engine_pace': 0.0, 'engine_time': 0.0, 'extra_Ca': 1796.0, 'extra_K': 5400.0, 'extra_Na': 154578.0, 'leak_k': 5e-06, 'radius_SL': 10.5, 'radius_SR': 6.0, 'radius_dish': 0.76, 'radius_nucleus': 5.7934, 'rel_nu1': 0.1, 'rel_gate_Po1_N': 4.0, 'rel_gate_Po1_a': 1.0, 'rel_gate_Po1_b': 0.16, 'tr_tau': 200.0, 'up_Hf': 2.0, 'up_Hr': 2.0, 'up_Kmf': 0.5, 'up_Kmr': 3500.0, 'up_Vmax': 0.9996, 'CaL_G': 4.8e-05, 'CaL_gate_fCa_tau': 10.0, 'NaK_gate_f_sigma': 1.2775446391262346, 'stimulus_amplitude': -7.0, 'volume_SR': 0.09029999999999999, 'volume_myo': 3.944269576581986, 'volume_NSR': 0.08127, 'volume_JSR': 0.009029999999999996, 'membrane_A': 1.3854423602330987e-05, 'membrane_C': 1.0, 'intra_K': 130953.391484, 'intra_Na': 13818.5982638, 'intra_CaJSR_beta_CSQN': 24750.0, 'intra_CaJSR_beta_KmCSQN': 800.0, 'Nernst_K': -85.15751745603409, 'Nernst_Na': 64.49181567485309, 'Nernst_Ks_P_NaK': 0.01833, 'Nernst_Ks': -73.94356399986512, 'Na_G_G310': 145.0, 'Na_G_G296': 135.51401869158877, 'Na_G': 145.0, 'to_G': 7e-05, 'CaT_G': 0.0054, 'Cab_G': 0.0008, 'NCX_d': 1e-16, 'NCX_gamma': 0.5, 'NCX_k': 6.804e-17, 'NaK_Imax': 3.83916, 'NaK_K_K': 1500.0, 'NaK_K_Na': 186000.0, 'NaK_n': 3.2, 'funny_G': 0.021, 'Nab_G': 3.9e-05, 'Kb_G': 1e-06, 'Kur_G': 0.02, 'Kr_G': 0.016532387607360286, 'intra_Ca_beta_CMDN': 50.0, 'intra_Ca_beta_KC': 2.38, 'intra_Ca_beta_KT': 0.5, 'intra_Ca_beta_TRPN': 35.0}, 'keywords': ['excitable media', 'electrophysiology', 'heart', 'rat', 'atrial'], 'diffusivity': {'V': 1.0}, 'code': '// CaT_gate_b\nconst Real CaT_gate_b_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 36.0f) / -6.1f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 36.0f) / -6.1f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 36.0f) / -6.1f));\nconst Real CaT_gate_b_tau = 0.6f + 5.4f / ((fabs(1.0f + native_exp(0.03f * (membrane_V + 100.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(0.03f * (membrane_V + 100.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(0.03f * (membrane_V + 100.0f)));\n*_new_CaT_gate_b_gate = CaT_gate_b_inf + (CaT_gate_b_gate - CaT_gate_b_inf) * native_exp(-(dt / CaT_gate_b_tau));\n\n// CaT_gate_g\nconst Real CaT_gate_g_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 66.0f) / 6.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 66.0f) / 6.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 66.0f) / 6.0f));\nconst Real CaT_gate_g_tau = 1.0f + 40.0f / ((fabs(1.0f + native_exp(0.08f * (membrane_V + 65.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(0.08f * (membrane_V + 65.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(0.08f * (membrane_V + 65.0f)));\n*_new_CaT_gate_g_gate = CaT_gate_g_inf + (CaT_gate_g_gate - CaT_gate_g_inf) * native_exp(-(dt / CaT_gate_g_tau));\n\n// Kr_gate_Rr\nconst Real Kr_gate_Rr_gate = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 9.0f) / 22.4f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 9.0f) / 22.4f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 9.0f) / 22.4f));\n\n// funny_gate_y\nconst Real funny_gate_y_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 78.65f) / 6.33f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 78.65f) / 6.33f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 78.65f) / 6.33f));\nconst Real funny_gate_y_tau = 1000.0f / ((fabs(0.11885f * native_exp((membrane_V + 75.0f) / 28.37f) + 0.56236f * native_exp((membrane_V + 75.0f) / -14.19f)) < VERY_SMALL_NUMBER) ? ((0.11885f * native_exp((membrane_V + 75.0f) / 28.37f) + 0.56236f * native_exp((membrane_V + 75.0f) / -14.19f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.11885f * native_exp((membrane_V + 75.0f) / 28.37f) + 0.56236f * native_exp((membrane_V + 75.0f) / -14.19f));\n*_new_funny_gate_y_gate = funny_gate_y_inf + (funny_gate_y_gate - funny_gate_y_inf) * native_exp(-(dt / funny_gate_y_tau));\n\n// leak\nconst Real leak_J = leak_k * (intra_CaNSR - intra_Ca);\n\n// rel\nconst Real rel_J = rel_nu1 * rel_gate_Po1_gate * (intra_CaJSR - intra_Ca);\n\n// rel_gate_Po1\nconst Real rel_gate_Po1_C1 = 1.0f - rel_gate_Po1_gate;\nconst Real rel_gate_Po1_K = 3.51f / ((fabs(1.0f + native_exp((intra_CaJSR - 530.0f) / 200.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((intra_CaJSR - 530.0f) / 200.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((intra_CaJSR - 530.0f) / 200.0f)) + 0.25f;\n*_new_rel_gate_Po1_gate = rel_gate_Po1_gate + dt*(rel_gate_Po1_a * (pow(intra_Ca, rel_gate_Po1_N) / ((fabs(pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N))) * rel_gate_Po1_C1 - rel_gate_Po1_b * rel_gate_Po1_gate);\n\n// to_gate_r\nconst Real to_gate_r_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 3.0f) / -12.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 3.0f) / -12.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 3.0f) / -12.0f));\nconst Real to_gate_r_tau = 1000.0f / ((fabs(45.16f * native_exp(0.03577f * (membrane_V + 50.0f)) + 98.9f * native_exp(-0.1f * (membrane_V + 38.0f))) < VERY_SMALL_NUMBER) ? ((45.16f * native_exp(0.03577f * (membrane_V + 50.0f)) + 98.9f * native_exp(-0.1f * (membrane_V + 38.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 45.16f * native_exp(0.03577f * (membrane_V + 50.0f)) + 98.9f * native_exp(-0.1f * (membrane_V + 38.0f)));\n*_new_to_gate_r_gate = to_gate_r_inf + (to_gate_r_gate - to_gate_r_inf) * native_exp(-(dt / to_gate_r_tau));\n\n// to_gate_s\nconst Real to_gate_s_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 31.97156f) / 4.64291f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 31.97156f) / 4.64291f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 31.97156f) / 4.64291f));\nconst Real to_gate_s_tau = 1000.0f * (0.35f * native_exp(-pow((membrane_V + 70.0f) / 15.0f, 2.0f)) + 0.035f) - 26.9f;\n*_new_to_gate_s_gate = to_gate_s_inf + (to_gate_s_gate - to_gate_s_inf) * native_exp(-(dt / to_gate_s_tau));\n\n// tr\nconst Real tr_J = (intra_CaNSR - intra_CaJSR) / tr_tau;\n\n// up\nconst Real up_f = pow(intra_Ca / up_Kmf, up_Hf);\nconst Real up_r = pow(intra_CaNSR / up_Kmr, up_Hr);\nconst Real up_J = (up_Vmax * up_f - up_Vmax * up_r) / ((fabs(1.0f + up_f + up_r) < VERY_SMALL_NUMBER) ? ((1.0f + up_f + up_r < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + up_f + up_r);\n\n// CaL\nconst Real CaL_VF2pRT = 2.0f * membrane_V / const_RTpF;\nconst Real CaL_I = 2.0f * CaL_G * CaL_gate_d_gate * CaL_gate_f_gate * CaL_gate_fCa_gate * CaL_VF2pRT * const_F * (intra_Ca * native_exp(CaL_VF2pRT) - 0.341f * extra_Ca) / ((fabs(native_exp(CaL_VF2pRT) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(CaL_VF2pRT) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(CaL_VF2pRT) - 1.0f);\n\n// CaL_gate_d\nconst Real CaL_gate_d_a = 0.25f + 1.4f / ((fabs(1.0f + native_exp((membrane_V + 35.0f) / -13.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 35.0f) / -13.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 35.0f) / -13.0f));\nconst Real CaL_gate_d_b = 1.4f / ((fabs(1.0f + native_exp((membrane_V + 5.0f) / 5.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 5.0f) / 5.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 5.0f) / 5.0f));\nconst Real CaL_gate_d_c = 1.0f / ((fabs(1.0f + native_exp((50.0f - membrane_V) / 20.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((50.0f - membrane_V) / 20.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((50.0f - membrane_V) / 20.0f));\nconst Real CaL_gate_d_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 1.8f) / -8.6f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 1.8f) / -8.6f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 1.8f) / -8.6f));\nconst Real CaL_gate_d_tau = CaL_gate_d_a * CaL_gate_d_b + CaL_gate_d_c + 10.0f;\n*_new_CaL_gate_d_gate = CaL_gate_d_gate + dt*(const_Q * (CaL_gate_d_inf - CaL_gate_d_gate) / ((fabs(CaL_gate_d_tau) < VERY_SMALL_NUMBER) ? ((CaL_gate_d_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : CaL_gate_d_tau));\n\n// CaL_gate_f\nconst Real CaL_gate_f_inf = 1.0f / ((fabs(1.0f + native_exp((22.0f + membrane_V) / 6.1f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((22.0f + membrane_V) / 6.1f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((22.0f + membrane_V) / 6.1f));\nconst Real CaL_gate_f_tau = 562.5f * native_exp(pow(membrane_V + 27.0f, 2.0f) / -1000.0f) + 10.0f / ((fabs(1.0f + native_exp(25.0f - membrane_V)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(25.0f - membrane_V) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(25.0f - membrane_V)) + 10.0f;\n*_new_CaL_gate_f_gate = CaL_gate_f_gate + dt*(const_Q * (CaL_gate_f_inf - CaL_gate_f_gate) / ((fabs(CaL_gate_f_tau) < VERY_SMALL_NUMBER) ? ((CaL_gate_f_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : CaL_gate_f_tau));\n\n// CaL_gate_fCa\nconst Real CaL_gate_fCa_a = 1.0f / ((fabs(1.0f + pow(intra_Ca / 0.325f, 8.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + pow(intra_Ca / 0.325f, 8.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + pow(intra_Ca / 0.325f, 8.0f));\nconst Real CaL_gate_fCa_b = 0.1f / ((fabs(1.0f + native_exp((intra_Ca - 0.5f) / 0.1f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((intra_Ca - 0.5f) / 0.1f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((intra_Ca - 0.5f) / 0.1f));\nconst Real CaL_gate_fCa_c = 0.2f / ((fabs(1.0f + native_exp((intra_Ca - 0.75f) / 0.8f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((intra_Ca - 0.75f) / 0.8f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((intra_Ca - 0.75f) / 0.8f));\nconst Real CaL_gate_fCa_inf = (CaL_gate_fCa_a + CaL_gate_fCa_b + CaL_gate_fCa_c + 0.23f) / 1.46f;\nconst Real CaL_gate_fCa_k = (((CaL_gate_fCa_inf > CaL_gate_fCa_gate) && (membrane_V > -60.0f)) ? 0.0f : 1.0f);\n*_new_CaL_gate_fCa_gate = CaL_gate_fCa_gate + dt*(const_Q * CaL_gate_fCa_k * (CaL_gate_fCa_inf - CaL_gate_fCa_gate) / CaL_gate_fCa_tau);\n\n// CaSR\nconst Real CaSR_J = rel_J - up_J + leak_J;\n\n// Kr_gate_Xr\nconst Real Kr_gate_Xr_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 12.5f) / -10.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 12.5f) / -10.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 12.5f) / -10.0f));\nconst Real Kr_gate_Xr_tau = 1.0f / ((fabs(0.00138f * (membrane_V + 14.2f) / ((fabs(1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.123f * (membrane_V + 14.2f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) + 0.00061f * (membrane_V + 38.9f) / ((fabs(native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f)) < VERY_SMALL_NUMBER) ? ((0.00138f * (membrane_V + 14.2f) / ((fabs(1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.123f * (membrane_V + 14.2f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) + 0.00061f * (membrane_V + 38.9f) / ((fabs(native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.00138f * (membrane_V + 14.2f) / ((fabs(1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.123f * (membrane_V + 14.2f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.123f * (membrane_V + 14.2f))) + 0.00061f * (membrane_V + 38.9f) / ((fabs(native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.145f * (membrane_V + 38.9f)) - 1.0f));\n*_new_Kr_gate_Xr_gate = Kr_gate_Xr_gate + dt*(const_Q * (Kr_gate_Xr_inf - Kr_gate_Xr_gate) / ((fabs(Kr_gate_Xr_tau) < VERY_SMALL_NUMBER) ? ((Kr_gate_Xr_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kr_gate_Xr_tau));\n\n// Ks_gate_Xs1\nconst Real Ks_gate_Xs1_inf = 1.0f / ((fabs(1.0f + native_exp(-(membrane_V - 10.0f) / 20.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(-(membrane_V - 10.0f) / 20.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(-(membrane_V - 10.0f) / 20.0f));\nconst Real Ks_gate_Xs1_tau_phi = membrane_V + 30.0f;\nconst Real Ks_gate_Xs1_tau = 1.0f / ((fabs(7.19e-05f * Ks_gate_Xs1_tau_phi / ((fabs(1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) + 0.000131f * Ks_gate_Xs1_tau_phi / ((fabs(native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f)) < VERY_SMALL_NUMBER) ? ((7.19e-05f * Ks_gate_Xs1_tau_phi / ((fabs(1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) + 0.000131f * Ks_gate_Xs1_tau_phi / ((fabs(native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 7.19e-05f * Ks_gate_Xs1_tau_phi / ((fabs(1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.148f * Ks_gate_Xs1_tau_phi)) + 0.000131f * Ks_gate_Xs1_tau_phi / ((fabs(native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f) < VERY_SMALL_NUMBER) ? ((native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : native_exp(0.0687f * Ks_gate_Xs1_tau_phi) - 1.0f));\n*_new_Ks_gate_Xs1_gate = Ks_gate_Xs1_gate + dt*(const_Q * (Ks_gate_Xs1_inf - Ks_gate_Xs1_gate) / ((fabs(Ks_gate_Xs1_tau) < VERY_SMALL_NUMBER) ? ((Ks_gate_Xs1_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Ks_gate_Xs1_tau));\n\n// Kur_gate_ua\nconst Real Kur_gate_ua_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V + 12.5f) / -25.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 12.5f) / -25.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 12.5f) / -25.0f));\nconst Real Kur_gate_ua_tau = 0.493f * native_exp(-0.0629f * membrane_V) + 2.058f;\n*_new_Kur_gate_ua_gate = Kur_gate_ua_gate + dt*(const_Q * (Kur_gate_ua_inf - Kur_gate_ua_gate) / ((fabs(Kur_gate_ua_tau) < VERY_SMALL_NUMBER) ? ((Kur_gate_ua_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kur_gate_ua_tau));\n\n// Kur_gate_ui\nconst Real Kur_gate_ui_inf = 1.0f / ((fabs(1.0f + native_exp((membrane_V - 100.0f) / 5.7f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V - 100.0f) / 5.7f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V - 100.0f) / 5.7f));\nconst Real Kur_gate_ui_tau = 1200.0f - 170.0f / ((fabs(1.0f + native_exp((membrane_V + 45.2f) / 5.7f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 45.2f) / 5.7f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 45.2f) / 5.7f));\n*_new_Kur_gate_ui_gate = Kur_gate_ui_gate + dt*(const_Q * (Kur_gate_ui_inf - Kur_gate_ui_gate) / ((fabs(Kur_gate_ui_tau) < VERY_SMALL_NUMBER) ? ((Kur_gate_ui_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kur_gate_ui_tau));\n\n// NaK_gate_f\nconst Real NaK_gate_f_gate = 1.0f / ((fabs(1.0f + 0.1245f * native_exp(-0.1f * membrane_V / const_RTpF) + 0.0365f * NaK_gate_f_sigma * native_exp(-membrane_V / const_RTpF)) < VERY_SMALL_NUMBER) ? ((1.0f + 0.1245f * native_exp(-0.1f * membrane_V / const_RTpF) + 0.0365f * NaK_gate_f_sigma * native_exp(-membrane_V / const_RTpF) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + 0.1245f * native_exp(-0.1f * membrane_V / const_RTpF) + 0.0365f * NaK_gate_f_sigma * native_exp(-membrane_V / const_RTpF));\n\n// Na_gate_h\nconst Real Na_gate_h_alpha = ((membrane_V < -40.0f) ? 0.135f * native_exp((membrane_V + 70.0f) / -6.8f) : 0.0f);\nconst Real Na_gate_h_beta = ((membrane_V < -40.0f) ? 3.56f * native_exp(0.079f * membrane_V) + 310000.0f * native_exp(0.35f * membrane_V) : 1.0f / ((fabs(0.13f * (1.0f + native_exp((membrane_V + 10.66f) / -11.1f))) < VERY_SMALL_NUMBER) ? ((0.13f * (1.0f + native_exp((membrane_V + 10.66f) / -11.1f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.13f * (1.0f + native_exp((membrane_V + 10.66f) / -11.1f))));\nconst Real Na_gate_h_inf_arg = ((const_T > 300.0f) ? (78.0f + membrane_V) / 7.8f : (80.0f + membrane_V) / 9.2f);\nconst Real Na_gate_h_inf = 1.0f / ((fabs(1.0f + native_exp(Na_gate_h_inf_arg)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(Na_gate_h_inf_arg) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(Na_gate_h_inf_arg));\nconst Real Na_gate_h_tau = ((membrane_V < -40.0f) ? 0.06f / ((fabs(Na_gate_h_alpha + Na_gate_h_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_h_alpha + Na_gate_h_beta < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_alpha + Na_gate_h_beta) + 1.5f : 0.75f / ((fabs(Na_gate_h_alpha + Na_gate_h_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_h_alpha + Na_gate_h_beta < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_alpha + Na_gate_h_beta) + 0.15f);\n*_new_Na_gate_h_gate = Na_gate_h_gate + dt*(const_Q * (Na_gate_h_inf - Na_gate_h_gate) / ((fabs(Na_gate_h_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_h_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_tau));\n\n// Na_gate_m\nconst Real Na_gate_m_alpha = 0.32f * (membrane_V + 47.13f) / ((fabs(1.0f - native_exp(-0.1f * (membrane_V + 47.13f))) < VERY_SMALL_NUMBER) ? ((1.0f - native_exp(-0.1f * (membrane_V + 47.13f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f - native_exp(-0.1f * (membrane_V + 47.13f)));\nconst Real Na_gate_m_beta = 0.056f * native_exp(-membrane_V / 11.0f);\nconst Real Na_gate_m_inf = 1.0f / ((fabs(1.0f + native_exp((37.0f + membrane_V) / -6.8f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((37.0f + membrane_V) / -6.8f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((37.0f + membrane_V) / -6.8f));\nconst Real Na_gate_m_tau = 1.0f / ((fabs(Na_gate_m_alpha + Na_gate_m_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_m_alpha + Na_gate_m_beta < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_m_alpha + Na_gate_m_beta);\n*_new_Na_gate_m_gate = Na_gate_m_gate + dt*(const_Q * (Na_gate_m_inf - Na_gate_m_gate) / ((fabs(Na_gate_m_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_m_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_m_tau));\n\n// stimulus\nconst Real stimulus_I = engine_pace * stimulus_amplitude;\n\n// to_gate_s_slow\nconst Real to_gate_s_slow_inf = to_gate_s_inf;\nconst Real to_gate_s_slow_tau = 1000.0f * (3.7f * native_exp(-pow((membrane_V + 70.0f) / 30.0f, 2.0f)) + 0.035f) + 37.4f;\n*_new_to_gate_s_slow_gate = to_gate_s_slow_inf + (to_gate_s_slow_gate - to_gate_s_slow_inf) * native_exp(-(dt / to_gate_s_slow_tau));\n\n// Ks_gate_Xs2\nconst Real Ks_gate_Xs2_inf = Ks_gate_Xs1_inf;\nconst Real Ks_gate_Xs2_tau = 4.0f * Ks_gate_Xs1_tau;\n*_new_Ks_gate_Xs2_gate = Ks_gate_Xs2_gate + dt*(const_Q * (Ks_gate_Xs2_inf - Ks_gate_Xs2_gate) / ((fabs(Ks_gate_Xs2_tau) < VERY_SMALL_NUMBER) ? ((Ks_gate_Xs2_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Ks_gate_Xs2_tau));\n\n// Na_gate_j\nconst Real Na_gate_j_alpha = ((membrane_V < -40.0f) ? 2.0f * (-127140.0f * native_exp(0.2444f * membrane_V) - 3.474e-05f * native_exp(-0.04391f * membrane_V)) * (membrane_V + 37.78f) / ((fabs(1.0f + native_exp(0.311f * (membrane_V + 79.23f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(0.311f * (membrane_V + 79.23f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(0.311f * (membrane_V + 79.23f))) : 0.0f);\nconst Real Na_gate_j_beta = ((membrane_V < -40.0f) ? 0.1212f * native_exp(-0.01052f * membrane_V) / ((fabs(1.0f + native_exp(-0.1378f * (membrane_V + 40.14f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(-0.1378f * (membrane_V + 40.14f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(-0.1378f * (membrane_V + 40.14f))) : 0.3f * native_exp(-2.535e-07f * membrane_V) / ((fabs(1.0f + native_exp(-0.1f * (membrane_V + 32.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(-0.1f * (membrane_V + 32.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(-0.1f * (membrane_V + 32.0f))));\nconst Real Na_gate_j_inf = Na_gate_h_inf;\nconst Real Na_gate_j_tau = 1.0f / ((fabs(Na_gate_j_alpha + Na_gate_j_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_j_alpha + Na_gate_j_beta < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_j_alpha + Na_gate_j_beta);\n*_new_Na_gate_j_gate = Na_gate_j_gate + dt*(const_Q * (Na_gate_j_inf - Na_gate_j_gate) / ((fabs(Na_gate_j_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_j_tau < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_j_tau));\n\n// intra\n*_new_intra_CaNSR = intra_CaNSR + dt*((up_J - leak_J - tr_J) / volume_NSR);\nconst Real intra_CaJSR_beta = 1.0f / ((fabs(1.0f + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0f)));\n*_new_intra_CaJSR = intra_CaJSR + dt*(intra_CaJSR_beta * (tr_J - rel_J) / volume_JSR);\n\n// Nernst\nconst Real Nernst_Ca = const_RTpF / 2.0f * native_log(extra_Ca / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca));\n\n// Na\nconst Real Na_I = Na_G * pow(Na_gate_m_gate, 3.0f) * Na_gate_h_gate * Na_gate_j_gate * (membrane_V - Nernst_Na);\n\n// K1\nconst Real K1_I_phi = membrane_V - Nernst_K;\nconst Real K1_I = 0.0489f * (extra_K / (extra_K + 210.0f)) * (K1_I_phi - 10.0f) / ((fabs(1.0f + native_exp(0.041f * (K1_I_phi - 10.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp(0.041f * (K1_I_phi - 10.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp(0.041f * (K1_I_phi - 10.0f))) + 0.01f * K1_I_phi;\n\n// to\nconst Real to_I = to_G * to_gate_r_gate * (0.706f * to_gate_s_gate + 0.294f * to_gate_s_slow_gate) * (membrane_V - Nernst_K);\n\n// CaT\nconst Real CaT_I = CaT_G * CaT_gate_b_gate * CaT_gate_g_gate * (membrane_V - Nernst_Ca + 106.5f);\n\n// Cab\nconst Real Cab_I = Cab_G * (membrane_V - Nernst_Ca);\n\n// NCX\nconst Real NCX_I = NCX_k * (pow(intra_Na, 3.0f) * extra_Ca * native_exp(0.03743f * NCX_gamma * membrane_V) - pow(extra_Na, 3.0f) * intra_Ca * native_exp(0.03743f * (NCX_gamma - 1.0f) * membrane_V)) / ((fabs(1.0f + NCX_d * (pow(extra_Na, 3.0f) * intra_Ca + pow(intra_Na, 3.0f) * extra_Ca)) < VERY_SMALL_NUMBER) ? ((1.0f + NCX_d * (pow(extra_Na, 3.0f) * intra_Ca + pow(intra_Na, 3.0f) * extra_Ca) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + NCX_d * (pow(extra_Na, 3.0f) * intra_Ca + pow(intra_Na, 3.0f) * extra_Ca));\n\n// NaK\nconst Real NaK_I = NaK_Imax * NaK_gate_f_gate / ((1.0f + pow(NaK_K_Na / intra_Na, NaK_n)) * (1.0f + NaK_K_K / extra_K));\n\n// funny\nconst Real funny_IfK = funny_G * funny_gate_y_gate * (0.8f * (membrane_V - Nernst_K));\nconst Real funny_IfNa = funny_G * funny_gate_y_gate * (0.2f * (membrane_V - Nernst_Na));\nconst Real funny_I = funny_IfNa + funny_IfK;\n\n// Nab\nconst Real Nab_I = Nab_G * (membrane_V - Nernst_Na);\n\n// Kb\nconst Real Kb_I = 0.001f * Kb_G * (membrane_V - Nernst_K);\n\n// Kur\nconst Real Kur_I = Kur_G * Kur_gate_ua_gate * Kur_gate_ui_gate * (membrane_V - Nernst_K);\n\n// Ks\nconst Real Ks_G = 0.0866f * (1.0f + 0.6f / ((fabs(1.0f + pow(3.8e-05f / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4f)) < VERY_SMALL_NUMBER) ? ((1.0f + pow(3.8e-05f / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + pow(3.8e-05f / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4f)));\nconst Real Ks_I = Ks_G * Ks_gate_Xs1_gate * Ks_gate_Xs2_gate * (membrane_V - Nernst_Ks);\n\n// Kr\nconst Real Kr_I = Kr_G * Kr_gate_Xr_gate * Kr_gate_Rr_gate * (membrane_V - Nernst_K);\n\n// KACh\nconst Real KACh_I = 0.296f * (0.1f + 0.18f / ((fabs(1.0f + native_exp((membrane_V + 102.0f) / 10.0f)) < VERY_SMALL_NUMBER) ? ((1.0f + native_exp((membrane_V + 102.0f) / 10.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + native_exp((membrane_V + 102.0f) / 10.0f))) * (membrane_V - Nernst_K - 10.0f);\n\n// CaSL\nconst Real CaSL_J = (2.0f * NCX_I - CaL_I - CaT_I - Cab_I) * (membrane_A * membrane_C) / (const_F * 2e-06f);\n\n// *remaining*\nconst Real intra_Ca_beta = 1.0f / ((fabs(1.0f + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0f))) < VERY_SMALL_NUMBER) ? ((1.0f + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0f)) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0f + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0f)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0f)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0f) < 0.0f) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0f)));\n*_new_intra_Ca = intra_Ca + dt*(intra_Ca_beta * (CaSR_J + CaSL_J) / volume_myo);\nconst Real Ksus_I = 0.001f * (Kur_I + Ks_I + Kr_I);\nconst Real membrane_I = Na_I + CaL_I + K1_I + to_I + CaT_I + Cab_I + NCX_I + NaK_I + funny_I + Nab_I + Ksus_I + KACh_I + Kb_I;\n*_new_membrane_V = membrane_V + dt*(-(membrane_I + stimulus_I) / membrane_C);', 'code_double': '// CaT_gate_b\nconst Real CaT_gate_b_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 36.0) / -6.1)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 36.0) / -6.1) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 36.0) / -6.1));\nconst Real CaT_gate_b_tau = 0.6 + 5.4 / ((fabs(1.0 + exp(0.03 * (membrane_V + 100.0))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(0.03 * (membrane_V + 100.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(0.03 * (membrane_V + 100.0)));\n*_new_CaT_gate_b_gate = CaT_gate_b_inf + (CaT_gate_b_gate - CaT_gate_b_inf) * exp(-(dt / CaT_gate_b_tau));\n\n// CaT_gate_g\nconst Real CaT_gate_g_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 66.0) / 6.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 66.0) / 6.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 66.0) / 6.0));\nconst Real CaT_gate_g_tau = 1.0 + 40.0 / ((fabs(1.0 + exp(0.08 * (membrane_V + 65.0))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(0.08 * (membrane_V + 65.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(0.08 * (membrane_V + 65.0)));\n*_new_CaT_gate_g_gate = CaT_gate_g_inf + (CaT_gate_g_gate - CaT_gate_g_inf) * exp(-(dt / CaT_gate_g_tau));\n\n// Kr_gate_Rr\nconst Real Kr_gate_Rr_gate = 1.0 / ((fabs(1.0 + exp((membrane_V + 9.0) / 22.4)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 9.0) / 22.4) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 9.0) / 22.4));\n\n// funny_gate_y\nconst Real funny_gate_y_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 78.65) / 6.33)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 78.65) / 6.33) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 78.65) / 6.33));\nconst Real funny_gate_y_tau = 1000.0 / ((fabs(0.11885 * exp((membrane_V + 75.0) / 28.37) + 0.56236 * exp((membrane_V + 75.0) / -14.19)) < VERY_SMALL_NUMBER) ? ((0.11885 * exp((membrane_V + 75.0) / 28.37) + 0.56236 * exp((membrane_V + 75.0) / -14.19) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.11885 * exp((membrane_V + 75.0) / 28.37) + 0.56236 * exp((membrane_V + 75.0) / -14.19));\n*_new_funny_gate_y_gate = funny_gate_y_inf + (funny_gate_y_gate - funny_gate_y_inf) * exp(-(dt / funny_gate_y_tau));\n\n// leak\nconst Real leak_J = leak_k * (intra_CaNSR - intra_Ca);\n\n// rel\nconst Real rel_J = rel_nu1 * rel_gate_Po1_gate * (intra_CaJSR - intra_Ca);\n\n// rel_gate_Po1\nconst Real rel_gate_Po1_C1 = 1.0 - rel_gate_Po1_gate;\nconst Real rel_gate_Po1_K = 3.51 / ((fabs(1.0 + exp((intra_CaJSR - 530.0) / 200.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((intra_CaJSR - 530.0) / 200.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((intra_CaJSR - 530.0) / 200.0)) + 0.25;\n*_new_rel_gate_Po1_gate = rel_gate_Po1_gate + dt*(rel_gate_Po1_a * (pow(intra_Ca, rel_gate_Po1_N) / ((fabs(pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca, rel_gate_Po1_N) + pow(rel_gate_Po1_K, rel_gate_Po1_N))) * rel_gate_Po1_C1 - rel_gate_Po1_b * rel_gate_Po1_gate);\n\n// to_gate_r\nconst Real to_gate_r_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 3.0) / -12.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 3.0) / -12.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 3.0) / -12.0));\nconst Real to_gate_r_tau = 1000.0 / ((fabs(45.16 * exp(0.03577 * (membrane_V + 50.0)) + 98.9 * exp(-0.1 * (membrane_V + 38.0))) < VERY_SMALL_NUMBER) ? ((45.16 * exp(0.03577 * (membrane_V + 50.0)) + 98.9 * exp(-0.1 * (membrane_V + 38.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 45.16 * exp(0.03577 * (membrane_V + 50.0)) + 98.9 * exp(-0.1 * (membrane_V + 38.0)));\n*_new_to_gate_r_gate = to_gate_r_inf + (to_gate_r_gate - to_gate_r_inf) * exp(-(dt / to_gate_r_tau));\n\n// to_gate_s\nconst Real to_gate_s_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 31.97156) / 4.64291)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 31.97156) / 4.64291) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 31.97156) / 4.64291));\nconst Real to_gate_s_tau = 1000.0 * (0.35 * exp(-pow((membrane_V + 70.0) / 15.0, 2.0)) + 0.035) - 26.9;\n*_new_to_gate_s_gate = to_gate_s_inf + (to_gate_s_gate - to_gate_s_inf) * exp(-(dt / to_gate_s_tau));\n\n// tr\nconst Real tr_J = (intra_CaNSR - intra_CaJSR) / tr_tau;\n\n// up\nconst Real up_f = pow(intra_Ca / up_Kmf, up_Hf);\nconst Real up_r = pow(intra_CaNSR / up_Kmr, up_Hr);\nconst Real up_J = (up_Vmax * up_f - up_Vmax * up_r) / ((fabs(1.0 + up_f + up_r) < VERY_SMALL_NUMBER) ? ((1.0 + up_f + up_r < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + up_f + up_r);\n\n// CaL\nconst Real CaL_VF2pRT = 2.0 * membrane_V / const_RTpF;\nconst Real CaL_I = 2.0 * CaL_G * CaL_gate_d_gate * CaL_gate_f_gate * CaL_gate_fCa_gate * CaL_VF2pRT * const_F * (intra_Ca * exp(CaL_VF2pRT) - 0.341 * extra_Ca) / ((fabs(exp(CaL_VF2pRT) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(CaL_VF2pRT) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(CaL_VF2pRT) - 1.0);\n\n// CaL_gate_d\nconst Real CaL_gate_d_a = 0.25 + 1.4 / ((fabs(1.0 + exp((membrane_V + 35.0) / -13.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 35.0) / -13.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 35.0) / -13.0));\nconst Real CaL_gate_d_b = 1.4 / ((fabs(1.0 + exp((membrane_V + 5.0) / 5.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 5.0) / 5.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 5.0) / 5.0));\nconst Real CaL_gate_d_c = 1.0 / ((fabs(1.0 + exp((50.0 - membrane_V) / 20.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((50.0 - membrane_V) / 20.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((50.0 - membrane_V) / 20.0));\nconst Real CaL_gate_d_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 1.8) / -8.6)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 1.8) / -8.6) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 1.8) / -8.6));\nconst Real CaL_gate_d_tau = CaL_gate_d_a * CaL_gate_d_b + CaL_gate_d_c + 10.0;\n*_new_CaL_gate_d_gate = CaL_gate_d_gate + dt*(const_Q * (CaL_gate_d_inf - CaL_gate_d_gate) / ((fabs(CaL_gate_d_tau) < VERY_SMALL_NUMBER) ? ((CaL_gate_d_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : CaL_gate_d_tau));\n\n// CaL_gate_f\nconst Real CaL_gate_f_inf = 1.0 / ((fabs(1.0 + exp((22.0 + membrane_V) / 6.1)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((22.0 + membrane_V) / 6.1) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((22.0 + membrane_V) / 6.1));\nconst Real CaL_gate_f_tau = 562.5 * exp(pow(membrane_V + 27.0, 2.0) / -1000.0) + 10.0 / ((fabs(1.0 + exp(25.0 - membrane_V)) < VERY_SMALL_NUMBER) ? ((1.0 + exp(25.0 - membrane_V) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(25.0 - membrane_V)) + 10.0;\n*_new_CaL_gate_f_gate = CaL_gate_f_gate + dt*(const_Q * (CaL_gate_f_inf - CaL_gate_f_gate) / ((fabs(CaL_gate_f_tau) < VERY_SMALL_NUMBER) ? ((CaL_gate_f_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : CaL_gate_f_tau));\n\n// CaL_gate_fCa\nconst Real CaL_gate_fCa_a = 1.0 / ((fabs(1.0 + pow(intra_Ca / 0.325, 8.0)) < VERY_SMALL_NUMBER) ? ((1.0 + pow(intra_Ca / 0.325, 8.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + pow(intra_Ca / 0.325, 8.0));\nconst Real CaL_gate_fCa_b = 0.1 / ((fabs(1.0 + exp((intra_Ca - 0.5) / 0.1)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((intra_Ca - 0.5) / 0.1) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((intra_Ca - 0.5) / 0.1));\nconst Real CaL_gate_fCa_c = 0.2 / ((fabs(1.0 + exp((intra_Ca - 0.75) / 0.8)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((intra_Ca - 0.75) / 0.8) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((intra_Ca - 0.75) / 0.8));\nconst Real CaL_gate_fCa_inf = (CaL_gate_fCa_a + CaL_gate_fCa_b + CaL_gate_fCa_c + 0.23) / 1.46;\nconst Real CaL_gate_fCa_k = (((CaL_gate_fCa_inf > CaL_gate_fCa_gate) && (membrane_V > -60.0)) ? 0.0 : 1.0);\n*_new_CaL_gate_fCa_gate = CaL_gate_fCa_gate + dt*(const_Q * CaL_gate_fCa_k * (CaL_gate_fCa_inf - CaL_gate_fCa_gate) / CaL_gate_fCa_tau);\n\n// CaSR\nconst Real CaSR_J = rel_J - up_J + leak_J;\n\n// Kr_gate_Xr\nconst Real Kr_gate_Xr_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 12.5) / -10.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 12.5) / -10.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 12.5) / -10.0));\nconst Real Kr_gate_Xr_tau = 1.0 / ((fabs(0.00138 * (membrane_V + 14.2) / ((fabs(1.0 - exp(-0.123 * (membrane_V + 14.2))) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.123 * (membrane_V + 14.2)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.123 * (membrane_V + 14.2))) + 0.00061 * (membrane_V + 38.9) / ((fabs(exp(0.145 * (membrane_V + 38.9)) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.145 * (membrane_V + 38.9)) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.145 * (membrane_V + 38.9)) - 1.0)) < VERY_SMALL_NUMBER) ? ((0.00138 * (membrane_V + 14.2) / ((fabs(1.0 - exp(-0.123 * (membrane_V + 14.2))) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.123 * (membrane_V + 14.2)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.123 * (membrane_V + 14.2))) + 0.00061 * (membrane_V + 38.9) / ((fabs(exp(0.145 * (membrane_V + 38.9)) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.145 * (membrane_V + 38.9)) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.145 * (membrane_V + 38.9)) - 1.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.00138 * (membrane_V + 14.2) / ((fabs(1.0 - exp(-0.123 * (membrane_V + 14.2))) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.123 * (membrane_V + 14.2)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.123 * (membrane_V + 14.2))) + 0.00061 * (membrane_V + 38.9) / ((fabs(exp(0.145 * (membrane_V + 38.9)) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.145 * (membrane_V + 38.9)) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.145 * (membrane_V + 38.9)) - 1.0));\n*_new_Kr_gate_Xr_gate = Kr_gate_Xr_gate + dt*(const_Q * (Kr_gate_Xr_inf - Kr_gate_Xr_gate) / ((fabs(Kr_gate_Xr_tau) < VERY_SMALL_NUMBER) ? ((Kr_gate_Xr_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kr_gate_Xr_tau));\n\n// Ks_gate_Xs1\nconst Real Ks_gate_Xs1_inf = 1.0 / ((fabs(1.0 + exp(-(membrane_V - 10.0) / 20.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp(-(membrane_V - 10.0) / 20.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(-(membrane_V - 10.0) / 20.0));\nconst Real Ks_gate_Xs1_tau_phi = membrane_V + 30.0;\nconst Real Ks_gate_Xs1_tau = 1.0 / ((fabs(7.19e-05 * Ks_gate_Xs1_tau_phi / ((fabs(1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) + 0.000131 * Ks_gate_Xs1_tau_phi / ((fabs(exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0)) < VERY_SMALL_NUMBER) ? ((7.19e-05 * Ks_gate_Xs1_tau_phi / ((fabs(1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) + 0.000131 * Ks_gate_Xs1_tau_phi / ((fabs(exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 7.19e-05 * Ks_gate_Xs1_tau_phi / ((fabs(1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.148 * Ks_gate_Xs1_tau_phi)) + 0.000131 * Ks_gate_Xs1_tau_phi / ((fabs(exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(0.0687 * Ks_gate_Xs1_tau_phi) - 1.0));\n*_new_Ks_gate_Xs1_gate = Ks_gate_Xs1_gate + dt*(const_Q * (Ks_gate_Xs1_inf - Ks_gate_Xs1_gate) / ((fabs(Ks_gate_Xs1_tau) < VERY_SMALL_NUMBER) ? ((Ks_gate_Xs1_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Ks_gate_Xs1_tau));\n\n// Kur_gate_ua\nconst Real Kur_gate_ua_inf = 1.0 / ((fabs(1.0 + exp((membrane_V + 12.5) / -25.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 12.5) / -25.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 12.5) / -25.0));\nconst Real Kur_gate_ua_tau = 0.493 * exp(-0.0629 * membrane_V) + 2.058;\n*_new_Kur_gate_ua_gate = Kur_gate_ua_gate + dt*(const_Q * (Kur_gate_ua_inf - Kur_gate_ua_gate) / ((fabs(Kur_gate_ua_tau) < VERY_SMALL_NUMBER) ? ((Kur_gate_ua_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kur_gate_ua_tau));\n\n// Kur_gate_ui\nconst Real Kur_gate_ui_inf = 1.0 / ((fabs(1.0 + exp((membrane_V - 100.0) / 5.7)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V - 100.0) / 5.7) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V - 100.0) / 5.7));\nconst Real Kur_gate_ui_tau = 1200.0 - 170.0 / ((fabs(1.0 + exp((membrane_V + 45.2) / 5.7)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 45.2) / 5.7) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 45.2) / 5.7));\n*_new_Kur_gate_ui_gate = Kur_gate_ui_gate + dt*(const_Q * (Kur_gate_ui_inf - Kur_gate_ui_gate) / ((fabs(Kur_gate_ui_tau) < VERY_SMALL_NUMBER) ? ((Kur_gate_ui_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Kur_gate_ui_tau));\n\n// NaK_gate_f\nconst Real NaK_gate_f_gate = 1.0 / ((fabs(1.0 + 0.1245 * exp(-0.1 * membrane_V / const_RTpF) + 0.0365 * NaK_gate_f_sigma * exp(-membrane_V / const_RTpF)) < VERY_SMALL_NUMBER) ? ((1.0 + 0.1245 * exp(-0.1 * membrane_V / const_RTpF) + 0.0365 * NaK_gate_f_sigma * exp(-membrane_V / const_RTpF) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + 0.1245 * exp(-0.1 * membrane_V / const_RTpF) + 0.0365 * NaK_gate_f_sigma * exp(-membrane_V / const_RTpF));\n\n// Na_gate_h\nconst Real Na_gate_h_alpha = ((membrane_V < -40.0) ? 0.135 * exp((membrane_V + 70.0) / -6.8) : 0.0);\nconst Real Na_gate_h_beta = ((membrane_V < -40.0) ? 3.56 * exp(0.079 * membrane_V) + 310000.0 * exp(0.35 * membrane_V) : 1.0 / ((fabs(0.13 * (1.0 + exp((membrane_V + 10.66) / -11.1))) < VERY_SMALL_NUMBER) ? ((0.13 * (1.0 + exp((membrane_V + 10.66) / -11.1)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.13 * (1.0 + exp((membrane_V + 10.66) / -11.1))));\nconst Real Na_gate_h_inf_arg = ((const_T > 300.0) ? (78.0 + membrane_V) / 7.8 : (80.0 + membrane_V) / 9.2);\nconst Real Na_gate_h_inf = 1.0 / ((fabs(1.0 + exp(Na_gate_h_inf_arg)) < VERY_SMALL_NUMBER) ? ((1.0 + exp(Na_gate_h_inf_arg) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(Na_gate_h_inf_arg));\nconst Real Na_gate_h_tau = ((membrane_V < -40.0) ? 0.06 / ((fabs(Na_gate_h_alpha + Na_gate_h_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_h_alpha + Na_gate_h_beta < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_alpha + Na_gate_h_beta) + 1.5 : 0.75 / ((fabs(Na_gate_h_alpha + Na_gate_h_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_h_alpha + Na_gate_h_beta < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_alpha + Na_gate_h_beta) + 0.15);\n*_new_Na_gate_h_gate = Na_gate_h_gate + dt*(const_Q * (Na_gate_h_inf - Na_gate_h_gate) / ((fabs(Na_gate_h_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_h_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_h_tau));\n\n// Na_gate_m\nconst Real Na_gate_m_alpha = 0.32 * (membrane_V + 47.13) / ((fabs(1.0 - exp(-0.1 * (membrane_V + 47.13))) < VERY_SMALL_NUMBER) ? ((1.0 - exp(-0.1 * (membrane_V + 47.13)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 - exp(-0.1 * (membrane_V + 47.13)));\nconst Real Na_gate_m_beta = 0.056 * exp(-membrane_V / 11.0);\nconst Real Na_gate_m_inf = 1.0 / ((fabs(1.0 + exp((37.0 + membrane_V) / -6.8)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((37.0 + membrane_V) / -6.8) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((37.0 + membrane_V) / -6.8));\nconst Real Na_gate_m_tau = 1.0 / ((fabs(Na_gate_m_alpha + Na_gate_m_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_m_alpha + Na_gate_m_beta < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_m_alpha + Na_gate_m_beta);\n*_new_Na_gate_m_gate = Na_gate_m_gate + dt*(const_Q * (Na_gate_m_inf - Na_gate_m_gate) / ((fabs(Na_gate_m_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_m_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_m_tau));\n\n// stimulus\nconst Real stimulus_I = engine_pace * stimulus_amplitude;\n\n// to_gate_s_slow\nconst Real to_gate_s_slow_inf = to_gate_s_inf;\nconst Real to_gate_s_slow_tau = 1000.0 * (3.7 * exp(-pow((membrane_V + 70.0) / 30.0, 2.0)) + 0.035) + 37.4;\n*_new_to_gate_s_slow_gate = to_gate_s_slow_inf + (to_gate_s_slow_gate - to_gate_s_slow_inf) * exp(-(dt / to_gate_s_slow_tau));\n\n// Ks_gate_Xs2\nconst Real Ks_gate_Xs2_inf = Ks_gate_Xs1_inf;\nconst Real Ks_gate_Xs2_tau = 4.0 * Ks_gate_Xs1_tau;\n*_new_Ks_gate_Xs2_gate = Ks_gate_Xs2_gate + dt*(const_Q * (Ks_gate_Xs2_inf - Ks_gate_Xs2_gate) / ((fabs(Ks_gate_Xs2_tau) < VERY_SMALL_NUMBER) ? ((Ks_gate_Xs2_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Ks_gate_Xs2_tau));\n\n// Na_gate_j\nconst Real Na_gate_j_alpha = ((membrane_V < -40.0) ? 2.0 * (-127140.0 * exp(0.2444 * membrane_V) - 3.474e-05 * exp(-0.04391 * membrane_V)) * (membrane_V + 37.78) / ((fabs(1.0 + exp(0.311 * (membrane_V + 79.23))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(0.311 * (membrane_V + 79.23)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(0.311 * (membrane_V + 79.23))) : 0.0);\nconst Real Na_gate_j_beta = ((membrane_V < -40.0) ? 0.1212 * exp(-0.01052 * membrane_V) / ((fabs(1.0 + exp(-0.1378 * (membrane_V + 40.14))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(-0.1378 * (membrane_V + 40.14)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(-0.1378 * (membrane_V + 40.14))) : 0.3 * exp(-2.535e-07 * membrane_V) / ((fabs(1.0 + exp(-0.1 * (membrane_V + 32.0))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(-0.1 * (membrane_V + 32.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(-0.1 * (membrane_V + 32.0))));\nconst Real Na_gate_j_inf = Na_gate_h_inf;\nconst Real Na_gate_j_tau = 1.0 / ((fabs(Na_gate_j_alpha + Na_gate_j_beta) < VERY_SMALL_NUMBER) ? ((Na_gate_j_alpha + Na_gate_j_beta < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_j_alpha + Na_gate_j_beta);\n*_new_Na_gate_j_gate = Na_gate_j_gate + dt*(const_Q * (Na_gate_j_inf - Na_gate_j_gate) / ((fabs(Na_gate_j_tau) < VERY_SMALL_NUMBER) ? ((Na_gate_j_tau < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : Na_gate_j_tau));\n\n// intra\n*_new_intra_CaNSR = intra_CaNSR + dt*((up_J - leak_J - tr_J) / volume_NSR);\nconst Real intra_CaJSR_beta = 1.0 / ((fabs(1.0 + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0))) < VERY_SMALL_NUMBER) ? ((1.0 + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + intra_CaJSR_beta_CSQN * intra_CaJSR_beta_KmCSQN / ((fabs(pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_CaJSR + intra_CaJSR_beta_KmCSQN, 2.0)));\n*_new_intra_CaJSR = intra_CaJSR + dt*(intra_CaJSR_beta * (tr_J - rel_J) / volume_JSR);\n\n// Nernst\nconst Real Nernst_Ca = const_RTpF / 2.0 * log(extra_Ca / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca));\n\n// Na\nconst Real Na_I = Na_G * pow(Na_gate_m_gate, 3.0) * Na_gate_h_gate * Na_gate_j_gate * (membrane_V - Nernst_Na);\n\n// K1\nconst Real K1_I_phi = membrane_V - Nernst_K;\nconst Real K1_I = 0.0489 * (extra_K / (extra_K + 210.0)) * (K1_I_phi - 10.0) / ((fabs(1.0 + exp(0.041 * (K1_I_phi - 10.0))) < VERY_SMALL_NUMBER) ? ((1.0 + exp(0.041 * (K1_I_phi - 10.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp(0.041 * (K1_I_phi - 10.0))) + 0.01 * K1_I_phi;\n\n// to\nconst Real to_I = to_G * to_gate_r_gate * (0.706 * to_gate_s_gate + 0.294 * to_gate_s_slow_gate) * (membrane_V - Nernst_K);\n\n// CaT\nconst Real CaT_I = CaT_G * CaT_gate_b_gate * CaT_gate_g_gate * (membrane_V - Nernst_Ca + 106.5);\n\n// Cab\nconst Real Cab_I = Cab_G * (membrane_V - Nernst_Ca);\n\n// NCX\nconst Real NCX_I = NCX_k * (pow(intra_Na, 3.0) * extra_Ca * exp(0.03743 * NCX_gamma * membrane_V) - pow(extra_Na, 3.0) * intra_Ca * exp(0.03743 * (NCX_gamma - 1.0) * membrane_V)) / ((fabs(1.0 + NCX_d * (pow(extra_Na, 3.0) * intra_Ca + pow(intra_Na, 3.0) * extra_Ca)) < VERY_SMALL_NUMBER) ? ((1.0 + NCX_d * (pow(extra_Na, 3.0) * intra_Ca + pow(intra_Na, 3.0) * extra_Ca) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + NCX_d * (pow(extra_Na, 3.0) * intra_Ca + pow(intra_Na, 3.0) * extra_Ca));\n\n// NaK\nconst Real NaK_I = NaK_Imax * NaK_gate_f_gate / ((1.0 + pow(NaK_K_Na / intra_Na, NaK_n)) * (1.0 + NaK_K_K / extra_K));\n\n// funny\nconst Real funny_IfK = funny_G * funny_gate_y_gate * (0.8 * (membrane_V - Nernst_K));\nconst Real funny_IfNa = funny_G * funny_gate_y_gate * (0.2 * (membrane_V - Nernst_Na));\nconst Real funny_I = funny_IfNa + funny_IfK;\n\n// Nab\nconst Real Nab_I = Nab_G * (membrane_V - Nernst_Na);\n\n// Kb\nconst Real Kb_I = 0.001 * Kb_G * (membrane_V - Nernst_K);\n\n// Kur\nconst Real Kur_I = Kur_G * Kur_gate_ua_gate * Kur_gate_ui_gate * (membrane_V - Nernst_K);\n\n// Ks\nconst Real Ks_G = 0.0866 * (1.0 + 0.6 / ((fabs(1.0 + pow(3.8e-05 / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4)) < VERY_SMALL_NUMBER) ? ((1.0 + pow(3.8e-05 / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + pow(3.8e-05 / ((fabs(intra_Ca) < VERY_SMALL_NUMBER) ? ((intra_Ca < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : intra_Ca), 1.4)));\nconst Real Ks_I = Ks_G * Ks_gate_Xs1_gate * Ks_gate_Xs2_gate * (membrane_V - Nernst_Ks);\n\n// Kr\nconst Real Kr_I = Kr_G * Kr_gate_Xr_gate * Kr_gate_Rr_gate * (membrane_V - Nernst_K);\n\n// KACh\nconst Real KACh_I = 0.296 * (0.1 + 0.18 / ((fabs(1.0 + exp((membrane_V + 102.0) / 10.0)) < VERY_SMALL_NUMBER) ? ((1.0 + exp((membrane_V + 102.0) / 10.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + exp((membrane_V + 102.0) / 10.0))) * (membrane_V - Nernst_K - 10.0);\n\n// CaSL\nconst Real CaSL_J = (2.0 * NCX_I - CaL_I - CaT_I - Cab_I) * (membrane_A * membrane_C) / (const_F * 2e-06);\n\n// *remaining*\nconst Real intra_Ca_beta = 1.0 / ((fabs(1.0 + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0))) < VERY_SMALL_NUMBER) ? ((1.0 + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 1.0 + intra_Ca_beta_TRPN * intra_Ca_beta_KT / ((fabs(pow(intra_Ca + intra_Ca_beta_KT, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KT, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KT, 2.0)) + intra_Ca_beta_CMDN * intra_Ca_beta_KC / ((fabs(pow(intra_Ca + intra_Ca_beta_KC, 2.0)) < VERY_SMALL_NUMBER) ? ((pow(intra_Ca + intra_Ca_beta_KC, 2.0) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : pow(intra_Ca + intra_Ca_beta_KC, 2.0)));\n*_new_intra_Ca = intra_Ca + dt*(intra_Ca_beta * (CaSR_J + CaSL_J) / volume_myo);\nconst Real Ksus_I = 0.001 * (Kur_I + Ks_I + Kr_I);\nconst Real membrane_I = Na_I + CaL_I + K1_I + to_I + CaT_I + Cab_I + NCX_I + NaK_I + funny_I + Nab_I + Ksus_I + KACh_I + Kb_I;\n*_new_membrane_V = membrane_V + dt*(-(membrane_I + stimulus_I) / membrane_C);'}, 'marcotte2017dynamical': {'name': 'Marcotte & Grigoriev 2017', 'description': 'Smoothed version of the Karma model as published by Marcotte & Grigoriev in 2017.\nIn it, a single spiral wave breaks up into spiral wave chaos due to amplification\nof the alternans instability. It can be used as a model of the transition from\ntachycardia to fibrillation.\n', 'dois': ['https://doi.org/10.1063/1.5003259', 'https://doi.org/10.1063/1.4915143', 'https://doi.org/10.1103/PhysRevLett.71.1103', 'https://doi.org/10.1063/1.166024'], 'keywords': ['excitable media', 'electrophysiology', 'heart', 'phenomenological'], 'variables': {'u': 0.0, 'v': 0.0}, 'diffusivity': {'u': 1.0, 'v': 0.05}, 'parameters': {'beta': 1.389, 'eps': 0.01, 'ustar': 1.5415}, 'code': 'const Real e = exp(2. * (1.2571 * (u - 1.)));\nconst Real V = eps * (beta * ((1. + (e - 1.) / (e + 1.)) / 2.) + (1. + (exp(2. * (1.2571 * (v - 1.))) - 1.) / (exp(2. * (1.2571 * (v - 1.))) + 1.)) / 2. * (v - 1.) - v);\nconst Real U = (ustar - v * v * v * v) * (1. - (exp(2. * (u - 3.)) - 1.) / (exp(2. * (u - 3.)) + 1.)) * u * u / 2. - u;\n*_new_u = u + dt * (U + _diffuse_u);\n*_new_v = v + dt * (V + _diffuse_v);\n'}, 'paci2013computational': {'name': 'Paci et al. 2013', 'description': 'This model comprises two electrophysiological models of human induced\npluripotent stem cell-derived cardiomyocytes (hiPSC-CMs), distinguishing\nbetween ventricular-like (default parameters) and atrial-like phenotypes.\nBased on experimental data from Ma et al. (2011), the models reproduce\nspontaneous action potentials and responses to current blockers. They were\ndeveloped to investigate the immature electrophysiological characteristics of\nhiPSC-CMs and the ionic mechanisms underlying their spontaneous activity and\nlong AP durations. The model uses a Hodgkin–Huxley framework and was\nconstructed to support drug testing and cardiac maturation studies.\n', 'dois': ['https://doi.org/10.1007/s10439-013-0833-3'], 'variables': {'Vm': -0.0743340057623841, 'm': 0.102953468725004, 'h': 0.786926637881461, 'j': 0.253943221774722, 'd': 8.96088425225182e-05, 'f1': 0.970411811263976, 'f2': 0.999965815466749, 'fCa': 0.998925296531804, 'Xr1': 0.00778547011240132, 'Xr2': 0.432162576531617, 'Xs': 0.0322944866983666, 'Xf': 0.100615100568753, 'q': 0.839295925773219, 'r': 0.00573289893326379, 'Nai': 10.9248496211574, 'Cai': 1.80773974140477e-05, 'Ca_SR': 0.2734234751931, 'g': 0.999999981028517}, 'diffusivity': {'Vm': 1.0}, 'parameters': {'calcium_dynamics_Buf_C': 0.25, 'calcium_dynamics_Buf_SR': 10.0, 'calcium_dynamics_Kbuf_C': 0.001, 'calcium_dynamics_Kbuf_SR': 0.3, 'calcium_dynamics_Kup': 0.00025, 'calcium_dynamics_V_leak': 0.00044444, 'calcium_dynamics_VmaxUp': 0.56064, 'calcium_dynamics_a_rel': 16.464, 'calcium_dynamics_b_rel': 0.25, 'calcium_dynamics_c_rel': 8.232, 'calcium_dynamics_g_factor': 0.0411, 'calcium_dynamics_tau_g': 0.002, 'electric_potentials_E_K': -0.08880285397707481, 'electric_potentials_PkNa': 0.03, 'i_CaL_d_gate_offset_d': 9.1, 'i_CaL_f1_gate_offset_f1': 26.0, 'i_CaL_f2_gate_constf2': 1.0, 'i_CaL_f2_gate_offset_f2': 35.0, 'i_CaL_fCa_gate_tau_fCa': 0.002, 'i_CaL_g_CaL': 8.635702e-05, 'i_CaL_nifed_coeff': 1.0, 'i_K1_g_K1': 28.1492, 'i_Kr_E4031_coeff': 1.0, 'i_Kr_Xr1_gate_L0': 0.025, 'i_Kr_Xr1_gate_Q': 2.3, 'i_Kr_Xr1_gate_V_half': -20.69505995297709, 'i_Kr_g_Kr': 29.8667, 'i_Ks_Chromanol_coeff': 1.0, 'i_Ks_g_Ks': 2.041, 'i_NaCa_KmCa': 1.38, 'i_NaCa_KmNai': 87.5, 'i_NaCa_Ksat': 0.1, 'i_NaCa_alpha': 2.8571432, 'i_NaCa_gamma': 0.35, 'i_NaCa_kNaCa': 4900.0, 'i_NaK_Km_K': 1.0, 'i_NaK_Km_Na': 40.0, 'i_NaK_PNaK': 1.841424, 'i_Na_TTX_coeff': 1.0, 'i_Na_g_Na': 3671.2302, 'i_PCa_KPCa': 0.0005, 'i_PCa_g_PCa': 0.4125, 'i_b_Ca_g_b_Ca': 0.69264, 'i_b_Na_g_b_Na': 0.9, 'i_f_E_f': -0.017, 'i_f_g_f': 30.10312, 'i_to_g_to': 29.9038, 'model_parameters_Cao': 1.8, 'model_parameters_Cm': 9.87109e-11, 'model_parameters_F': 96485.3415, 'model_parameters_Ki': 150.0, 'model_parameters_Ko': 5.4, 'model_parameters_Nao': 151.0, 'model_parameters_R': 8.314472, 'model_parameters_T': 310.0, 'model_parameters_V_SR': 583.73, 'model_parameters_Vc': 8800.0}, 'initial values': {'ventricular': {'Vm': -0.0743340057623841, 'm': 0.102953468725004, 'h': 0.786926637881461, 'j': 0.253943221774722, 'd': 8.96088425225182e-05, 'f1': 0.970411811263976, 'f2': 0.999965815466749, 'fCa': 0.998925296531804, 'Xr1': 0.00778547011240132, 'Xr2': 0.432162576531617, 'Xs': 0.0322944866983666, 'Xf': 0.100615100568753, 'q': 0.839295925773219, 'r': 0.00573289893326379, 'Nai': 10.9248496211574, 'Cai': 1.80773974140477e-05, 'Ca_SR': 0.2734234751931, 'g': 0.999999981028517}, 'atrial': {'Vm': -0.068733823452164, 'm': 0.141183142078492, 'h': 0.642108593994587, 'j': 0.173566329483423, 'd': 0.000127632520741878, 'f1': 0.98038400433601, 'f2': 0.999953006710394, 'fCa': 0.997346890768643, 'Xr1': 0.0257889110986083, 'Xr2': 0.405046678739985, 'Xs': 0.0447460799149437, 'Xf': 0.0607988713874682, 'q': 0.776163826643278, 'r': 0.000503296941001262, 'Nai': 14.4424010544424, 'Cai': 4.49232909234503e-05, 'Ca_SR': 0.149980051221604, 'g': 1.0}}, 'parameter sets': {'ventricular': {'calcium_dynamics_VmaxUp': 0.56064, 'calcium_dynamics_g_factor': 0.0411, 'i_CaL_d_gate_offset_d': 9.1, 'i_CaL_f1_gate_offset_f1': 26.0, 'i_CaL_f2_gate_constf2': 1.0, 'i_CaL_f2_gate_offset_f2': 35.0, 'i_K1_g_K1': 28.1492, 'i_NaCa_kNaCa': 4900.0, 'i_NaK_PNaK': 1.841424, 'i_Na_g_Na': 3671.2302, 'i_to_g_to': 29.9038, 'model_parameters_Cm': 9.87109e-11, 'model_parameters_V_SR': 583.73, 'model_parameters_Vc': 8800.0}, 'atrial': {'calcium_dynamics_VmaxUp': 0.22, 'calcium_dynamics_g_factor': 0.0556, 'i_CaL_d_gate_offset_d': 5.986, 'i_CaL_f1_gate_offset_f1': 25.226, 'i_CaL_f2_gate_constf2': 2.0, 'i_CaL_f2_gate_offset_f2': 31.226, 'i_K1_g_K1': 19.1925, 'i_NaCa_kNaCa': 2450.0, 'i_NaK_PNaK': 1.4731392, 'i_Na_g_Na': 6646.185, 'i_to_g_to': 59.8077, 'model_parameters_Cm': 7.86671e-11, 'model_parameters_V_SR': 465.2, 'model_parameters_Vc': 7012.0}}, 'code': '// i_CaL_d_gate\nconst Real i_CaL_d_gate_alpha_d = 0.25 + 1.4 / (1.0 + exp((-Vm * 1000.0 - 35.0) / 13.0));\nconst Real i_CaL_d_gate_beta_d = 1.4 / (1.0 + exp((Vm * 1000.0 + 5.0) / 5.0));\nconst Real i_CaL_d_gate_d_infinity = 1.0 / (1.0 + exp(-(Vm * 1000.0 + i_CaL_d_gate_offset_d) / 7.0));\nconst Real i_CaL_d_gate_gamma_d = 1.0 / (1.0 + exp((-Vm * 1000.0 + 50.0) / 20.0));\nconst Real i_CaL_d_gate_tau_d = (i_CaL_d_gate_alpha_d * i_CaL_d_gate_beta_d + i_CaL_d_gate_gamma_d) * 1.0 / 1000.0;\n*_new_d = i_CaL_d_gate_d_infinity + (d - i_CaL_d_gate_d_infinity) * exp(-(dt / i_CaL_d_gate_tau_d));\n\n// i_CaL_f1_gate\nconst Real i_CaL_f1_gate_f1_inf = 1.0 / (1.0 + exp((Vm * 1000.0 + i_CaL_f1_gate_offset_f1) / 3.0));\nconst Real i_CaL_f1_gate_constf1 = ((i_CaL_f1_gate_f1_inf - f1 > 0.0) ? 1.0 + 1433.0 * (Cai - 50.0 * 1e-06) : 1.0);\nconst Real i_CaL_f1_gate_tau_f1 = (20.0 + (1102.5 * exp(-pow(pow(Vm * 1000.0 + 27.0, 2.0) / 15.0, 2.0)) + (200.0 / (1.0 + exp((13.0 - Vm * 1000.0) / 10.0)) + 180.0 / (1.0 + exp((30.0 + Vm * 1000.0) / 10.0))))) * i_CaL_f1_gate_constf1 / 1000.0;\n*_new_f1 = i_CaL_f1_gate_f1_inf + (f1 - i_CaL_f1_gate_f1_inf) * exp(-(dt / i_CaL_f1_gate_tau_f1));\n\n// i_CaL_f2_gate\nconst Real i_CaL_f2_gate_f2_inf = 0.33 + 0.67 / (1.0 + exp((Vm * 1000.0 + i_CaL_f2_gate_offset_f2) / 4.0));\nconst Real i_CaL_f2_gate_tau_f2 = (600.0 * exp(-pow(Vm * 1000.0 + 25.0, 2.0) / 170.0) + (31.0 / (1.0 + exp((25.0 - Vm * 1000.0) / 10.0)) + 16.0 / (1.0 + exp((30.0 + Vm * 1000.0) / 10.0)))) * i_CaL_f2_gate_constf2 / 1000.0;\n*_new_f2 = i_CaL_f2_gate_f2_inf + (f2 - i_CaL_f2_gate_f2_inf) * exp(-(dt / i_CaL_f2_gate_tau_f2));\n\n// i_CaL_fCa_gate\nconst Real i_CaL_fCa_gate_alpha_fCa = 1.0 / (1.0 + pow(Cai / 0.0006, 8.0));\nconst Real i_CaL_fCa_gate_beta_fCa = 0.1 / (1.0 + exp((Cai - 0.0009) / 0.0001));\nconst Real i_CaL_fCa_gate_gamma_fCa = 0.3 / (1.0 + exp((Cai - 0.00075) / 0.0008));\nconst Real i_CaL_fCa_gate_fCa_inf = (i_CaL_fCa_gate_alpha_fCa + (i_CaL_fCa_gate_beta_fCa + i_CaL_fCa_gate_gamma_fCa)) / 1.3156;\nconst Real i_CaL_fCa_gate_constfCa = (((Vm > -0.06) && (i_CaL_fCa_gate_fCa_inf > fCa)) ? 0.0 : 1.0);\n*_new_fCa = fCa + dt*(i_CaL_fCa_gate_constfCa * (i_CaL_fCa_gate_fCa_inf - fCa) / i_CaL_fCa_gate_tau_fCa);\n\n// i_Kr_Xr2_gate\nconst Real i_Kr_Xr2_gate_Xr2_infinity = 1.0 / (1.0 + exp((Vm * 1000.0 + 88.0) / 50.0));\nconst Real i_Kr_Xr2_gate_alpha_Xr2 = 3.0 / (1.0 + exp((-60.0 - Vm * 1000.0) / 20.0));\nconst Real i_Kr_Xr2_gate_beta_Xr2 = 1.12 / (1.0 + exp((-60.0 + Vm * 1000.0) / 20.0));\nconst Real i_Kr_Xr2_gate_tau_Xr2 = 1.0 * (i_Kr_Xr2_gate_alpha_Xr2 * i_Kr_Xr2_gate_beta_Xr2) / 1000.0;\n*_new_Xr2 = i_Kr_Xr2_gate_Xr2_infinity + (Xr2 - i_Kr_Xr2_gate_Xr2_infinity) * exp(-(dt / i_Kr_Xr2_gate_tau_Xr2));\n\n// i_Ks_Xs_gate\nconst Real i_Ks_Xs_gate_Xs_infinity = 1.0 / (1.0 + exp((-Vm * 1000.0 - 20.0) / 16.0));\nconst Real i_Ks_Xs_gate_alpha_Xs = 1100.0 / (sqrt(1.0 + exp((-10.0 - Vm * 1000.0) / 6.0)));\nconst Real i_Ks_Xs_gate_beta_Xs = 1.0 / (1.0 + exp((-60.0 + Vm * 1000.0) / 20.0));\nconst Real i_Ks_Xs_gate_tau_Xs = 1.0 * (i_Ks_Xs_gate_alpha_Xs * i_Ks_Xs_gate_beta_Xs) / 1000.0;\n*_new_Xs = i_Ks_Xs_gate_Xs_infinity + (Xs - i_Ks_Xs_gate_Xs_infinity) * exp(-(dt / i_Ks_Xs_gate_tau_Xs));\n\n// i_Na_h_gate\nconst Real i_Na_h_gate_alpha_h = ((Vm < -0.04) ? 0.057 * exp(-(Vm * 1000.0 + 80.0) / 6.8) : 0.0);\nconst Real i_Na_h_gate_beta_h = ((Vm < -0.04) ? 2.7 * exp(0.079 * (Vm * 1000.0)) + 3.1 * (pow(10.0, 5.0) * exp(0.3485 * (Vm * 1000.0))) : 0.77 / ((fabs(0.13 * (1.0 + exp((Vm * 1000.0 + 10.66) / -11.1))) < VERY_SMALL_NUMBER) ? ((0.13 * (1.0 + exp((Vm * 1000.0 + 10.66) / -11.1)) < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : 0.13 * (1.0 + exp((Vm * 1000.0 + 10.66) / -11.1))));\nconst Real i_Na_h_gate_h_inf = 1.0 / (sqrt(1.0 + exp((Vm * 1000.0 + 72.1) / 5.7)));\nconst Real i_Na_h_gate_tau_h = ((Vm < -0.04) ? 1.5 / ((i_Na_h_gate_alpha_h + i_Na_h_gate_beta_h) * 1000.0) : 2.542 / 1000.0);\n*_new_h = i_Na_h_gate_h_inf + (h - i_Na_h_gate_h_inf) * exp(-(dt / i_Na_h_gate_tau_h));\n\n// i_Na_j_gate\nconst Real i_Na_j_gate_alpha_j = ((Vm < -0.04) ? (-25428.0 * exp(0.2444 * (Vm * 1000.0)) - 6.948 * (pow(10.0, -6.0) * exp(-0.04391 * (Vm * 1000.0)))) * (Vm * 1000.0 + 37.78) / (1.0 + exp(0.311 * (Vm * 1000.0 + 79.23))) : 0.0);\nconst Real i_Na_j_gate_beta_j = ((Vm < -0.04) ? 0.02424 * exp(-0.01052 * (Vm * 1000.0)) / (1.0 + exp(-0.1378 * (Vm * 1000.0 + 40.14))) : 0.6 * exp(0.057 * (Vm * 1000.0)) / (1.0 + exp(-0.1 * (Vm * 1000.0 + 32.0))));\nconst Real i_Na_j_gate_j_inf = 1.0 / (sqrt(1.0 + exp((Vm * 1000.0 + 72.1) / 5.7)));\nconst Real i_Na_j_gate_tau_j = 7.0 / ((i_Na_j_gate_alpha_j + i_Na_j_gate_beta_j) * 1000.0);\n*_new_j = i_Na_j_gate_j_inf + (j - i_Na_j_gate_j_inf) * exp(-(dt / i_Na_j_gate_tau_j));\n\n// i_Na_m_gate\nconst Real i_Na_m_gate_alpha_m = 1.0 / (1.0 + exp((-Vm * 1000.0 - 60.0) / 5.0));\nconst Real i_Na_m_gate_beta_m = 0.1 / (1.0 + exp((Vm * 1000.0 + 35.0) / 5.0)) + 0.1 / (1.0 + exp((Vm * 1000.0 - 50.0) / 200.0));\nconst Real i_Na_m_gate_m_inf = 1.0 / (pow(1.0 + exp((-Vm * 1000.0 - 34.1) / 5.9), 1.0 / 3.0));\nconst Real i_Na_m_gate_tau_m = 1.0 * (i_Na_m_gate_alpha_m * i_Na_m_gate_beta_m) / 1000.0;\n*_new_m = i_Na_m_gate_m_inf + (m - i_Na_m_gate_m_inf) * exp(-(dt / i_Na_m_gate_tau_m));\n\n// i_PCa\nconst Real i_PCa_i_PCa = i_PCa_g_PCa * Cai / (Cai + i_PCa_KPCa);\n\n// i_f\nconst Real i_f_i_f = i_f_g_f * (Xf * (Vm - i_f_E_f));\n\n// i_f_Xf_gate\nconst Real i_f_Xf_gate_Xf_infinity = 1.0 / (1.0 + exp((Vm * 1000.0 + 77.85) / 5.0));\nconst Real i_f_Xf_gate_tau_Xf = 1900.0 / (1.0 + exp((Vm * 1000.0 + 15.0) / 10.0)) / 1000.0;\n*_new_Xf = i_f_Xf_gate_Xf_infinity + (Xf - i_f_Xf_gate_Xf_infinity) * exp(-(dt / i_f_Xf_gate_tau_Xf));\n\n// i_to_q_gate\nconst Real i_to_q_gate_q_inf = 1.0 / (1.0 + exp((Vm * 1000.0 + 53.0) / 13.0));\nconst Real i_to_q_gate_tau_q = (6.06 + 39.102 / (0.57 * exp(-0.08 * (Vm * 1000.0 + 44.0)) + 0.065 * exp(0.1 * (Vm * 1000.0 + 45.93)))) / 1000.0;\n*_new_q = i_to_q_gate_q_inf + (q - i_to_q_gate_q_inf) * exp(-(dt / i_to_q_gate_tau_q));\n\n// i_to_r_gate\nconst Real i_to_r_gate_r_inf = 1.0 / (1.0 + exp(-(Vm * 1000.0 - 22.3) / 18.75));\nconst Real i_to_r_gate_tau_r = (2.75352 + 14.40516 / (1.037 * exp(0.09 * (Vm * 1000.0 + 30.61)) + 0.369 * exp(-0.12 * (Vm * 1000.0 + 23.84)))) / 1000.0;\n*_new_r = i_to_r_gate_r_inf + (r - i_to_r_gate_r_inf) * exp(-(dt / i_to_r_gate_tau_r));\n\n// electric_potentials\nconst Real electric_potentials_E_Ca = 0.5 * (model_parameters_R * model_parameters_T) / model_parameters_F * log(model_parameters_Cao / (Cai));\nconst Real electric_potentials_E_Na = model_parameters_R * model_parameters_T / model_parameters_F * log(model_parameters_Nao / (Nai));\nconst Real electric_potentials_E_Ks = model_parameters_R * model_parameters_T / model_parameters_F * log((model_parameters_Ko + electric_potentials_PkNa * model_parameters_Nao) / (model_parameters_Ki + electric_potentials_PkNa * Nai));\n\n// i_CaL\nconst Real i_CaL_i_CaL = i_CaL_g_CaL * (4.0 * (Vm * pow(model_parameters_F, 2.0))) / (model_parameters_R * model_parameters_T) * (Cai * exp(2.0 * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) - 0.341 * model_parameters_Cao) / ((fabs(exp(2.0 * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) - 1.0) < VERY_SMALL_NUMBER) ? ((exp(2.0 * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) - 1.0 < 0.0) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(2.0 * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) - 1.0) * (d * (f1 * (f2 * fCa)));\n\n// i_Kr_Xr1_gate\nconst Real i_Kr_Xr1_gate_alpha_Xr1 = 450.0 / (1.0 + exp((-45.0 - Vm * 1000.0) / 10.0));\nconst Real i_Kr_Xr1_gate_beta_Xr1 = 6.0 / (1.0 + exp((30.0 + Vm * 1000.0) / 11.5));\nconst Real i_Kr_Xr1_gate_tau_Xr1 = 1.0 * (i_Kr_Xr1_gate_alpha_Xr1 * i_Kr_Xr1_gate_beta_Xr1) / 1000.0;\nconst Real i_Kr_Xr1_gate_Xr1_inf = 1.0 / (1.0 + exp((i_Kr_Xr1_gate_V_half - Vm * 1000.0) / 4.9));\n*_new_Xr1 = i_Kr_Xr1_gate_Xr1_inf + (Xr1 - i_Kr_Xr1_gate_Xr1_inf) * exp(-(dt / i_Kr_Xr1_gate_tau_Xr1));\n\n// i_NaCa\nconst Real i_NaCa_i_NaCa = i_NaCa_kNaCa * (exp(i_NaCa_gamma * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) * (pow(Nai, 3.0) * model_parameters_Cao) - exp((i_NaCa_gamma - 1.0) * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) * (pow(model_parameters_Nao, 3.0) * (Cai * i_NaCa_alpha))) / ((pow(i_NaCa_KmNai, 3.0) + pow(model_parameters_Nao, 3.0)) * ((i_NaCa_KmCa + model_parameters_Cao) * (1.0 + i_NaCa_Ksat * exp((i_NaCa_gamma - 1.0) * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)))));\n\n// i_NaK\nconst Real i_NaK_i_NaK = i_NaK_PNaK * model_parameters_Ko / (model_parameters_Ko + i_NaK_Km_K) * Nai / (Nai + i_NaK_Km_Na) / (1.0 + (0.1245 * exp(-0.1 * (Vm * model_parameters_F) / (model_parameters_R * model_parameters_T)) + 0.0353 * exp(-Vm * model_parameters_F / (model_parameters_R * model_parameters_T))));\n\n// i_K1\nconst Real i_K1_alpha_K1 = 3.91 / (1.0 + exp(0.5942 * (Vm * 1000.0 - electric_potentials_E_K * 1000.0 - 200.0)));\nconst Real i_K1_beta_K1 = (-1.509 * exp(0.0002 * (Vm * 1000.0 - electric_potentials_E_K * 1000.0 + 100.0)) + exp(0.5886 * (Vm * 1000.0 - electric_potentials_E_K * 1000.0 - 10.0))) / (1.0 + exp(0.4547 * (Vm * 1000.0 - electric_potentials_E_K * 1000.0)));\nconst Real i_K1_XK1_inf = i_K1_alpha_K1 / (i_K1_alpha_K1 + i_K1_beta_K1);\nconst Real i_K1_i_K1 = i_K1_g_K1 * (i_K1_XK1_inf * ((Vm - electric_potentials_E_K) * sqrt(model_parameters_Ko / 5.4)));\n\n// i_Kr\nconst Real i_Kr_i_Kr = i_Kr_E4031_coeff * (i_Kr_g_Kr * ((Vm - electric_potentials_E_K) * (Xr1 * (Xr2 * sqrt(model_parameters_Ko / 5.4)))));\n\n// i_Ks\nconst Real i_Ks_i_Ks = i_Ks_Chromanol_coeff * (i_Ks_g_Ks * ((Vm - electric_potentials_E_Ks) * (pow(Xs, 2.0) * (1.0 + 0.6 / (1.0 + pow(3.8 * 1e-05 / (Cai), 1.4))))));\n\n// i_Na\nconst Real i_Na_i_Na = i_Na_TTX_coeff * (i_Na_g_Na * (pow(m, 3.0) * (h * (j * (Vm - electric_potentials_E_Na)))));\n\n// i_b_Ca\nconst Real i_b_Ca_i_b_Ca = i_b_Ca_g_b_Ca * (Vm - electric_potentials_E_Ca);\n\n// i_b_Na\nconst Real i_b_Na_i_b_Na = i_b_Na_g_b_Na * (Vm - electric_potentials_E_Na);\n\n// i_to\nconst Real i_to_i_to = i_to_g_to * ((Vm - electric_potentials_E_K) * (q * r));\n\n// Membrane\n*_new_Vm = Vm + dt*(-(i_K1_i_K1 + (i_to_i_to + (i_Kr_i_Kr + (i_Ks_i_Ks + (i_CaL_i_CaL + (i_NaK_i_NaK + (i_Na_i_Na + (i_NaCa_i_NaCa + (i_PCa_i_PCa + (i_f_i_f + (i_b_Na_i_b_Na + i_b_Ca_i_b_Ca))))))))))) + _diffuse_Vm);\n\n// calcium_dynamics\nconst Real calcium_dynamics_g_inf = ((Cai <= 0.00035) ? 1.0 / (1.0 + pow(Cai / 0.00035, 6.0)) : 1.0 / (1.0 + pow(Cai / 0.00035, 16.0)));\nconst Real calcium_dynamics_Ca_SR_bufSR = 1.0 / (1.0 + calcium_dynamics_Buf_SR * calcium_dynamics_Kbuf_SR / (pow(Ca_SR + calcium_dynamics_Kbuf_SR, 2.0)));\nconst Real calcium_dynamics_Cai_bufc = 1.0 / (1.0 + calcium_dynamics_Buf_C * calcium_dynamics_Kbuf_C / (pow(Cai + calcium_dynamics_Kbuf_C, 2.0)));\nconst Real calcium_dynamics_const2 = (((calcium_dynamics_g_inf > g) && (Vm > -0.06)) ? 0.0 : 1.0);\nconst Real calcium_dynamics_i_leak = (Ca_SR - Cai) * calcium_dynamics_V_leak;\nconst Real calcium_dynamics_i_rel = (calcium_dynamics_c_rel + calcium_dynamics_a_rel * pow(Ca_SR, 2.0) / (pow(calcium_dynamics_b_rel, 2.0) + pow(Ca_SR, 2.0))) * (d * (g * calcium_dynamics_g_factor));\nconst Real calcium_dynamics_i_up = calcium_dynamics_VmaxUp / (1.0 + pow(calcium_dynamics_Kup, 2.0) / (pow(Cai, 2.0)));\n*_new_Ca_SR = Ca_SR + dt*(calcium_dynamics_Ca_SR_bufSR * model_parameters_Vc / model_parameters_V_SR * (calcium_dynamics_i_up - (calcium_dynamics_i_rel + calcium_dynamics_i_leak)));\n*_new_Cai = Cai + dt*(calcium_dynamics_Cai_bufc * (calcium_dynamics_i_leak - calcium_dynamics_i_up + calcium_dynamics_i_rel - (i_CaL_i_CaL + (i_b_Ca_i_b_Ca + i_PCa_i_PCa) - 2.0 * i_NaCa_i_NaCa) * model_parameters_Cm / (2.0 * (model_parameters_Vc * (model_parameters_F * 1e-18)))));\n*_new_g = g + dt*(calcium_dynamics_const2 * (calcium_dynamics_g_inf - g) / calcium_dynamics_tau_g);\n\n// sodium_dynamics\n*_new_Nai = Nai + dt*(-model_parameters_Cm * (i_Na_i_Na + (i_b_Na_i_b_Na + (3.0 * i_NaK_i_NaK + 3.0 * i_NaCa_i_NaCa))) / (model_parameters_F * (model_parameters_Vc * 1e-18)));\n', 'meta': {'keywords': ['excitable media', 'electrophysiology', 'heart', 'human']}}, 'tentusscher2006alternans': {'name': 'Ten Tusscher et al. 2006', 'description': 'This detailed human ventricular cell model was developed to investigate the\nmechanisms of electrical instability, alternans, and spiral wave breakup in\ncardiac tissue. It builds on their 2004 model by incorporating a more\ncomprehensive description of intracellular calcium dynamics, including\nsubspace calcium compartments and a Markov model of the ryanodine receptor\nfor calcium-induced calcium release (CICR). The model also includes both fast\nand slow voltage-dependent inactivation gates for the L-type calcium current,\nenabling more accurate simulation of calcium handling and its role in\narrhythmogenesis. It reproduces a wide range of experimentally observed APD\nrestitution slopes (see the parameter sets ``slope``, default ``slope[1.1]``)\nand explores the interaction between sodium current recovery dynamics and\ntissue-level instability. The model is suited for studying reentry,\nalternans, and ventricular fibrillation mechanisms in human cardiac tissue.\nThe model also has different parameter sets for epicardial (parameter set\n``epi``, default), endocardial (``endo``), and midmyocardial cells (``m``).\n', 'dois': ['https://doi.org/10.1152/ajpheart.00109.2006', 'https://doi.org/10.1152/ajpheart.00794.2003'], 'keywords': ['excitable media', 'electrophysiology', 'heart', 'human', 'ventricle'], 'variables': {'V': -85.23, 'Ca_SR': 3.64, 'Ca_i': 0.000126, 'Ca_ss': 0.00036, 'K_i': 136.89, 'Na_i': 8.604, 'Rbar': 0.9073, 'Xr1': 0.00621, 'Xr2': 0.4712, 'Xs': 0.0095, 'd': 3.373e-05, 'f2': 0.9755, 'f': 0.7888, 'fCass': 0.9953, 'h': 0.7444, 'j': 0.7045, 'm': 0.00172, 'r': 2.42e-08, 's': 0.999998}, 'initial values': {'epi': {'V': -85.23, 'Ca_SR': 3.64, 'Ca_i': 0.000126, 'Ca_ss': 0.00036, 'K_i': 136.89, 'Na_i': 8.604, 'Rbar': 0.9073, 'Xr1': 0.00621, 'Xr2': 0.4712, 'Xs': 0.0095, 'd': 3.373e-05, 'f2': 0.9755, 'f': 0.7888, 'fCass': 0.9953, 'h': 0.7444, 'j': 0.7045, 'm': 0.00172, 'r': 2.42e-08, 's': 0.999998}, 'endo': {'V': -86.709, 'Ca_SR': 3.715, 'Ca_i': 0.00013, 'Ca_ss': 0.00036, 'K_i': 138.4, 'Na_i': 10.355, 'Rbar': 0.9068, 'Xr1': 0.00448, 'Xr2': 0.476, 'Xs': 0.0087, 'd': 3.164e-05, 'f2': 0.9778, 'f': 0.8009, 'fCass': 0.9953, 'h': 0.7573, 'j': 0.7225, 'm': 0.00155, 'r': 2.235e-08, 's': 0.3212}, 'm': {'V': -85.423, 'Ca_SR': 4.272, 'Ca_i': 0.000153, 'Ca_ss': 0.00042, 'K_i': 138.52, 'Na_i': 10.132, 'Rbar': 0.8978, 'Xr1': 0.0165, 'Xr2': 0.473, 'Xs': 0.0174, 'd': 3.288e-05, 'f2': 0.9526, 'f': 0.7026, 'fCass': 0.9942, 'h': 0.749, 'j': 0.6788, 'm': 0.00165, 'r': 2.347e-08, 's': 0.999998}}, 'diffusivity': {'V': 1.0}, 'parameters': {'Buf_c': 0.2, 'Buf_sr': 10.0, 'Buf_ss': 0.4, 'C_m': 185.0, 'Ca_o': 2.0, 'EC': 1.5, 'F': 96.485, 'K_buf_c': 0.001, 'K_buf_sr': 0.3, 'K_buf_ss': 0.00025, 'K_mCa': 1.38, 'K_mNa': 40.0, 'K_mNa_i': 87.5, 'K_mk': 1.0, 'K_o': 5.4, 'K_pCa': 0.0005, 'K_up': 0.00025, 'Na_o': 140.0, 'P_NaK': 2.724, 'R': 8.314, 'T': 310.0, 'V_c': 16404.0, 'V_leak': 0.00036, 'V_maxup': 0.006375, 'V_rel': 0.102, 'V_sr': 1094.0, 'V_ss': 54.68, 'V_xfer': 0.0038, 'alpha': 2.5, 'factor_f_tau': 1.0, 'factor_g_Kr': 1.0, 'factor_g_Ks': 1.0, 'factor_g_pCa': 1.0, 'factor_g_pK': 1.0, 'g_CaL': 0.0398, 'g_K1': 5.405, 'g_Kr': 0.153, 'g_Ks': 0.392, 'g_Na': 14.838, 'g_bCa': 0.000592, 'g_bNa': 0.00029, 'g_pCa': 0.1238, 'g_pK': 0.0146, 'g_to': 0.294, 'gamma': 0.35, 'k1_prime': 0.15, 'k2_prime': 0.045, 'k3': 0.06, 'k4': 0.005, 'k_NaCa': 1000.0, 'k_sat': 0.1, 'max_sr': 2.5, 'min_sr': 1.0, 'p_KNa': 0.03, 's_offset': 20.0, 's_variant': 0.0}, 'parameter sets': {'slope': {0.7: {'factor_g_Kr': 0.8758169934640524, 'factor_g_Ks': 0.6887755102040817, 'factor_g_pCa': 0.5, 'factor_g_pK': 5.0, 'factor_f_tau': 0.6}, 1.1: {'factor_g_Kr': 1.0, 'factor_g_Ks': 1.0, 'factor_g_pCa': 1.0, 'factor_g_pK': 1.0, 'factor_f_tau': 1.0}, 1.4: {'factor_g_Kr': 1.1241830065359477, 'factor_g_Ks': 1.125, 'factor_g_pCa': 3.0, 'factor_g_pK': 0.5, 'factor_f_tau': 1.5}, 1.8: {'factor_g_Kr': 1.1241830065359477, 'factor_g_Ks': 1.125, 'factor_g_pCa': 7.0, 'factor_g_pK': 0.15, 'factor_f_tau': 2.0}}, 'epi': {'g_Ks': 0.392, 'g_to': 0.294, 's_offset': 20.0, 's_variant': 0.0}, 'endo': {'g_Ks': 0.392, 'g_to': 0.073, 's_offset': 28.0, 's_variant': 1.0}, 'm': {'g_Ks': 0.098, 'g_to': 0.294, 's_offset': 20.0, 's_variant': 0.0}}, 'code': '// i_CaL: gating variable d\nconst Real d_alpha = 1.4 / (1. + exp((-35. - V) / 13.)) + 0.25;\nconst Real d_beta = 1.4 / (1. + exp((V + 5.) / 5.));\nconst Real d_inf = 1. / (1. + exp((-8. - V) / 7.5));\nconst Real d_gamma = 1. / (1. + exp((50. - V) / 20.));\nconst Real d_tau = 1. * d_alpha * d_beta + d_gamma;\n*_new_d = d_inf + (d - d_inf) * exp(-(dt / d_tau));\n\n// i_CaL: gating variable f2\nconst Real f2_inf = 0.67 / (1. + exp((V + 35.) / 7.)) + 0.33;\nconst Real f2_tau = 562. * exp(-pow(V + 27., 2.) / 240.) + 31. / (1. + exp((25. - V) / 10.)) + 80. / (1. + exp((V + 30.) / 10.));\n*_new_f2 = f2_inf + (f2 - f2_inf) * exp(-(dt / f2_tau));\n\n// i_CaL: gating variable fCass\nconst Real fCass_inf = 0.6 / (1. + pow(Ca_ss / 0.05, 2.)) + 0.4;\nconst Real fCass_tau = 80. / (1. + pow(Ca_ss / 0.05, 2.)) + 2.;\n*_new_fCass = fCass_inf + (fCass - fCass_inf) * exp(-(dt / fCass_tau));\n\n// i_CaL: gating variable f\nconst Real f_inf = 1. / (1. + exp((V + 20.) / 7.));\nconst Real f_tau = 1102.5 * exp(-pow(V + 27., 2.) / 225.) + 200. / (1. + exp((13. - V) / 10.)) + 180. / (1. + exp((V + 30.) / 10.)) + 20.;\n*_new_f = f_inf + (f - f_inf) * exp(-(dt / (factor_f_tau * f_tau)));\n\n// i_pCa\nconst Real i_pCa = factor_g_pCa * g_pCa * Ca_i / (Ca_i + K_pCa);\n\n// i_Na: gating variable h\nconst Real h_alpha = ((V < -40.) ? 0.057 * exp(-(V + 80.) / 6.8) : 0.);\nconst Real h_beta = ((V < -40.) ? 2.7 * exp(0.079 * V) + 310000. * exp(0.3485 * V) : 0.77 / (0.13 * (1. + exp((V + 10.66) / -11.1))));\nconst Real h_inf = 1. / (pow(1. + exp((V + 71.55) / 7.43), 2.));\nconst Real h_tau = 1. / (h_alpha + h_beta);\n*_new_h = h_inf + (h - h_inf) * exp(-(dt / h_tau));\n\n// i_Na: gating variable j\nconst Real j_alpha = ((V < -40.) ? (-25428. * exp(0.2444 * V) - 6.948e-06 * exp(-0.04391 * V)) * (V + 37.78) / 1. / (1. + exp(0.311 * (V + 79.23))) : 0.);\nconst Real j_beta = ((V < -40.) ? 0.02424 * exp(-0.01052 * V) / (1. + exp(-0.1378 * (V + 40.14))) : 0.6 * exp(0.057 * V) / (1. + exp(-0.1 * (V + 32.))));\nconst Real j_inf = 1. / (pow(1. + exp((V + 71.55) / 7.43), 2.));\nconst Real j_tau = 1. / (j_alpha + j_beta);\n*_new_j = j_inf + (j - j_inf) * exp(-(dt / j_tau));\n\n// i_Na: gating variable m\nconst Real m_alpha = 1. / (1. + exp((-60. - V) / 5.));\nconst Real m_beta = 0.1 / (1. + exp((V + 35.) / 5.)) + 0.1 / (1. + exp((V - 50.) / 200.));\nconst Real m_inf = 1. / (pow(1. + exp((-56.86 - V) / 9.03), 2.));\nconst Real m_tau = 1. * m_alpha * m_beta;\n*_new_m = m_inf + (m - m_inf) * exp(-(dt / m_tau));\n\n// i_Kr: gating variable Xr1\nconst Real Xr1_alpha = 450. / (1. + exp((-45. - V) / 10.));\nconst Real Xr1_beta = 6. / (1. + exp((V + 30.) / 11.5));\nconst Real Xr1_inf = 1. / (1. + exp((-26. - V) / 7.));\nconst Real Xr1_tau = 1. * Xr1_alpha * Xr1_beta;\n*_new_Xr1 = Xr1_inf + (Xr1 - Xr1_inf) * exp(-(dt / Xr1_tau));\n\n// i_Kr: gating variable Xr2\nconst Real Xr2_alpha = 3. / (1. + exp((-60. - V) / 20.));\nconst Real Xr2_beta = 1.12 / (1. + exp((V - 60.) / 20.));\nconst Real Xr2_inf = 1. / (1. + exp((V + 88.) / 24.));\nconst Real Xr2_tau = 1. * Xr2_alpha * Xr2_beta;\n*_new_Xr2 = Xr2_inf + (Xr2 - Xr2_inf) * exp(-(dt / Xr2_tau));\n\n// i_Ks: gating variable Xs\nconst Real Xs_alpha = 1400. / (sqrt(1. + exp((5. - V) / 6.)));\nconst Real Xs_beta = 1. / (1. + exp((V - 35.) / 15.));\nconst Real Xs_inf = 1. / (1. + exp((-5. - V) / 14.));\nconst Real Xs_tau = 1. * Xs_alpha * Xs_beta + 80.;\n*_new_Xs = Xs_inf + (Xs - Xs_inf) * exp(-(dt / Xs_tau));\n\n// i_to: gating variable r\nconst Real r_inf = 1. / (1. + exp((20. - V) / 6.));\nconst Real r_tau = 9.5 * exp(-pow(V + 40., 2.) / 1800.) + 0.8;\n*_new_r = r_inf + (r - r_inf) * exp(-(dt / r_tau));\n\n// i_to: gating variable s\nconst Real s_inf = 1. / (1. + exp((V + s_offset) / 5.));\nReal s_tau = 0;\nif(s_variant > 0.5) {\n    s_tau = 1000. * exp(-pow(V + 67., 2.) / 1000.) + 8.;\n} else {\n    s_tau = 85. * exp(-pow(V + 45., 2.) / 320.) + 5. / (1. + exp((V - 20.) / 5.)) + 3.;\n}\n*_new_s = s_inf + (s - s_inf) * exp(-(dt / s_tau));\n\n// dynCa\nconst Real f_JCa_i_free = 1. / (1. + Buf_c * K_buf_c / (pow(Ca_i + K_buf_c, 2.)));\nconst Real f_JCa_sr_free = 1. / (1. + Buf_sr * K_buf_sr / (pow(Ca_SR + K_buf_sr, 2.)));\nconst Real f_JCa_ss_free = 1. / (1. + Buf_ss * K_buf_ss / (pow(Ca_ss + K_buf_ss, 2.)));\nconst Real i_leak = V_leak * (Ca_SR - Ca_i);\nconst Real i_up = V_maxup / (1. + pow(K_up, 2.) / (pow(Ca_i, 2.)));\nconst Real i_xfer = V_xfer * (Ca_ss - Ca_i);\nconst Real kcasr = max_sr - (max_sr - min_sr) / (1. + pow(EC / (Ca_SR), 2.));\nconst Real k1 = k1_prime / (kcasr);\nconst Real k2 = k2_prime * kcasr;\nconst Real O = k1 * pow(Ca_ss, 2.) * Rbar / (k3 + k1 * pow(Ca_ss, 2.));\n*_new_Rbar = Rbar + dt*(-k2 * Ca_ss * Rbar + k4 * (1. - Rbar));\nconst Real i_rel = V_rel * O * (Ca_SR - Ca_ss);\nconst Real ddt_Ca_sr_total = i_up - (i_rel + i_leak);\n*_new_Ca_SR = Ca_SR + dt*(ddt_Ca_sr_total * f_JCa_sr_free);\n\n// *remaining*\nconst Real E_Ca = 0.5 * R * T / F * log(Ca_o / (Ca_i));\nconst Real E_K = R * T / F * log(K_o / (K_i));\nconst Real E_Ks = R * T / F * log((K_o + p_KNa * Na_o) / (K_i + p_KNa * Na_i));\nconst Real E_Na = R * T / F * log(Na_o / (Na_i));\nconst Real i_CaL = g_CaL * d * f * f2 * fCass * 4. * (V - 15.) * pow(F, 2.) / (R * T) * (0.25 * Ca_ss * exp(2. * (V - 15.) * F / (R * T)) - Ca_o) / ((fabs(exp(2. * (V - 15.) * F / (R * T)) - 1.) < VERY_SMALL_NUMBER) ? ((exp(2. * (V - 15.) * F / (R * T)) - 1. < 0.) ? -VERY_SMALL_NUMBER : VERY_SMALL_NUMBER) : exp(2. * (V - 15.) * F / (R * T)) - 1.);\nconst Real i_NaK = P_NaK * K_o / (K_o + K_mk) * Na_i / (Na_i + K_mNa) / (1. + 0.1245 * exp(-0.1 * V * F / (R * T)) + 0.0353 * exp(-V * F / (R * T)));\nconst Real i_NaCa = k_NaCa * (exp(gamma * V * F / (R * T)) * pow(Na_i, 3.) * Ca_o - exp((gamma - 1.) * V * F / (R * T)) * pow(Na_o, 3.) * Ca_i * alpha) / ((pow(K_mNa_i, 3.) + pow(Na_o, 3.)) * (K_mCa + Ca_o) * (1. + k_sat * exp((gamma - 1.) * V * F / (R * T))));\nconst Real i_K1_alpha_K1 = 0.1 / (1. + exp(0.06 * (V - E_K - 200.)));\nconst Real i_K1_beta_K1 = (3. * exp(0.0002 * (V - E_K + 100.)) + exp(0.1 * (V - E_K - 10.))) / (1. + exp(-0.5 * (V - E_K)));\nconst Real i_Kr = factor_g_Kr * g_Kr * sqrt(K_o / 5.4) * Xr1 * Xr2 * (V - E_K);\nconst Real i_Ks = factor_g_Ks * g_Ks * pow(Xs, 2.) * (V - E_Ks);\nconst Real i_Na = g_Na * pow(m, 3.) * h * j * (V - E_Na);\nconst Real i_bNa = g_bNa * (V - E_Na);\nconst Real i_bCa = g_bCa * (V - E_Ca);\nconst Real i_to = g_to * r * s * (V - E_K);\nconst Real i_pK = factor_g_pK * g_pK * (V - E_K) / (1. + exp((25. - V) / 5.98));\nconst Real ddt_Ca_ss_total = -i_CaL * C_m / (2. * V_ss * F) + i_rel * V_sr / V_ss - i_xfer * V_c / V_ss;\nconst Real i_K1_xK1_inf = i_K1_alpha_K1 / (i_K1_alpha_K1 + i_K1_beta_K1);\nconst Real ddt_Ca_i_total = -(i_bCa + i_pCa - 2. * i_NaCa) * C_m / (2. * V_c * F) + (i_leak - i_up) * V_sr / V_c + i_xfer;\n*_new_Ca_ss = Ca_ss + dt*(ddt_Ca_ss_total * f_JCa_ss_free);\n*_new_Na_i = Na_i + dt*(-(i_Na + i_bNa + 3. * i_NaK + 3. * i_NaCa) / (V_c * F) * C_m);\nconst Real i_K1 = g_K1 * i_K1_xK1_inf * sqrt(K_o / 5.4) * (V - E_K);\n*_new_Ca_i = Ca_i + dt*(ddt_Ca_i_total * f_JCa_i_free);\n*_new_V = V + dt*(-(i_K1 + i_to + i_Kr + i_Ks + i_CaL + i_NaK + i_Na + i_bNa + i_NaCa + i_bCa + i_pK + i_pCa) + _diffuse_V);\n*_new_K_i = K_i + dt*(-(i_K1 + i_to + i_Kr + i_Ks + i_pK - 2. * i_NaK) / (V_c * F) * C_m);\n'}, 'trivial': {'name': 'Trivial model', 'description': 'This model encodes only diffusion, with a zero reaction term.\n', 'dois': [], 'keywords': ['diffusion'], 'variables': {'u': 0.0}, 'diffusivity': {'u': 1.0}, 'parameters': {}, 'code': '*_new_u = u + dt * _diffuse_u;\n'}}
