hocmech("suffix", "Template", "parm1 parm2 parm3 ...")


Installs the hoc class called "Template" as a density membrane mechanism called "suffix". If the third argument exists it must be a space separated list of public variables in the Template which are to be treated as PARAMETERs. Public variables not in this list are treated as ASSIGNED variables. The new mechanism is used in exactly the same way as "hh" or mechanism defined by NMODL. Thus, instances are created in each segment with section insert suffix and after insertion the public names are accessible via the normal range variable notation as in: section.name_suffix(x)

At this time the functionality of such interpreter defined membrane mechanisms is a small subset of the functionality of mechanisms described by the model description language. Furthermore, being interpreted, they are much ( more than 100 times) slower than compiled model descriptions. However, it is a very powerful way to watch variables, specify events for delivery as specific times, receive events, and discontinuously (or continuously) modify parameters during a simulation. And it works in the context of all the integration methods, including local variable time steps. The following procedure names within a template, if they exist, are analogous to the indicated block in the model description language. In each case the currently accessed section is set to the location of this instance of the Template and one argument is passed, x, which is the range variable arc position (0 < x < 1).

INITIAL: proc initial() Called when finitialize is executed.

BREAKPOINT {SOLVE ... METHOD after_cvode}: proc after_step() For the standard staggered time step and global variable time step integration methods, called at every fadvance when t = t+dt. For the local variable step method, the instance is called when the individual cell CVode instance finished its solve step. In any case, it is safe to send an event any time after t-dt.


The following example creates and installs a mechanism that watches the membrane potential and keeps track of its maximum value.

execute following example

begintemplate Max
public V

proc initial() {
	V = v($1)

proc after_step() {
	if (V < v($1)) {
		V = v($1)
endtemplate Max

makemech("max", "Max")
insert max
print "V_max=", soma.V_max(.5)

neuron/neuron/function/hocmech.hel : May 13 2012