"
Basic usage of code generation tool limpet_fe.py
\n\nAuthor: Edward\ \ Vigmond edward.vigmond@ubordeaux-1.fr\n
This tutorial explains the basics\
\ of using the code generation tool limpet_fe.py
for generating ODE\
\ solver code for models of cellular dynamics. A more detailed explanation of the\
\ background is found in the section on code generation in the CME manual.
limpet_fe.py
\
\ is the EasyML to C translator for writing ionic models. The easiest way to see\
\ how to write a model is to examine a simpler example. To work on this tutorial\
\ do
Let's look at the <code\ \ class=\"interpreted-text\" role=\"download\">Beeler-Reuter model </downloads/my_MBRDR.model>\ \ as modified by Drouhard and Roberge:
\nIion; .nodal(); .external();\n\
V; .nodal(); .external(Vm); \n\nV; .lookup(-800, 800, 0.05);\nCa_i; .lookup(0.001,\
\ 30, 0.001); .units(uM);\n\nV_init = -86.926861;\n\n# sodium current\nGNa = 15;\n\
ENa = 40.0;\nI_Na = GNammmh(V-ENa);\nI_Na = sv->j;\n\na_m = ((V <\
\ 100)\n ? 0.9(V+42.65)/(1.-exp(-0.22(V+42.65)))\n : 890.94379exp(.0486479163(V-100.))/\n\
\ (1.+5.93962526exp(.0486479163(V-100.)))\n );\nb_m = ((V <\
\ -85)\n ? 1.437exp(-.085(V+39.75))\n : 100./(1.+.48640816exp(.2597503577(V+85.)))\n\
\ );\na_h = ((V>-90.)\n ? 0.1exp(-.193(V+79.65))\n : .737097507-.1422598189(V+90.)\n\
\ );\nb_h = 1.7/(1.+exp(-.095(V+20.5)));\n\na_d = APDshorten(0.095exp(-0.01(V-5.)))/\n\
\ (exp(-0.072(V-5.))+1.);\nb_d = APDshorten(0.07exp(-0.017(V+44.)))/\n (exp(0.05(V+44.))+1.)\
\ ;\n\na_f = APDshorten(0.012exp(-0.008(V+28.)))/\n (exp(0.15(V+28.))+1.);\n\
b_f = APDshorten(0.0065exp(-0.02(V+30.)))/\n (exp(-0.2(V+30.))+1.);\n\na_X\
\ = ((V<400.)\n ? (0.0005exp(0.083(V+50.)))/\n (exp(0.057(V+50.))+1.)\
\ \n : 151.7994692exp(.06546786198(V-400.))/\n (1.+1.517994692exp(.06546786198(V-400.)))\n\
\ );\n\nb_X = (0.0013exp(-0.06(V+20.)))/(exp(-0.04(V+20.))+1.);\n\nxti\
\ = 0.8(exp(0.04(V+77.))-1.)/exp(0.04(V+35.));\n\nI_K = (( V != -23. )\n \
\ ? 0.35(4.(exp(0.04(V+85.))-1.)/(exp(0.08(V+53.))+\n \
\ exp(0.04(V+53.)))-\n 0.2(V+23.)/expm1(-0.04(V+23.)))\n\
\ : \n 0.35(4.(exp(0.04(V+85.))-1.)/(exp(0.08(V+53.))+\n \
\ exp(0.04(V+53.))) + 0.2/0.04 )\n );\n\
\n# slow inward\nGsi = 0.09;\nEsi = -82.3-13.0287log(Ca_i/1.e6);\nI_si = Gsidf(V-Esi);\n\
I_X = Xxti;\n\nIion= I_Na+I_si+I_X+I_K;\n\nCa_i_init = 3.e-1;\ndiff_Ca_i = ((V<200.)\n\
\ ? (-1.e-1I_si+0.071.e6*(1.e-7-Ca_i/1.e6))\n : 0\n \
\ );\n\ngroup {\n GNa;\n Gsi;\n APDshorten = 1;\n} .param();\n\ngroup\
\ {\n I_Na;\n I_si;\n I_X;\n I_K;\n} .trace();
\nGenerally, it\ \ looks like C code with a few extra commands. Let's break it down a bit:
\n\Iion; .nodal(); .external();\nV; .nodal(); .external(Vm);