Since hsolve is only a computation engine, it has no knowledge of your model (number of equations, morphology, ...). The first step in using hsolve is always a step of model construction without using hsolve at all. The next step is creating and configuring hsolve such that it knows what (part of) the model to compute and how to compute it. Then you inform hsolve that everything is in place and it may do its internal initialization. After the usual 'reset', you can start the simulation.
If we want to compute two coupled compartments with Hodgkin-Huxley channels, this may look like the following:
genesis > setclock 0 0.0000030
NOTE: Never forget to set the main simulation clock. If you do not do so, hsolve will be confused and can produce unexpected results. |
genesis > create neutral /cell genesis > ce /cell genesis > create compartment c1 genesis > setfield c1 Ra 0.5 Rm 10 Cm 0.01 Em -0.065 genesis > copy /library/NaF c1/NaF genesis > addmsg c1 c1/NaF VOLTAGE Vm ; addmsg c1/NaF c1 CHANNEL Gk Ek genesis > copy /library/Kdr c1/Kdr genesis > addmsg c1 c1/Kdr VOLTAGE Vm ; addmsg c1/Kdr c1 CHANNEL Gk Ek genesis > copy c1 c2 genesis > addmsg c1 c2 AXIAL Vm ; addmsg c2 c1 RAXIAL Ra Vm
NOTE: In this example all elements use the same simulation clock i.e. clock 0. When you want to use hsolve on elements that use different simulations clocks, reconfigure the model such that they all use the same simulation clock. Afterwards migrate to hsolve. |
genesis > ce /cell genesis > create hsolve solver
genesis > setfield solver path "../##[][TYPE=compartment]"
genesis > setmethod solver 11
NOTE: Never forget to set the method to backward-Euler (method 10) or Crank-Nicolson (method 11). If you do not do so, hsolve will be confused and can produce unexpected results. |
genesis > call solver SETUP
genesis > ...
genesis > reset
genesis > step 1 -time
That's it, here is again the full code:
genesis > create neutral /cell genesis > ce /cell genesis > create compartment c1 -initVm genesis > setfield c1 Ra 0.5 Rm 10 Cm 0.01 Em -0.065 genesis > copy /library/NaF c1/NaF genesis > addmsg c1 c1/NaF VOLTAGE Vm ; addmsg c1/NaF c1 CHANNEL Gk Ek genesis > copy /library/Kdr c1/Kdr genesis > addmsg c1 c1/Kdr VOLTAGE Vm ; addmsg c1/Kdr c1 CHANNEL Gk Ek genesis > copy c1 c2 genesis > addmsg c1 c2 AXIAL Vm ; addmsg c2 c1 RAXIAL Ra Vm genesis > ce /cell genesis > create hsolve solver genesis > setfield solver path "../##[][TYPE=compartment]" genesis > setmethod solver 11 genesis > call solver SETUP genesis > ... genesis > reset genesis > step 1 -time
NOTE: Depending on the circumstances, the hsolve element can be created automatically. An example is the use of the '-hsolve' option of the 'readcell' command in which case the path field is also set to point to the compartments of the cell that is being read. Currently an annoying bug in the readcell code obliges you to use absolute pathnames for the created elements if you use this option. |
NOTE: In the example given above all elements use clock zero. It must be noted that hsolve computes all variables using the same clock (so the same time step). If you only use the elements that act as a model for hsolve, you have the flexibility to use different clocks for different elements (so different time steps for different elements). |
It is useful to discuss how Genesis deals with hsolve. Without hsolve, all elements you create, are responsible for their own calculations. A compartment for example will compute a (cylindrical) cable equation using the exponential-Euler rule and has some facilities to communicate certain variables to or from other elements (via the Genesis message system). When using hsolve however, hsolve does the computations as shown in figure 2.1. Depending on the configuration of hsolve - something that will be discussed in the next section - hsolve is able to use the facilities of the original objects to communicate with other elements, but it is also able to use its own internally optimized communication facilities.
|