Example b121: Hodgkin-Huxley

Example b121 - Single Cell Hodgkin-Huxley This example solves the Hodgkin-Huxley ionic current model. The results are written to an ascii CMISS signal file, and then converted to a CMISS binary signal file, before being exported to a UnEMAP signal file.


The comfile run by this example is as follows:

# Example b121 - Single cell Hodgkin-Huxley

# If the example path is not set, default to current directory
if (! defined $example) {
    $example = "./";
}
# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
    $example .= $chopped;
}

fem define para;r;$example/test;

#Define geometry of the problem
#  Define underlying geometry
fem define base;d;
fem define node;d;
fem define elem;d;
#  Define grid geometry
fem define grid;d;
fem update grid geometry;
fem update grid metric;

#Define equation to solve
#  Define monodomain with HH kinetics
fem define equa;r;$example/test;

#Define material properties for the problem

#  Define cellular material properties
fem define cell;r;$example/hh;
#    Define cell variants and spatially varying material parameters
fem define mate;r;$example/test cell;
#  Define the continuum material parameters
fem define mate;r;$example/test;
fem update grid material;

#Define continuum initial conditions
#  Set no-flux boundary condition
fem define init;r;$example/test;

#Define the explicit solve, using the adams integrator
fem def solv;r;$example/test;

#Solve the problem

#  Initialise the solve
fem solve to 0;

#  Open a binary history file to store the membrane potential,
#  the h, m, and n gates and the three currents: INa, IK, and Il and
#  the stimulus current
fem open history;test write variables yqs niqslist 1..8 binary;

#  Loop through time
$Tend = 100;
$dt = 1.0;
for ($time=0;$time<$Tend;$time+=$dt) {
    # Solve for the current time
    fem solve restart to $time;
    # Write the membrane potential to the history file
    fem write history time $time variables yqs binary;
}

#  Close the history file
fem close history binary;

#  Calculate the binary signal file from the history file
#  for the membrane potential (YQS(1))
fem evaluate electrode;test history test from gvariables yqs iy 1,2,3,4,5,6,7,8 electrodes 1 binary;

#  Define UnEmap export properties
fem define export;r;$example/test;

#  Define names for the signals
fem define leads;r;$example/test;

#  Export the binary signal file to UnEmap
fem export signal;test leads signal test;

# For testing we compare the generated CMISS signal files
if ($TESTING) {
    fem compare signal;test basis both masterfile $example/test comparefile test binary;
}

Files used by this example are:

Name              Modified     Size

example_b121.com 29-Jan-2003 2.3k hh.ipcell 29-Jan-2003 1.6k test.binsig 29-Jan-2003 6.9k test.ipequa 26-May-2003 1.4k test.ipexpo 29-Jan-2003 658 test.ipinit 10-Apr-2000 212 test.iplead 29-Jan-2003 2.2k test.ipmatc 29-Jan-2003 430 test.ipmate 10-Apr-2000 3.2k test.ippara 12-Nov-2002 5.9k test.ipsolv 03-Oct-2001 1.3k test.ipsolv.old 10-Apr-2000 1.3k

Download the entire example:

Name                           Modified     Size

examples_b_b1_b12_b121.tar.gz 19-Aug-2006 10k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:02:08 20160
cm-debugSuccessSat Mar 5 00:03:33 20161
mips-irix
cmSuccessSun Aug 19 01:36:07 20077
cm-debugSuccessWed Aug 15 01:29:08 200713
cm-debug-clear-mallocSuccessSat Aug 18 01:34:43 200716
cm-debug-clear-malloc7SuccessMon Aug 20 01:34:14 200717
cm64SuccessSun Aug 19 01:33:27 20078
cm64-debugSuccessTue Aug 21 01:28:37 200713
cm64-debug-clear-mallocSuccessThu Apr 1 11:08:49 20047
rs6000-aix
cmSuccessWed Mar 4 01:07:32 20091
cm-debugSuccessMon Mar 2 01:07:14 20092
cm64SuccessWed Mar 4 01:07:32 20090
cm64-debugSuccessTue Mar 3 01:13:06 20092
x86_64-linux
cmSuccessSun Mar 6 00:01:04 20161
cm-debugSuccessSat Mar 5 00:01:35 20161

Testing status by file:


Html last generated: Sun Mar 6 05:51:04 2016

Input last modified: Mon May 26 18:03:17 2003


CMISS Help / Examples / b / b1 / b12 / b121