File: hocmech.rst

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (94 lines) | stat: -rw-r--r-- 3,555 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

.. _hoc_hocmech:

HOC-based Mechanisms
--------------------

         


.. hoc:function:: hocmech


    Syntax:
        ``make_mechanism("suffix", "Template", "parm1 parm2 parm3 ...")``
        ``make_pointprocess("Name", "Template", "parm1 parm2 parm3 ...")``

    Description:
        Installs the hoc class called "Template" as a density membrane mechanism 
        called "suffix" or a POINT_PROCESS called Name. 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 :hoc:func:`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 :hoc:func:`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. 
         

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

        .. code-block::
            none

            load_file("noload.hoc") 
             
            create soma 
            access soma 
            { L = diam = sqrt(100/PI) insert hh} 
             
            objref stim 
            stim = new IClamp(.5) 
            {stim.dur = .1  stim.amp = .3 } 

            begintemplate Max 
            public V 
             
            proc initial() { 
            	V = v($1) 
            } 
             
            proc after_step() { 
            	if (V < v($1)) { 
            		V = v($1) 
            	} 
            } 
            endtemplate Max 
             
             
            make_mechanism("max", "Max") 
            insert max 
            run() 
            print "V_max=", soma.V_max(.5)