//genesis - Purkinje cell M9 genesis2 script
/* Copyright E. De Schutter (Caltech and BBF-UIA) */
function make_Purkinje_chans_h
int i, cdivs
float zinf, ztau, c, dc, cmin, cmax
echo making and saving Purkinje channel library....
/* Anomalous rectifier HR00: */
if (!{exists Purk_h})
// float h_tab_xmin = -10e-3 // V
float y, x, dx, alpha, beta
float a = 0.63 // 1/s
float b= 0.063e3 // 1/V
float c = 0.079e3 // 1/V
float V2 = -73.2e-3 // V
// int h_tab_xdivs = ({tab_xmax}-{h_tab_xmin})/(({tab_xmax}-{tab_xmin})/{tab_xdivs})
create tabchannel Purk_h
setfield Purk_h Ek {Eh_HR} Gbar {Gh_HR} Ik 0 Gk 0 Xpower 1 \
Ypower 0 Zpower 0
call Purk_h TABCREATE X {tab_xdivs} {tab_xmin} {tab_xmax}
x = {tab_xmin}
dx = ({tab_xmax} - {tab_xmin})/{tab_xdivs}
// it can be done also with setupalpha or tau
for (i = 0; i <= ({tab_xdivs}); i = i + 1)
alpha = {{a} * {exp {-{b} * { {x} - {V2} } }}}
setfield Purk_h X_A->table[{i}] {alpha}
beta = {{a} * {exp {{c} * { {x} - {V2} } }}}
setfield Purk_h X_B->table[{i}] {beta}
echo {{x} @ " " @ {{alpha}/{{alpha}+{beta}}}} >> Purk_h_inf_HR.tst
echo {{x} @ " " @ {1/{{alpha}+{beta}}}} >> Purk_h_tau_HR.tst
x = x + dx
end
// fill with A & B from alpha & beta
tweakalpha Purk_h X
// no interpolation
setfield Purk_h X_A->calc_mode 0 X_B->calc_mode 0
// fill mode: interpolation and smoothing with B-splines
call Purk_h TABFILL X {tab_xfills + 1} 0
// write tau and hinf to file
x = -140e-3 // V
for (i = 0; i <= 300; i = i + 1)
echo {{x} @ " " @ {call Purk_h CALC_MINF X {x}}} >> Purk_h_inf.test
y = {call Purk_h CALC_ALPHA X {x}}
echo {{x} @ " " @ {1/{y+{call Purk_h CALC_BETA X {x}}}}} >> Purk_h_tau.test
x = {x+1e-3}
end
/*
float x, dx, a, b
int i
x = {tab_xmin}
dx = ({tab_xmax} - {tab_xmin})/{tab_xdivs + 1}
openfile Purk_NaFshiftI-6mV_a_max_37.test w
openfile Purk_NaFshiftI-6mV_a_tau_37.test w
for (i = 0; i <= {tab_xfills + 1}; i = {i + 20})
a = {getfield Purk_NaF X_A->table[{i}]}
b = {getfield Purk_NaF X_B->table[{i}]}
writefile Purk_NaFshiftI-6mV_a_max_37.test {x} {a / b}
writefile Purk_NaFshiftI-6mV_a_tau_37.test {x} {1 / b}
x = {x + dx}
end
closefile Purk_NaFshiftI-6mV_a_max_37.test
closefile Purk_NaFshiftI-6mV_a_tau_37.test
end
*/
// call Purk_h TABSAVE Purk_h.tab
end
/*********************************************************************/
end