Previous Next Table of Contents

25. GENESIS Object Reference

25.1 Ca_concen

Object Type:    Ca_concen

Description:    Single pool model for Ca concentration.

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Ca_concen_type  [in src/segment/seg_struct.h]

Size:           112 bytes

Fields:         tau             time constant of decay
                Ca_base         resting (base level) concentration
                B               equals 1/(ion_charge * Faraday * volume)
                Ca              Resulting concentraton of Ca++ ions
                C               Intermediate result, Ca - Ca_base
                thick           Holds thickness of shell (used by readcell)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       CaConcen  [in src/segment/Ca_concen.c]

Classes:        concentration segment

Actions:        INIT
                PROCESS
                RESET
                CHECK
                SAVE2
                RESTORE2

Messages:       I_Ca  I_Ca              Receives Ik from a Ca channel
                BASE  Ca_base           Sets Ca_base with a message
                fI_Ca  I_Ca  fraction 
                INCREASE  I_Ca
                DECREASE  I_Ca

------------------------------------------------------------------------------

Notes:          Single shell model for Ca concentration.
                Solves  dC/dt = B*I_Ca - C/tau.
                Ca = Ca_base + C.

                In SI units, where concentration is moles/m^3
                (milli-moles/liter) and current is in amperes, theory gives
                B = 5.2e-6/(shell volume).  In practice, B is a parameter to
                be fitted or estimated from experiment, as buffering,
                non-uniform distribution of Ca, etc., will modify this value.
                If thick = 0, the readcell routine calculates B by scaling
                the "density" parameter in the cell parameter file by the
                volume of the compartment.  Otherwise, it scales as a true
                cell, with volume = area*thick.

Example:        see Scripts/burster

See also: readcell

25.2 Kpores

OBJECT                          KPORES                  3/14/92 (AS)

DESCRIPTION:
    Simulates a population of potassium ion channel proteins (pores)
    embedded in a patch of membrane over an isopotential region.  Each
    individual pore undergoes standard Markov kinetics through a five state
    scheme:

              4an->        3an->        2an->         an->
        [n0]---------[n1]---------[n2]---------[n3]---------[n4]
              <-bn         <-2bn        <-3bn        <-4bn

        where [n4] = Open State and an and bn have voltage dependencies 
        given by:

        an = (alpha_A + alpha_B*Vk)/(alpha_C + exp((alpha_D+Vk)/alpha_F))

        bn = (beta_A + beta_B*Vk)/(beta_C + exp((beta_D+Vk)/beta_F))

        The total population of pores is given by Nt.
        The total number of pores within each of the five stable states
        at any given iteration is given by n0, n1, n2, n3, n4, respectively.
        The total number of pores in the open stable state is given
        by No = n4.
        The open state conductance of a pore is given by Gmax.
        The effective conductance for the population of pores at any
        given iteration is then Gk = Gmax*No.

SPECIFICATIONS:
    FUNCTION            KPorePop()
    DATA STRUCTURE      K_pore_type
    CLASS               segment membrane
    SIZE                ?? bytes
    AUTHOR              A. Strassberg Caltech 3/92

ACTIONS:
    CHECK       null
    RESET       sets initial distribution of pores into the various stable
                states based upon the equilibrium solutions to the Markov
                matrix for given Vk.
    PROCESS     updates the distribution of the stable states of the
                population based upon the rate constants an and bn, derived
                from the current transmembrane voltage Vk.
    INIT        null

MESSAGES:
    VOLTAGE     sends transmembrane voltage Vk to the population of pores.
                This Vk is used to update the state distribution after each
                iteration.

FIELDS:
    See DESCRIPTION

RELATED COMMANDS/TOPICS:
    Napores

ERROR MESSAGES:

BUGS:

NOTES:
    See Strassberg and DeFelice, 1993, Neural Computation 5:6
    and the demonstration scripts in Scripts/examples/pore

25.3 Mg_block

Object Type:    Mg_block

Description:    Implementation of voltage- and [Mg]-dependent
                blocking of a channel.

Author:         E. De Schutter, Caltech (11/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Mg_block_type  [in src/segment/seg_struct.h]

Size:           120 bytes

Fields:         Ik              blocked value of current
                Gk              blocked value of current
                Ek              blocked value of current k
                Zk              charge; may also be used as
                                {charge / relative fraction of I},
                                e.g. 2/(Ica/Itot) -> msg to difpool
                KMg_A           A-factor K(v) in eq'n for Mg block reaction
                KMg_B           B-factor K(v) in eq'n for Mg block reaction
                CMg             [Mg] in mM

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       MgBlock  [in src/segment/Mg_block.c]

Classes:        segment channel

Actions:        INIT            [INIT does nothing]
                PROCESS
                RESET
                CHECK

Messages:       VOLTAGE Vm              voltage from the compartment
                CHANNEL Gk Ek           unblocked Gk and Ek from compartment
                CHANNEL1 Gk
                CHANNEL2 Gk Ek
                CHARGE Zk

------------------------------------------------------------------------------

Notes:          An Mg_block element may be interposed between a synaptically
                activated channel (a synchan or hebsynchan) and a compartment. 
                This calculates a blocked value of Gk that is reduced from
                the incoming Gk by a factor of A/(A + [Mg]*exp(-Vm/B)).

                The example below puts this in the form of the Zador, Koch,
                and Brown equation [Proc. Natl. Acad. Sci. USA 10:6718-6722
                (1990)], with A = 1/eta and B = 1/gamma.

Example:

    float CMg = 2                       // [Mg] in mM
    float eta = 0.33                    // per mM
    float gamma = 60                    // per Volt
    create      synchan               {compartment}/{channel}
    setfield         ^ \
                Ek                      {Ek} \
                tau1                    {tau1} \
                tau2                    {tau2} \
                gmax                    {gmax}
    create Mg_block {compartment}/{channel}/block
        setfield         ^ \
                CMg                     {CMg} \
                KMg_A                   {1.0/eta} \
                KMg_B                   {1.0/gamma}
    addmsg   {compartment}/{channel} {compartment}/{channel}/block \
                CHANNEL Gk Ek
    addmsg   {compartment}/{channel}/block {compartment} CHANNEL Gk Ek
    addmsg   {compartment}   {compartment}/{channel}/block VOLTAGE Vm
    // Even though the channel current isn't used, CHECK expects this message
    addmsg   {compartment}   {compartment}/{channel} VOLTAGE Vm
See also: synchan

25.4 Napores

OBJECT                          NAPORES                 3/14/92 (AS)

DESCRIPTION:
    Simulates a population of sodium ion channels proteins (pores) embedded
    in a patch of membrane over an isopotential region.  Each individual pore
    undergoes standard Markov kinetics through an eight state scheme:

                  3am->                 2am->                 am->
        [m0h1]---------------[m1h1]---------------[m2h1]---------------[m3h1]
          |       <-bm         |       <-2bm        |        <-3bm       |
          |                    |                    |                    |
       /\ |                 /\ |                 /\ |                 /\ |
       ah | bh              ah | bh              ah | bh              ah | bh
          | \/                 | \/                 | \/                 | \/
          |                    |                    |                    |
          |       3am->        |        2am->       |         am->       |
        [m0h0]---------------[m1h0]---------------[m2h0]---------------[m3h0]
                  <-bm                 <-2bm                 <-3bm

    where [m3h1] = Open State and am, bm, ah and bh have voltage
    dependencies given by:

    am = (malpha_A + malpha_B*Vk)/(malpha_C + exp((malpha_D+Vk)/malpha_F))

    bm = (mbeta_A + mbeta_B*Vk)/(mbeta_C + exp((mbeta_D+Vk)/mbeta_F))

    ah = (halpha_A + halpha_B*Vk)/(halpha_C + exp((halpha_D+Vk)/halpha_F))

    bh = (hbeta_A + hbeta_B*Vk)/(hbeta_C + exp((hbeta_D+Vk)/hbeta_F))

    The total population of pores is given by Nt.  The total number of pores
    within each of the eight stable states at any given iteration is given by
    m0h0, m1h0, m2h0, m3h0, m0h1, m1h1, m2h1, and m3h1, respectively.  The
    total number of pores in the open stable state is given by No = m3h1.
    The open state conductance of a pore is given by Gmax.  The effective
    conductance for the population of pores at any given iteration is then
    Gk = Gmax*No.

SPECIFICATIONS:
    FUNCTION            NaPorePop()
    DATA STRUCTURE      Na_pore_type
    CLASS               segment membrane
    SIZE                ?? bytes
    AUTHOR              A. Strassberg Caltech 3/92

ACTIONS:
    CHECK       null
    RESET       sets initial distribution of pores into the various stable
                states based upon the equilibrium solutions to the Markov
                matrix for given Vk.
    PROCESS     updates the distribution of the stable states of the
                population based upon the rate constants an and bn, derived
                from the current transmembrane voltage Vk.
    INIT        null

MESSAGES:
    VOLTAGE     sends transmembrane voltage Vk to the population of pores.
                This Vk is used to update the state distribution after each
                iteration.

FIELDS:
    See DESCRIPTION

RELATED COMMANDS/TOPICS:
    Kpores

ERROR MESSAGES:

BUGS:

NOTES:
    See Strassberg and DeFelice, 1993, Neural Computation 5:6
    and the demonstration scripts in Scripts/examples/pore

25.5 PID

Object Type:    PID

Description:    PID (proportional, integral, derivative) feedback controller

Author:         M. Nelson, Caltech (4/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  PID_type  [in src/user/user_struct.h]

Size:           144 bytes

Fields:         cmd          inputs the command (desired) value of sns
                sns          inputs the sensed (measured) value
                output       = gain*(e + tau_d*de/dt + 1/tau_i * e_integral)
                gain         determines the sensitivity of the controller
                tau_i        integration time constant, typically = dt
                tau_d        derivative time constant, typically = dt/4
                saturation   sets permissible range of output
                e            internal variable (error = cmd-sns)
                e_integral   internal variable (integral of e dt)
                e_deriv      internal variable
                e_previous   internal variable

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       PIDcontroller  [in src/user/PID.c]

Classes:        device

Actions:        INIT
                PROCESS 
                RESET

Messages:       CMD command
                SNS sense
                GAIN gain

------------------------------------------------------------------------------

Notes:

The PID is used for feedback control of dynamical systems.  For example, in
a voltage clamp circuit it is used with a pulsegen, RC, and diffamp device
to provide the required injection current to maintain the membrane voltage
at the desired level.  The RC-filtered command voltage is scaled by the
diffamp and then presented to the PID with a CMD message.  The output is
sent to a compartment with an INJECT message, and the resulting Vm in the
compartment is fed back to the PID with a SNS message.  A higher gain gives
a better clamp, but requires a smaller integration time step to avoid
numerical instability.

For more information on PID controllers see: Franklin, Powel, Emami-Naeini
(1986) "Feedback Control of Dynamic Systems", Addison-Wesley, pp. 99-106.

Example:        Scripts/squid/squid_electronics.g

See also:       

25.6 RC

Object Type:    RC

Description:    A series resistance R, shunted by a capacitance C.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  RCunit_type  [in /usr/genesis/src/segment/seg_struct.h]

Size:           96 bytes

Fields:         V0      initial value of "state" (set on RESET)
                R       series resistance
                C       shunting capacitance
                state   output value
                inject  input value

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       RC_Unit  [in src/segment/rcunit.c]

Classes:        segment

Actions:        CHECK  PROCESS  RESET

Messages:       INJECT inject (input-value)

------------------------------------------------------------------------------

Notes:          

An RC element is often used as a low-pass filter, as with a voltage clamp
circuit, in order to prevent a step change in the command voltage from
causing numerical instabilities.

Example:        Scripts/squid/squid_electronics.g

See also:       

25.7 asc_file

Object Type:    asc_file

Description:    

The asc_file object is used to write data to a file in ASCII format.  A new
line is written at every time step of the clock which is assigned.  Unless
the notime flag is set, the first item on each line is the simulation time.
Each SAVE message which is received adds another item to the line.

Author:         M. Wilson, Caltech (4/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  ascfile_type  [in src/out/out_struct.h]

Size:           88 bytes

Fields:
                filename        data file name to be written
                fp              data file pointer
                is_open         flag: is file currently open?
                initialize      flag: has file been initialized?
                leave_open      flag: leave file open? 1 leaves the file open
                                all the time so you can write on it whenever
                                you want (a good idea if the file is used
                                frequently, but there is a limit to number of
                                files which can be left open any any time);
                                0 closes the file after every write to it
                                (only useful if you have more than 30 files;
                                this is slow)
                append          flag: append data after resetting?
                flush           flag: flush data to disk at each interval?
                                1 forces program to send data to the disk at
                                once and not store it in a buffer (slow but
                                secure); 0 (default) writes data in a buffer
                                (fast)
                notime          flag: if non-zero, don't output the time

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       AscFileOutput  [in src/out/out_ascfile.c]

Classes:        output

Actions:        RESET  PROCESS  DELETE  SAVE

Messages:       SAVE data

------------------------------------------------------------------------------

Notes:

If the filename field is not set, the output file will be given the same
name as the element which is created from the asc_file object.  For binary
data, use disk_out.

Example:        

    create asc_file /out
    setfield /out    flush 1    leave_open 1
    setclock 1 1.0
    useclock /out 1
    addmsg       /cell/soma     /out       SAVE Vm
See also: disk_out , disk_in

25.8 compartment

Object Type:    compartment

Description:    Axially asymmetric compartment. Ra is located on
                one side of the compartment. This is slightly more
                computationally efficient than the symmetric counterpart.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  compartment_type  [in src/segment/seg_struct.h]

Size:           124 bytes

Fields:         Rm              total membrane resistance
                Cm              total membrane capacitance
                Em              membrane resting potential
                Ra              axial resistance
                inject          injected current in membrane
                dia             compartment diameter
                len             compartment length              
                Vm              voltage across the membrane
                previous_state  Vm at previous time step
                Im              total membrane current
                initVm          initial value to set Vm on reset

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       Compartment  [in src/segment/compartment.c]

Classes:        segment
                membrane

Actions:        INIT            assign previous_state = Vm
                PROCESS         update Vm, calculate Im
                RESET           assign Vm = Em
                CHECK           make sure Rm>0, Cm>0, 
                                Ra'>0 (if RAXIAL message is present), 
                                Ra>0 (if AXIAL message is present)
                SAVE2
                RESTORE2

Messages:       CHANNEL Gk Ek   delivers the conductance and equilibrium
                                potential of channel within the compartment
                RAXIAL Ra Vm    delivers the Ra and Vm of a compartment
                AXIAL Vm        delivers the Vm of a compartment
                INJECT inject   sets the inject field to the message value
                EREST Em        sets the Em  field to the message value

------------------------------------------------------------------------------

Notes:          Simulates a section of passive membrane or cable. The
                potential across the membrane is given by Vm. There is a
                leakage path for current through the resistance Rm. This
                resistance is in series with a leakage battery Em. This
                compartment can be coupled to other compartments with an axial
                resistance Ra.  The compartment is not symmetrical, with Ra
                lumped to one side of the compartment.  Any number of ionic
                channels can be introduced into the membrane (Gk, Ek in the
                circuit diagram).  The membrane also allows current
                injection.

                When a compartment performs its RESET action (usually
                invoked by the reset command), Vm is set to the value of the
                initVm field.  Normally, initVm follows any changes to Em,
                so Vm will be initialized to Em upon reset.  If, as in the
                Hodgkin-Huxley model, Em is a leakage potential that is
                different from the rest potential, initVm may be set to the
                rest potential.  It will then no longer follow Em, and Vm
                will be set to the rest potential upon reset.
                
                Calculates Vm using:
                
                    dVm/dt = {(Em - Vm)/Rm + SUM[(Ek - Vm)*Gk] + 
                        (Vm' - Vm)/Ra' + (Vm'' - Vm)/Ra + inject}/Cm

                In the diagram, the compartment shown in the middle
                receives the Vm' and Ra' of the upper compartment with
                an RAXIAL message, and the Vm'' of the lower compartment
                with an AXIAL message.  Channels deliver their Gk and Ek
                with a CHANNEL message.

                    Vm'
                   o_________________________________________________
                   |                |             |        |        |
                   \
                   /  Ra'
                   \
                   | 
                   |
                   | Vm
                   o_________________________________________________
                   |                |             |        |        |
                   \                |             |        |        |
                   /  Ra            \             \        |        |
                   \              --/-->          /        |     ___|___
                   |             Gk \        Rm   \       / \    _______ Cm
                   |                |             |      / A \      |
                   |                |             |      \ | /      |
                   |         Ek    ---       Em  ---      \ /       |
                   |             -------       -------     | Iinject|
                   |                |             |        |        |
                   |                |_____________|________|________|
                   |
                   | Vm''
                   o_________________________________________________
                   |                |             |        |        |

Example:        
See also: symcompartment

25.9 ddsyn

Object Type:    ddsyn

Description:    modified synchan with table front end to transform voltage
                to activation, for dendro-dendritic synapses.  Calculates
                channel current therefore needs membrane state.

Author:         U. S. Bhalla, Caltech (5/91)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  dd_syn_type  [in src/olf/olf_struct.h]

Size:           164 bytes

Fields:         Gk              channel conductance
                Ik              channel current
                Ek              channel reversal potential
                gmax            maximum conductance
                tau1            open time constant of channel activation
                tau2            close time constant of channel activation
                transf          table for transform from Vm to activation;
                                usual interpolation element with the normal
                                set of fields; set up using TABCREATE, filled
                                by indexing as usual, and interpolated using
                                TABFILL
                activation      channel activation; set either by a table
                                lookup of the transform of the incoming
                                VOLTAGE message or by synaptic input
                transf_alloced  flag for allocation of transform
                X               state variable for time response
                Y               state variable for time response

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       DDSyn  [in src/olf/dd_syn.c]

Classes:        segment, channel

Actions:        INIT
                PROCESS
                RESET
                CHECK
                SET
                DUMP
                SAVE2
                RESTORE2
                TABCREATE
                TABFILL

Messages:       VOLTAGE voltage                 [tells channel what membrane
                                                potential is]

                ACTIVATION activation           [sends activation directly to
                                                channel; sums linearly with
                                                other ACTIVATION input and
                                                transformed V_PRESYN input]

                V_PRESYN presynaptic-voltage    [sends presynaptic voltage to
                                                transform table; sums linearly
                                                at output of table, so
                                                multiple V_PRESYN inputs are
                                                first transformed, then their
                                                activations are summed]

                RAND_ACTIVATION                 [rather than sending direct
                  probability  amplitude        activation signal, specifies
                                                probability (from 0 to 1) that
                                                activation of size amplitude
                                                will occur at synapse (useful
                                                for sending random synaptic
                                                input to synapse)]

------------------------------------------------------------------------------

Notes:          Dendrodendritic synapse with tabulated transform
                from presyn potential to postsyn activation.
                The table for the transform is created using tabcreate
                and is shared with all copies of the element

                The ddsyn element is the equivalent of a synchan element
                with a tabulated transform from input voltage to channel
                activation. This serves as a way of representing
                dendro-dendritic synapses.  The usual fields and messages for
                the synchan element remain available. The table entries are
                filled in the usual ways from the script interface, and can be
                shared between ddsyn elements.

Example:        Here we create a ddsyn channel to act as the synaptic input
                for granule cells in an olfactory bulb model.

                    // for dd, ax, and centrif inputs
                    create      ddsyn   glu_gran_usb
                    call glu_gran_usb TABCREATE 10 -0.070   0.05
                    setfield  glu_gran_usb \
                        Ek          {EGlu} \
                        tau1        4.0e-3 \   // sec
                        tau2        6.0e-3 \   // sec
                        gmax        {GGlu} \   // Siemens
                    // Setting up the table for transforming
                    // from presyn Vm to activation
                        transf->table[0] 0 \
                        transf->table[1] 0.05 \
                        transf->table[2] 0.1 \
                        transf->table[3] 0.2 \
                        transf->table[4] 0.5 \
                        transf->table[5] 0.7 \
                        transf->table[6] 0.8 \
                        transf->table[7] 0.9 \
                        transf->table[8] 0.95 \
                        transf->table[9] 0.98 \
                        transf->table[10] 1
                    call glu_gran_usb TABFILL 1000 0
                                
See also:  Scripts/examples/ddsyn

25.10 diffamp

Object Type:    diffamp

Description:    Difference amplifier, takes two inputs and produces an
                output proportional to their difference.

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  diffamp_type  [in src/device/dev_struct.h]

Size:           96 bytes

Fields:         gain
                saturation
                plus
                minus
                output

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       DifferenceAmp  [in src/device/diffamp.c]

Classes:        device

Actions:        RESET           sets the output to zero
                PROCESS         calculates and sets the output from the inputs

Messages:       PLUS +input 
                MINUS -input 
                GAIN gain

------------------------------------------------------------------------------

Notes:

Adds inputs from PLUS messages and subtracts those received with MINUS
messages.  The output is this total, multiplied by gain, but limited to the
range -saturation to +saturatation.  If there are no MINUS messages, the
minus input is taken as zero.  Normally, the gain field is set using
"setfield", but it may also be varied with a GAIN message.  This object also
provides a convenient way to sum or scale quantities which are to be plotted
by sending a PLOT message to an xgraph.

Example:        

See also:       

25.11 disk_in

Object Type:    disk_in

Description:    Reads in a 2-d array of data from an ascii or binary file.

Author:         U. S. Bhalla, Caltech (1/90)
                Coordinate read-in added by U. S. Bhalla, Mt. Sinai, 5/95.

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  disk_in_type  [in src/olf/olf_struct.h]

Size:           148 bytes + allocation for arrays and interpols

Fields:         filename        name of data file
                leave_open      flag: leave file open between steps [cycles]
                nx              x dimension of input val array
                ny              y dimension of input val array
                loop            flag: return to start of file on EOF
                val             2D array of input values
                fp              pointer to file
                fileformat      flag: 0 (default) for ASCII, 1 for FMT1
                time_offset     offset from sim time for FMT1 files
                is_open         internal flag : is file open yet?
                allocated       internal flag: Is array allocated yet?
                tempdata        data array used for FMT1 reading
                start_time      field used for FMT1 handling
                dt              field used for FMT1 handling
                datatype        field used for FMT1 handling
                header_size     field used for FMT1 handling
                lastpos         field used for FMT1 handling
                xpts,ypts,zpts  Interpols used for storing coordinate
                                information when FMT1 files are read.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       DiskIn  [in src/olf/disk_in.c]

Classes:        segment

Actions:
        RECALC  CHECK  SET  RESET  PROCESS  INIT

Messages:       
        none
------------------------------------------------------------------------------

Notes:  
                The disk_in element reads in data from a file to the val
                array in the element every clock tick.  This is a 2-d array
                with dimensions set by the nx and ny fields.

                The source file can be either in ASCII or FMT1 formats.  FMT1
                is the GENESIS-specific format used by disk_out.  Data in
                FMT1 files is time-stamped, and accessed according to the
                current simulation clock.

                At RESET, disk_in automatically figures out if the file
                is FMT1. If not it assumes it is ASCII. The fileformat
                flag is set accordingly. 

                FMT1 files contain information on the number of data items, 
                and the 3-d coordinate information for each item. On RESET,
                the 'val' array is automatically allocated for the data values.
                nx is set to 1, and ny is set to the number of data items.
                Also on RESET, the coordinate information is loaded into the
                xpts,ypts,zpts interpol-structs, which are automatically
                allocated as needed. These interpols can be accessed in
                the usual ways. See the interpol documentation.

                ASCII files do not have coordinate information. The nx and ny
                fields must be set prior to reading in an ASCII file, so
                that the disk_in can figure out how many data points to
                read per time-step. Changing nx and ny causes
                automatic reallocation of the 'val' array, with dire
                results for any messages that had been linked to earlier
                incarnations of the val array.  In other words, never set
                the nx or ny unless you are sure that no messages
                are being sent from the input array. Typically one sets
                nx and ny as soon as one creates the disk_in, and
                later adds messages.

                The leave_open flag should normally be set to 1 to avoid
                closing and reopening the file every clock tick.

                The time_offset field allows one to specify the difference
                between the simulation time and the FMT1 internal time stamp.

                The format of the ascii file is simply a sequence of numbers,
                separated by spaces, tabs or newlines, with a maximum of 16
                numbers per line.  They are read in sequentially to fill the
                val[x][y] array, the x index being incremented more rapidly .
                Every time a new clock tick is read in, the reading starts
                from a new line, discarding any unread data on the previous
                line.

                The format of the FMT1 file is highly condensed. See the
                source (in src/out/out_view.c) and the documentation for
                disk_out for more details. In general, it includes information
                on the size of the file, the coordinates of all elements
                whose values are stored, and the time-step at which successive
                data values are stored.

Example:        

    create disk_in /in
    // read a single line with 2 variables at each time step
    // from the file Vm1 (in Scripts/MultiCell)
    setfield  /in nx 2 ny 1 filename Vm1 dt 1 leave_open 1
    create xform /form
    create xgraph /form/graph
    setfield /form/graph xmax 500 ymin -100 ymax 50
    // The Vm value is the second one on each line
    addmsg /in /form/graph PLOT val[1][0] *Vm *red
    xshow /form
    reset
    step 500
Alternatively, the message from the disk_in element could have been an INPUT
message to a spikegen element.  The spikegen element could then send a SPIKE
message to a synchan element, as in Scripts/tutorials/tutorial4.g.

If we had 100 cells, each containing a spikegen element, with names
``cell[0]/spike'' through ``cell[99]/spike'' and a data file containing
multiple groups of 10 lines with 10 Vm values each, to represent 100
simultaneous inputs, we could use statements like this:

    // send a message for each spike generator
    for (i=0;i<=9; i = i + 1)
        for (j=0;j<=9; j = j + 1)
             addmsg /in /cell[{j + 10*i}]/spike INPUT val[{i}][{j}]
        end
     end

Normally, you will want to use a clock with a much larger step for reading
in the data than that used for the integration of the equations for
calculating membrane potentials, etc.  Otherwise, the data file would have
to be very large.  The example in Scripts/examples/XODUS/fileview also
illustrates the use of arrays and the binary format.
See also: asc_file , disk_out

25.12 disk_out

Object Type:    disk_out

Description:    

The disk_out object is used to write data to a file in a special binary
format.  This is done at every time step of the clock which is assigned.
These files are usually used with a disk_in object and the xview widget or
the xgraph widget to "replay" the results of a simulation.  An external
program (or your own compiled GENESIS function) can write files in this
format in order to provide a convenient interface to the display
capabilities of XODUS.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  file_type  [in src/out/out_struct.h]

Size:           88 bytes

Fields:         filename        data file name to be written
                fp              data file pointer
                is_open         flag: is file currently open?
                initialize      flag: has file been initialized?
                leave_open      flag: leave file open? 1 leaves the file open
                                all the time so you can write on it whenever
                                you want (a good idea if the file is used
                                frequently, but there is a limit to number of
                                files which can be left open any any time);
                                0 closes the file after every write to it
                                (only useful if you have more than 30 files;
                                this is slow)
                append          flag: append data after resetting?
                flush           flag: flush data to disk at each interval?
                                1 forces program to send data to the disk at
                                once and not store it in a buffer (slow but
                                secure); 0 (default) writes data in a buffer
                                (fast)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       FileOutput  [in src/out/out_file.c]

Classes:        output

Actions:
        SAVE  DELETE  PROCESS  RESET

Messages:       SAVE data

------------------------------------------------------------------------------

Notes:

If the filename field is not set, the output file will be given the same
name as the element which is created from the disk_out object.  Use asc_file
for writing the data in ASCII format.

Example:

(from Scripts/orient_tut/V1_output.g)

function do_disk_out(diskpath,srcpath,field)
  str name
  create disk_out /output/{diskpath}
  setfield /output/{diskpath} leave_open 1  flush 1
  addmsg {srcpath} /output/{diskpath} SAVE {field}
end

do_disk_out vert_disk /lgn/vert/soma[] Vm
do_disk_out horiz_disk /lgn/horiz/soma[] Vm

Also see the example in Scripts/examples/XODUS/fileview/generate.g.

Normally, you need not be concerned with the format of the files produced
by a disk_out element.  However, you may wish to write either a GENESIS
function or an external program which produces an output file which can
be displayed with an xview widget.  The code which writes a disk_out
file can be found in /usr/genesis/src/out/out_file.c, and the code which
reads the data from the file can be found in /usr/genesis/src/out/out_view.c.

The following two C programs describe this format and show how to write and
read these data files.

------------------------------------------------------------------------------

/* diskwrt.c - a demo program to write a sample file "test_disk" in the
GENESIS "disk_out" format, to be viewed with the xfileview widget.  */

#include <stdio.h>
#include <math.h>

main()
{
FILE *fpr;
int width = 5;
int height = 5;
float start = 0.0;
float dt = 1.0;
float x, y, data;
int ntimes;

fpr = fopen("test_disk", "w");
headerwrt(start, dt, width, height, fpr);

data = 0.0;     /* make some bogus data */
for (ntimes = 0; ntimes < 20; ntimes++)
    for (y = 0.0; y < height; y++) {
        for (x = 0.0; x < width; x++) {
            data = x*x + y*y + height*ntimes;
            fwrite (&data, sizeof (float),1, fpr);
        }
}
fclose(fpr);
} /* end main */

headerwrt(start, deltat, width, height, fp)
/* Header for files compatible with GENESIS disk_out
"FMT1" - 80 byte null terminated character string as identifying label
start - starting time - float
dt - time step - float
ndata - number of data points per time step - int
datatype - int code for data type - disk_out uses only FLOAT = 4, but
        display routines can use DOUBLE = 5, INT = 3, SHORT = 2.
x1,y1,z1,x2,y2,z2,....,xndata,yndata,zndata - x,y,z coordinates for icon
        representing each data point - float
The header is then followed by data -  ndata values for each time step,
        with the data type specified by "datatype".
*/

float start, deltat;
int   width, height;
FILE *fp;
{
char label[80];
float strt, dt;
int ndata, datatype;
float x, y, z;
float dx = 2.0;         /* horiz spacing between icons */
float dy = 2.0;         /* vert spacing between icons */
int i, j;

    strt = start;       /* use local variables so addresses are correct */
    dt = deltat;        /* otherwise fwrite gets wrong start and deltat  */

    strcpy(label,"FMT1");
    fwrite (label, sizeof (char),80, fp);
    fwrite (&strt, sizeof (float),1, fp);
    fwrite (&dt, sizeof (float),1, fp);
    ndata = width*height;
    fwrite (&ndata, sizeof (int),1, fp);
    datatype = 4;       /* use float data */
    fwrite (&datatype, sizeof (int),1, fp);
    z = 0.0;            /* 2-D display */
    for (j=0, y = 0.0; j < height; j++) {
        for (i=0, x = 0.0; i < width; i++) {
            fwrite (&x, sizeof (float),1, fp);
            fwrite (&y, sizeof (float),1, fp);
            fwrite (&z, sizeof (float),1, fp);
            x = x + dx;
        }
        y = y + dy;
    }
}
------------------------------------------------------------------------------

/* diskrd.c - Reads and displays the header information of files produced by
the GENESIS disk_out widget */

#include <stdio.h>

main(argc,argv)
int     argc;
char    **argv;
{
char    label[100];
float   fval;
int     i;
int ndata;
int datatype;
FILE    *fp;

    if(argc < 2){
        printf("usage: %s filename\n",argv[0]);
        exit();
    }
    if((fp = fopen(argv[1],"r")) == NULL){
        printf("unable to find file '%s'\n",argv[1]);
        exit();
    }
    /*    read in the file header    */
    fread(label,sizeof(char),80,fp);
    /*    check the label    */
    if(strncmp("FMT1",label,4) != 0){
        printf("file '%s' is not a valid FMT1 data file\n",argv[1]);
        fclose(fp);
        exit();
    }

    /*    starting time    */
    fread (&fval, sizeof (float),1,fp);
    printf("%-20s = %e\n","start time",fval);
    /*   time step    */
    fread (&fval, sizeof (float),1,fp);
    printf("%-20s = %e\n","time step",fval);
    /*    number of data points    */
    fread (&ndata, sizeof (int),1,fp);
    printf("%-20s = %d\n","ndata points",ndata);
    /** data type    */
    fread (&datatype, sizeof (int),1,fp);
    printf("%-20s = %d\n","data type",datatype);
    fclose(fp);
}
----------------------------------------------------------------------------
See also: disk_in , asc_file

25.13 diskio

Object Type:    diskio

Description:

The diskio object can be used to open/create a binary format file 
on disk (specified with -fileformat option)
that can be then used to read/write data or metadata from/to it with 
child objects, 'variable' or 'metadata' respectively in this same library. 
Unlike disk_out/disk_in, the reading and writing actions are combined 
into this one new object. 

For purposes of backwards compatibility (BC), diskio responds to the 
set of messages that disk_out and disk_in respond to at a minimum, and 
allows the user to read/write files directly from/to the disk at every
time-step of the clock which is assigned. It also allows the "replay" of 
the results of a simulation through the xview and xgraph widgets in XODUS.

Currently, it only supports files in the Network Common Data 
Format (netcdf), a portable, network transparent, public domain binary format. 
Netcdf interfaces to various popular analysis/signal-processing tools including 
MATLAB are available in the public domain. Specifically,

        * MEXCDF 
                WEB: http://crusty.er.usgs.gov/mexcdf.html 
                FTP: crusty.er.usgs.gov (128.128.19.19) or contact
                         Rich Signell at rsignell@crusty.er.usgs.gov. 
        
        * MexEPS 
                WEB: http://www.pmel.noaa.gov/epic/mexeps.html 
                FTP: ftp.pmel.noaa.gov/epic/mexeps/

        * fanmat 
                WEB: http://www.unidata.ucar.edu/packages/netcdf/contrib.html
                FTP: ftp.unidata.ucar.edu/pub/netcdf/contrib/fanmat.taz

are freely avaible packages that allow MATLAB to read/write/visualize netcdf
data.

The implementation of the diskio library and the diskio, metadata, and
variable objects makes use of netcdf - version 2.4.3 which is Copyright
1993-1997 by University Corporation for Atmospheric Research/Unidata.  the
netcdf library is provided as per the terms of the UCAR/Unidata license,
described in genesis/src/diskio/interface/netcdf-2.4.3/src/COPYRIGHT.

Author:         V.Jagadish, Caltech (9/96)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure: Gen_Diskio_Type  [in src/diskio/diskio_struct.h]

Size:           144 bytes + allocation for arrays and interpols

Fields:         accessmode      Mode with which the file is accessed
                                - 'r', 'w' or 'a' (Read/Write/Append)
                                - Read-only field specifiable on the command    
                                   line using the -accessmode option but 
                                   cannot 
                                   be set/unset subsequently using setfield
                                - Defaults to 'r' (Read mode) as this is the    
                                  most non-destructive
                                - Append 'a' mode is not supported currently

                                - BC NOTE: Due to the default mode being 
                                  readonly 'r', it is not sufficient to 
                                  merely replace creation-lines of 
                                  disk_out with diskio but 
                                  to add the option "-accessmode w" as well.
                                  cf. See Examples.

                filename        Data file name to read from or write into
                                - Defaults to name of object if not specified
                                - Can be set/unset as required : The old file
                                  will have data and metadata written into it 
                                  till that point in time, if the accessmode 
                                  was 'w' (write). 

                fileformat      Format of the data file
                                - Unlike disk_out it is a character string 
                                  field but allows numerical setting for BC. 
                                  ("1" => netcdf)
                                - Defaults to netcdf if not specified
                                - Subsequent setting/unsetting of this field 
                                  is allowed only to preserve BC with disk_out/
                                  disk_in. This is effectively a NOP as far as
                                  the physical file is concerned. Only the 
                                  the value of the field changes to reflect 
                                  the setting.

                append          Flag: 1 => data should be appended after 
                                RESET

                is_open         Read-only flag: is file currently open?

                is_writable     Read-only flag: is file writable?

                val             2D array of input values        
        
                nx              x dimension of input val array 

                ny              y dimension of input val array

                xpts,ypts,zpts  Interpols used for storing coordinate
                                information when the binary file is read

                flush           Dummy field to retain BC with disk_out

                leave_open      Dummy field to retain BC with disk_out  

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       Gen_Diskio  [in src/diskio/gen_diskio.c]

Classes:        output

Actions:        CREATE PROCESS SET ADDMSGIN DELETEMSGIN SHOW

                RESET:
                        It is essential that the RESET action be called 
                        on the diskio object for allocating and filling the 
                        "xpts ypts zpts" interpol arrays before using 
                        them to render/replay data graphically on the   
                        xview objects. 
                        cf. Example: Scripts/examples/diskiolib/replayview.g

                QUIT:
                FLUSH:
                UPDATE: when called on the diskio object, allows the user 
                        to commit any changes done interactively 
                        or in the process of running a simulation or script, 
                        to the file on disk. This allows another diskio 
                        object to simultaneously access updated data from the 
                        same file.


                DELETE: also commits changes but with the usual effect of 
                        deleting the object and all its children. Please note 
                        that this action does not delete the physical file on 
                        disk. 

                GENERAL NOTE:   The process of committing changes to disk is 
                                time-consuming. This is inherent in the 
                                implementation of the netcdf library. So 
                                please expect delays after you quit or do a 
                                delete or call one of the above 4 actions on 
                                the diskio object. In general, the netcdf
                                library provides its portability across 
                                architectures at the cost of efficiency in 
                                speed. Therefore, performance-wise one will
                                notice diskio is slower than disk_out/disk_in.

Messages:       SAVE data

                IMPORTANT BACKWARDS COMPATIBILITY (BC) NOTES:
                ---------------------------------------------

                As previously mentioned, diskio responds to the same set of 
        messages that disk_out and disk_in respond to as a minimum, for
        purposes of BC. 
        
        Since the actual data is encapsulated within the variable 
        object and the design eventually envisages the exclusive 
        use of this child object to manipulate data, any incoming SAVE
        messages to the diskio object (thro the addmsg command) will 
        result in the automatic creation of child variables and the 
        forwarding of the message to them. So the data will be stored
        and manipulated via these child variables, while letting the user 
        transparently deal only with the diskio object as was done previously
        with disk_out/disk_in.

        For every SAVE message there will be a specially named child 
        variable object - 'autoSAVE_diskio[i]', where i is the index of 
        the element and that corresponds to the number of the message.   
        The indices will be reused if any messages are deleted and added 
        later. 

        Also, for every SAVE message, the 3-D position coords of the source     
        element needs to be stored for possible future replay via graphical
        objects like xview. This is done through the automatic creation of 
        specially named indexed metadata children - 'auto3-DPosSAVE_diskio[i]'.

        So in applications where diskio is intended to be used 
        as a replacement for disk_out/disk_in, these variables & metadata
        will be automatically created in the hierarchy for every SAVE message 
        to the object. Directly manipulating these child objects should be 
        avoided, since it would essentially change the contents of the file,
        if committed.  

        Example: 
                * Run Scripts/examples/diskiolib/diskio/generate.g
                * genesis> le /diskio

------------------------------------------------------------------------------

Notes:

As a departure from the disk_out/disk_in objects, this object internally 
just serves to interface (open/create/close) with a binary file on disk.  

The actual data in the file can be more flexibly managed using the child 
'variable' objects in this library.
For purposes of backwards compatibility, however, the diskio object will
respond to the same messages as the disk_out and disk_in objects at a minimum
to actively write/read data to/from the file during a simulation run. 

Some binary file formats notably netcdf (which this library supports) allow
descripive data (metadata) to be stored in them along with the actual data.
Child 'metadata' objects in this library allow the user to manipulate the 
metadata content in these files.

Use asc_file for writing data in ASCII format. 

Examples:

1. create diskio /dout -filename testfile.nc -fileformat netcdf -accessmode w

2. call /dout UPDATE

3. delete /dout 

4. Also, please see Scripts/examples/diskiolib/diskio/
                                        - generate.g
                                        - replayview.g
                                        - replaygraph.g
______________________________________________________________________________
See also: variable , metadata , disk_out , disk_in , asc_file

25.14 efield

Object Type:    efield

Description:    An extracellular field potential recording electrode that uses
                current sources and their distance from the electrode site to
                calculate the field.            

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  efield_type  [in src/device/dev_struct.h]

Size:           64 bytes

Fields:         scale
                field
                x
                y
                z

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ExtracellularRecordingElectrode  [in src/device/efield.c]

Classes:        device

Actions:        PROCESS
                RESET
                RECALC

Messages:       CURRENT current 0.0

------------------------------------------------------------------------------

Notes:          If one assumes that the medium surrounding neurons is
                of homogeneous resistivity and has no capacitance,
                then the field potential generated by a compartmental
                model can be calculated from the following equation:

                                          Im
                              1      n      i   
                        F = ------  SUM  -----  (see Nunez, 1981)
                            4*pi*s  i=1    R
                                            i

                where F is the field potential in volts, s is
                conductivity in 1/(Ohms*m), Im_i is the transmembrane
                current (Amperes) accoss the ith  neural compartment,
                and R_i is the distance from the ith neural
                compartment to the recording electrode (i.e. the
                efield object).  

                In the case of the efield object, the term 1/(4*pi*s) 
                is replaced by the scale field, otherwise the same
                equation is used to calculate field potentials.
                The RECALC action must be called in order for efield 
                to calculate the distances to neural compartments.

                For more information about field potentials and how
                they are used in GENESIS simulations, see Chapter 9 in
                The Book of GENESIS.  For a derivation of the above
                equation, see:

                Nunez, P.L. (1981) Electric Fields of the Brain: The
                Neurophysics of EEG, Oxford University Press, Oxford.
                                                        

Example:        create efield electrode
                setfield electrode scale -1e3 x 0.00 y 0.00 x 0.00
                addmsg some_compartment electrode CURRENT Im 0.0
                call electrode RECALC

See also:       Scripts/piriform/field.g

25.15 enz

Object Type:    enz

Description:    Enzyme activity for a pre-existing pool. An enz does two
                things: it handles the reactions in the Michaelis-Menten (MM)
                scheme below, and it also acts as a pool to represent the
                enzyme-substrate complex. It can only be
                created on a pool, it is not an independent object.

                The MM scheme is modeled as:
                                        k1              k3
                Substrate + Enzyme  <-----> EnzComplex ----> Enz + Prd
                                        k2

                The enz is really a utility object, as it replaces
                two reacs and a pool, but does not add anything extra.
                
Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1993).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  enz_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         CoComplex               Concentration of enz-substrate complex.
                                        CoComplex = nComplex/vol
                CoComplexInit           Initial concentration of enz-substrate
                                        complex.
                                        CoComplex gets set to this value on
                                        RESET.
                nComplex                Number of molecules of complex.
                nComplexInit            Initial number of molecules of complex.
                                        'nComplex'gets set to this value on
                                        RESET.
                vol                     Volume occupied by enzyme. Often
                                        involves scale factor so as to have
                                        direct conversion from 'n' to some
                                        sensible units of Co, such as
                                        micromolar.
                sA                      A state variable to pass to substrate
                                        in messages.
                pA                      A state variable to pass to products
                                        in messages.
                eA                      A state variable to pass to parent
                                        enzyme pool in messages.
                B                       B state variable to pass to substrate
                                        and parent enzyme pool in messages
                k1,k2,k3                Michaelis-Menten parameters. 


                keepconc                Flag determining whether to change
                                        concs or n when volume changes
                usecomplex              Flag. Determines whether the enzyme
                                        complex is used when the parent enzyme
                                        is involved in other reactions.
                                        Consider:

                                        E + A <----> E.A
                                        
                                        where E is a pool reacting with A.
                                        Suppose E has an enzyme site. Then,
                                        whenever some of the enzyme is complexed
                                        with a substrate, the conc of E
                                        decreases unless 'usecomplex' is true.
                ksum                    Internal variable. ksum = k2 + k3.
                

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       EnzFunc  [in src/kinetics/enz.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       ENZYME          n       [n is number of molecules of enzyme
                                        pool to which this site is attached]
                SUBSTRATE       n       [Number of molecules of substrate]
                VOL             vol     [volume of enzyme pool]
                INTRAMOL        n       [Total number of molecules in an
                                        intramolecular reaction]


------------------------------------------------------------------------------
Notes: See pool documentation for example of use.

25.16 funcgen

Object Type:    funcgen

Description:

This is a function generator which produces periodic output with a waveform
set by the mode field.

Author:         M. Wilson, Caltech (4/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  funcgen_type  [in src/device/dev_struct.h]

Size:           96 bytes

Fields:         mode            flag: 0=sine; 1=square; 2=triangle; 3=constant
                amplitude       peak-to-peak amplitude
                dc_offset       constant to be added to output
                phase           phase in degrees
                frequency       frequency
                output          output waveform

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       FunctionGenerator  [in src/device/funcgen.c]

Classes:        device

Actions:        CHECK  PROCESS  RESET

Messages:       AMPLITUDE amplitude
                DC_OFFSET dc_offset
                PHASE phase
                FREQUENCY frequency

------------------------------------------------------------------------------

Notes:

In a simulation, you would set up messages between the funcgen element
(in our example it is called "funky") and other elements which are to
receive its output.  For example:

  addmsg funky funcplot PLOT output *function *red  // funcplot is an xgraph
  addmsg funky Exc_channel ACTIVATION output  // Exc_channel is a synchan

Example:        Scripts/examples/sigmoid

See also:       

25.17 hebbsynchan

Object Type:    hebbsynchan
 
Description:    Synaptically activated channel with a simple mechanism for
                hebbian weight changes as a function of pre- and postsynaptic
                activities.
 
Author:         Mike Vanier 9/95; revised 4/96
 
--------------------------------------------------------------------------------
 
ELEMENT PARAMETERS

DataStructure:  HebbSynchan_type  [in src/newconn/newconn_struct.h]
 
Size:           296 bytes
 
Fields:         activation         driving force (transmitter) for channel
                                   conductance
                Ik                 channel current
                Gk                 time varying channel conductance
                Ek                 reversal potential of channel
                tau1               first time constant of channel activation
                tau2               second time constant of channel activation
                gmax               peak channel conductance
                frequency          random activation frequency (default = 0)
                nsynapses          number of incoming spike messages (read only)
                event_buffer_size  size of event buffer (read only)
                pending_events     number of pending spike events in event
                                   buffer (read only)
                nodes_per_synapse  number of event nodes to allocate per
                                   synapse (default = 1)
                synapse            synapse buffer
                pre_tau1           rise time constant for presynaptic averaging
                pre_tau2           decay time constant for presynaptic averaging
                pre_thresh_lo      lower presynaptic threshold
                pre_thresh_hi      upper presynaptic threshold
                avg_Vm             averaged membrane potential (read only)
                post_tau           time constant for postsynaptic averaging
                post_thresh_lo     lower postsynaptic threshold
                post_thresh_hi     upper postsynaptic threshold
                post_scale         scaling factor for postsynaptic activities 
                weight_change_rate rate of weight change (roughly in units/sec)
                min_weight         minimum weight
                max_weight         maximum weight  
                change_weights     flag: nonzero means weights can be changed 

--------------------------------------------------------------------------------

SIMULATION PARAMETERS
 
Function:       HebbSynchan  [in src/newconn/hebbsynchan.c]
 
Classes:        segment channel synchannel
 
Actions:        CREATE             set synapse_size hidden field
                INIT               assign activation = 0
                PROCESS            update Gk, calculate Ik; calculate hebbian
                                   presynaptic and postsynaptic activities
                RESET              assign activation = 0, Gk = 0; calculate
                                   time-step-dependent coefficients
                RECALC             recalculate time-step-dependent coefficients
                CHECK              make sure tau1 > 0, tau2 > 0; make sure a 
                                   VOLTAGE message is present (in order to 
                                   calculate Ik); check hebbian fields, etc.
                SAVE2              called by the save command
                RESTORE2           called by the restore command
                EVENT              put a spike event into the event buffer
                ADDMSGIN
                DELETEMSGIN
                MSGINDELETED
                RESETBUFFER        reset size of event buffer to 
                                   (nodes_per_synapse * nsynapses) nodes
                DELETE             delete the element
                COPY               copies the element
 
Messages:       VOLTAGE            Vm
                ACTIVATION         activation
                RAND_ACTIVATION    probability amplitude
                MOD                modulation
                WEIGHT_CHANGE_MOD  modulation
                SPIKE
 
------------------------------------------------------------------------------

Notes:          This object simulates a time-dependent synaptically
                activated ionic channel.  A variable channel conductance Gk
                is activated by the application of transmitter. This
                conductance then changes with damped second-order
                characteristics with a time course given by two time
                constants tau1 and tau2.  This gives rise to an
                alpha-function/dual-exponential conductance waveform for an
                impulse spike input.  The channel also calculates channel
                current Ik and therefore needs the membrane state (Vm).

                Each SPIKE message to a synchan or hebbsynchan establishes a
                synaptic connection and increments nsynapses.  The synapses
                are numbered starting with 0, and each contains a field for a
                synaptic weight and a propagation delay.  For example, the
                weight of the first synaptic connection is held in the field
                "synapse[0].weight".  Gk reaches a value gmax*weight for a
                single event delivered with a SPIKE message.  Note that even
                though synapses are not elements, they do have fields that can
                be accessed individually.  They can be thought of as
                "sub-elements" or substructures of the element.  The fields
                the user should be concerned about in the synapse are "weight"
                and "delay".

                The above description is also true for the synchan object.
                Hebbsynchans also have a "pre_activity" field, described
                below.  Note that this field was named "pre_avg" in GENESIS
                version 2.0.1.  The hebbsynchan object also updates the
                synaptic weights of the synapses based on the presynaptic
                "activities" (which are calculated separately for each
                synapse) and the postsynaptic activity (which is the same for
                all synapses which are part of a given hebbsynchan).  The
                activities are artificial values which do not have a direct
                relationship to any real biological entities; very loosely we
                can think of the presynaptic activity as being the amount of
                calcium current through an NMDA receptor while the
                postsynaptic activity is derived from an average of the
                postsynaptic membrane potential (which will affect NMDA
                receptors in reality).  The pre- and postsynaptic activities
                are used to update the weights in a roughly Hebbian manner
                described below, which is similar but by no means identical to
                the way NMDA-dependent LTP works.  For serious GENESIS
                hackers, we have isolated the actual weight change algorithm
                in a single function in "hebbsynchan.c" which can be altered
                if you need a different algorithm.  If you want to calculate
                pre- or postsynaptic activities differently you have to do a
                lot more work.

                The presynaptic activity is calculated by having each spike
                generate a generalized alpha-function waveform with a
                maximum size of 1 in the "pre_activity" field of the
                synapse.  This is meant to be analogous to an NMDA channel
                conductance so the rise and fall times should be slow; for
                instance we might use pre_tau1 of 10 msec and pre_tau2 of
                100 msec.  Note that this activity value doesn't mean that
                there is a slow conductance being simulated here; it's just
                used to determine a measure of presynaptic spiking
                activity.  When weight updates occur, the presynaptic
                activity relative to two thresholds (pre_thresh_lo and
                pre_thresh_hi) are used to calculate the weight change (see
                below).

                Also at each time step, the membrane potential of the
                compartment the hebbsynchan is connected to is used to
                update the "avg_Vm" field.  This is done by running the Vm
                of the compartment through a leaky integrator with a time
                constant of post_tau.  When weight updates occur, the
                postsynaptic activity relative to two thresholds
                (post_thresh_lo and post_thresh_hi) are used to calculate
                the weight change (see below).  Also, since presynaptic
                activity values are dimensionless but avg_Vm has the
                dimensions of volts, postsynaptic activities are internally
                calculated by dividing the difference between avg_Vm and
                the nearest threshold by "post_scale", which is also in
                units of volts.  You can think of post_scale as the amount
                that avg_Vm has to be above threshold to give a
                postsynaptic activity of 1.0.

                The 2-d space defined by the pre- and postsynaptic
                activities are separated into 9 regions based on two
                presynaptic and two postsynaptic thresholds (called
                "pre_thresh_lo", "pre_thresh_hi", "post_thresh_lo", and
                "post_thresh_hi").  The values of the thresholds are fixed
                and are specified by the user.  The weight changes in each
                of the nine regions are as follows:

             ---------> Presynaptic activity ----->

             low              medium              high

Post-                 |                    |
synaptic              |                    |
activity:             |                    |
             no       |     no change      |  decrease
low        change     |                    |
 |                    |                    |
 |                    |                    |
 |       -------------------------------------------------- <--- post_thresh_lo
 |                    |                    |
 |                    |                    |
\|/       no change   |     no change      |  no change
medium                |                    |
 |                    |                    |
 |                    |                    |
 |                    |                    |
 |       -------------------------------------------------- <--- post_thresh_hi
 |                    |                    |
 |                    |                    |
\|/       decrease    |     no change      |  increase
high                  |                    |
                      |                    |
                      |                    |
                      |                    |

                     ^^^                  ^^^
                pre_thresh_lo          pre_thresh_hi

                The diagram shows what happens for various combinations of
                pre- and postsynaptic activities.  Note that if
                pre_thresh_lo = pre_thresh_hi and post_thresh_lo =
                post_thresh_hi then there are only four regions and the
                weights will always be changing unless both presynaptic and
                postsynaptic activities are below the thresholds.  The
                weight change algorithm used converts pre_activity into a
                value which is the difference between the pre_activity of
                the synapse and the nearest threshold value i.e.

                real_pre_activity = pre_activity - pre_thresh_hi 
                                  (if pre_activity > pre_thresh_hi), OR
                                  = pre_activity - pre_thresh_lo
                                  (if pre_activity < pre_thresh_lo;
                                   note that this gives a negative number), OR
                                  = 0 otherwise

                Similarly, the weight change algorithm calculates a "real"
                postsynaptic activity as follows:

                real_post_activity = (avg_Vm - post_thresh_hi) / post_scale
                                   (if avg_Vm > post_thresh_hi), OR
                                   = (avg_Vm - post_thresh_lo) / post_scale
                                   (if post_activity < post_thresh_lo;
                                   note that this gives a negative number), OR
                                   = 0 otherwise

                Note that the post_thresh values are both in units of
                volts, like avg_Vm.

                Once we have the "real" pre- and postsynaptic activities we
                can update the weights.  Essentially the algorithm now is
                just the Hebb algorithm:

                weight_change = real_pre_activity * real_post_activity *
                                weight_change_rate * dt;

                where dt is the time step size in seconds.  The
                weight_change_rate is a field in the object and has units
                of (1/time).  Thus the overall weight change is
                dimensionless, as is the weight itself.  If
                (real_pre_activity * real_post_activity *
                weight_change_rate) equalled 1.0, then the weight would
                increase roughly at the rate of 1 unit per second.  One
                neat feature of this scheme is that if weight_change_rate
                is negative you get an anti-Hebbian synapse.

                Unfortunately, there's more to it than this.  There are
                also two fields called "min_weight" and "max_weight" which
                keep the weights of synapses connected to the hebbsynchan
                within specified limits.  We could in theory just truncate
                the weights if the weight change algorithm tried to push it
                beyond the limits, but in order to make it more smooth the
                weight change calculated above is modified depending on how
                close you are to min_weight or max_weight.  The effect of
                this is that the weight change rate is reduced when you
                approach either limit.

                There is also a field called "change_weights".  If this is
                set to zero, no weight changes will occur.  Otherwise,
                weight updates will occur according to the above algorithm.
                In addition, hebbsynchans can receive a WEIGHT_CHANGE_MOD
                message (or multiple messages of this type) which will
                modify the effective value of weight_change_rate based on
                the message value.  In this case the effective
                weight_change_rate is the product of the value in the field
                of the object and the value in the message.  The field
                value is not changed.  Thus you can have, say, a
                sinusoidally varying weight change rate by setting
                weight_change_rate to 1.0 and adding a WEIGHT_CHANGE_MOD
                message from a sine wave generator (funcgen object) where
                the sine wave varies from 0 to 2.0, say.

                The "copy" command will fail for any synchan or hebbsynchan
                which is receiving SPIKE messages.  The correct way to set
                up simulations is to set up prototype cells which do not
                receive any SPIKE messages on their synchans, copy these
                cells, and then add the appropriate SPIKE messages (by hand
                or by using planarconnect or volumeconnect).  We are
                working on a more "intelligent" copy command which will
                permit copying of synchans with SPIKE messages, but for
                now, don't do it.

                Default values of hebbian parameters (SI units are assumed
                here):

                pre_tau1             0.010     // seconds
                pre_tau2             0.100     // seconds
                pre_thresh_lo        3.0                          
                pre_thresh_hi        3.0                          
                post_thresh_lo      -0.065     // Volts                
                post_thresh_hi      -0.065     // Volts                
                post_scale           0.002     // Volts    
                weight_change_rate   1.0                                
                min_weight           0.0                                       
                max_weight           100.0                                     
                change_weights       1             
                
Example:        Scripts/examples/hebb/hebb.g
See also: synchan , resetsynchanbuffers , Connections , NewSynapticObjects

25.18 hh_channel

Object Type:    hh_channel

Description:    Implements the channel model described in A.L.Hodgkin and
                A.F.Huxley, J.Physiol(Lond) 117, pp 500-544 (1952)

                In the Hodgkin-Huxley model, the general form for the
                channel conductance is represented as being proportional to
                an activation state variable raised to an integer power
                times an inactivation state variable raised to another
                integer power.  The hh_channel object calculates the channel
                conductance from the equation

                        Gk = Gbar*X^Xpower * Y^Ypower

                In the usual Hodgkin-Huxley notation for the Na channel, X
                corresponds to the activation variable, m, with Xpower = 3,
                and Y corresponds to the inactivation variable, h, with
                Ypower = 1.

                Channel elements which are created from the hh_channel
                object calculate both X and Y by solving differential
                equations of the form

                        dX/dt = alpha*(1-X) - beta*X

                The voltage-dependent rate variables, alpha and beta, can
                each assume one of the three functional forms:

                1 (EXPONENTIAL): alpha(v) = A exp((v-V0)/B)
                2 (SIGMOID):     alpha(v) = A / (exp((v-V0)/B) + 1)
                3 (LINOID):      alpha(v) = A (v-V0) / (exp((v-V0)/B) - 1)

                The form to be used and the constants A, B and V0 are
                specified for each rate variable by setting fields in the
                hh_channel element.

Author:         M. Nelson, Caltech (8/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  hh_channel_type  [in src/hh/hh_struct.h]

Size:           184 bytes

Fields:         activation      channel activation
                Gk              channel conductance
                Ik              channel current
                Ek              channel reversal potential
                Gbar            channel maximum conductance
                X               value of X gate (m)
                Y               value of Y gate (h)
                Xpower          power to raise X gate to
                Ypower          power to raise Y gate to
                X_alpha_FORM    Equation form for X gate alpha rate constant
                                1 = EXPONENTIAL, 2 = SIGMOID, 3 = LINOID
                X_alpha_A       A constant for X gate alpha rate constant
                X_alpha_B       B constant for X gate alpha rate constant
                X_alpha_V0      V0 constant for X gate alpha rate constant
                X_beta_FORM     Equation form for X gate beta rate constant
                                1 = EXPONENTIAL, 2 = SIGMOID, 3 = LINOID
                X_beta_A        A constant for X gate beta rate constant
                X_beta_B        B constant for X gate beta rate constant
                X_beta_V0       V0 constant for X gate beta rate constant
                Y_alpha_FORM    Equation form for Y gate alpha rate constant
                                1 = EXPONENTIAL, 2 = SIGMOID, 3 = LINOID
                Y_alpha_A       A constant for Y gate alpha rate constant
                Y_alpha_B       B constant for Y gate alpha rate constant
                Y_alpha_V0      V0 constant for Y gate alpha rate constant
                Y_beta_FORM     Equation form for Y gate beta rate constant
                                1 = EXPONENTIAL, 2 = SIGMOID, 3 = LINOID
                Y_beta_A        A constant for Y gate beta rate constant
                Y_beta_B        B constant for Y gate beta rate constant
                Y_beta_V0       V0 constant for Y gate beta rate constant

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       hh_channel  [in src/hh/channel.c]

Classes:        segment channel

Actions:        INIT
                PROCESS
                RESET
                CHECK
                CALC_ALPHA
                CALC_BETA
                CALC_MINF

Messages:       VOLTAGE Vm

------------------------------------------------------------------------------

Notes:          The tabchannel object provides a faster and more general way
                to implement this type of channel.

                The CALC_ALPHA, CALC_BETA, and CALC_MINF actions are used with
                calls of the form

                        y = {call <element> CALC_ALPHA <gate> <x-value>}
 
                in order to access values of alpha, beta or m_inf (the steady
                state activation, alpha/(alpha + beta)) for the specified gate
                (X or Y) and a particular value of the independent variable.
                This feature is most often used for making plots of these
                quantities.  Note that the activation time constant can be
                calculated from tau = 1/(alpha + beta).

Example:        Scripts/neurokit/prototypes/hhchan.g
See also: tabchannel , vdep_channel

25.19 hsolve

Object Type:    hsolve

Description:    An object used for implementing the Hines method for the
                implicit solution of dendritic trees, as well as a set of
                routines that maximize speed.  This allows faster, more
                stable numerical integration methods to be used with GENESIS,
                particularly when there are many compartments in a cell.

Author:         U. S. Bhalla and E. De Schutter Caltech 91-93,
                E. De Schutter BBF-UIA 94-96.


------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  hsolve_type  [in src/hines/hines_struct.h]

Size:   552 bytes

Fields: path            wildcard list of compartments to be
                        integrated; specifies all compartments
                        belonging to cell which hsolve element will
                        deal with.  The default is
                        ./##[][TYPE=compartment]

        chanmode        flag that controls channel computations and
                        chip-array use.

                        0 = default. It is the most general, uses least memory
                        and is slowest (no chip-array).  It takes over the
                        actions of compartments only, computing all other
                        object types as before.  As a consequence, all
                        computed fields of the original elements are updated,
                        and all user-setable fields may be set, just as before
                        the element was taken over by the hsolve element.
                        This means that you can add and delete outgoing
                        messages to compartments or other elements whenever
                        you like and easily change parameters during the
                        course of the simulation, making this the easiest mode
                        to use.  It is also the most compatible mode of
                        operation, and is guaranteed to work with any future
                        new object type.  One significant limitation is that
                        you cannot add or delete AXIAL, RAXIAL or CHANNEL
                        messages, once the hsolve element has been created.

                        1 = like chanmode 0, but optimizes calculations for
                        tabchannel equations.  This will be faster than
                        chanmode 0 for models containing tabchannels and
                        tab2Dchannels.

                        2 = assumes integer exponents (maximum = 6) for
                        tabchannel and tab2Dchannel gate variables.  Chanmodes
                        2-4 are the fastest because of the large 'chip-array'.
                        Vm fields of all compartments are updated, but other
                        fields will not be updated after the cell is taken
                        over by hsolve.  Incoming messages from the disabled
                        elements are supported, providing that they are
                        established before the hsolve element is set up.
                        Outgoing messages from the disabled elements are not
                        supported.

                        3 = as chanmode 2, but Vm fields of compartments are
                        not automatically updated.  All disabled elements
                        (including compartments) that had outgoing messages
                        to non-hsolved objects during the SETUP call are,
                        however, updated at a rate determined by outclock.
                        Thus SAVE and PLOT messages will work properly.

                        4 = as chanmode 3, but more variables (e.g. Gk, Ik,
                        Ek, Im and leak) are stored by hsolve so that they can
                        be accessed by SAVE or PLOT messages (see
                        findsolvefield documentation for more details).

        comptmode       flag that selects option for compartment computations

                        0 = uses least memory, and is slightly slower. However
                        the amount of time spent in this part is usually less
                        than 10% of the total, so this should not matter.

                        1 = the default, uses a lot of memory and is twice as
                        fast for the actual Hines matrix calculation.  This
                        may be only a 5% difference.  comptmode 1 is
                        required for chanmodes 2-4.

        calcmode        flag affecting operations for chanmodes 2-4.

                        0 = no interpolation will be performed in lookup
                        tables.  This mode is for backward compatibility with
                        older versions of hsolve (prior to GENESIS 2.1) which
                        did not use interpolation.

                        1 = default mode with linear interpolation of values
                        in lookup tables.

        storemode       flag to allow the output of total currents and
                        conductances.  For each type of voltage gated channel
                        in the model, the total currents or conductances are
                        the sum of the corresponding Ik or Gk fields for all
                        compartments where the channel is present.  This
                        assumes that these channels have the same name in each
                        compartment.  These are stored in an array called
                        itotal.  When the hsolve element is set up, a message
                        will be output giving a list of channel names and
                        corresponding itotal indices, if the 'silent' command
                        has previously been given with a negative argument. 

                        0 = no sums are stored.
                        1 = total currents are stored.
                        2 = total conductances are stored.

        no_elminfo      = 0/1; flag that controls whether the HPUT and HSET
                        actions will work.  Is relevant only for chanmodes
                        2-4.  Default is zero (HPUT and HSET work).
                        Saves memory if non-zero value is used (HPUT, HSET
                        do not work; HRESTORE and HSAVE do).

        outclock        number [0-99] of the clock used for all element
                        updates if chanmode = 3 or 4, will affect SAVE and
                        PLOT messages.  The element update routines are not
                        very efficient, so setting them to a slower clock will
                        speed up things.  Note however that any object that is
                        not computed by the hines solver and that depends on a
                        message from a hsolve-computed object will be affected.

        The other fields displayed with the showobject command are NOT
        to be set by the user.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       HinesSolver  [in src/hines/hsolve.c]

Classes:        hsolver

Actions:        RESET   does the standard reset functions, but also for
                        chanmodes 2-4, it will update all parameters in
                        the chip-array (equivalent to a HRESTORE call) and
                        recompute rate factor tables if clocks were changed.

                DELETE  standard actions
                PROCESS standard actions

                SETUP   setup all internal tables.  Must be called before the
                        hsolve element is used.  User accessible fields
                        (path, chanmode, etc.) should have been set.  Model
                        changes after the SETUP call may have no effect on
                        the computations.

                DUPLICATE  does an efficient duplication of an hsolve element.
                        Use this in a network simulation for identical
                        copies of a neuron. Only the tables containing
                        changing parameters (Vm, etc.) will be duplicated.
                        Syntax: call hsolve1 DUPLICATE hsolve2

                HPUT    updates chip-array.  Fields from a single element are
                        put into the chip-array (chanmodes 2 or 3).  Do this
                        call after a setfield command on the element.
                        Syntax: call hsolve HPUT element_path

                HGET    updates hsolve-computed element.  Computed values are
                        put from the chip-array into a single element
                        (chanmodes 2-4).  Do this call before a getfield on
                        the element.  Syntax: call hsolve HGET element_path

                HRESTORE the complete chip-array is updated.  Fields from all
                        hsolve-computed elements are put into chip-array
                        (chanmodes 2-4).  Do this call after a restore
                        command or after multiple setfield commands.
                        Syntax: call hsolve HRESTORE


                HSAVE   all hsolve-computed elements are updated.  Computed
                        values are put from the chip array into all elements
                        (chanmodes 2-4).  Do this call before a save
                        command or before multiple getfield commands.
                        Syntax: call hsolve HSAVE

Messages:       None.   

Example:

        // Do all the preparatory grunge work
        .
        .
        // create the cell as an hsolve element
        readcell test.p /test -hsolve

        // set the chanmode, comptmode and calcmode (if other than defaults)
        setfield /test chanmode 2

        // set up the arrays and tables for the solver
        call /test/solve SETUP
        // use the Crank-Nicholson method for the hsolve element
        setmethod 11
        // It is essential to call reset (or reschedule) after setting
        // up an hsolver, so that the process list gets updated.
        reset

------------------------------------------------------------------------------

Notes:

The hsolve element completely takes over the calculations for compartment
elements and certain other elements specified as part of the cell. Each
hsolve element should only solve one cell. The timestep for the integration
is determined by the clock assigned to the hsolve element, and the clocks
for these elements which are taken over are ignored.

When using the Hines solver with a neuron, it is best to think of the entire
neuron as a single object since the individual compartments within the cell
are no longer responsible for their own computations.  This loss of object
orientedness is mitigated to some degree by the ability of the solver to
transparently interact with elements utilizing other integration schemes.

There are 2 basic modes for hsolve operation: without chip-array (chanmode 0
or 1), or with chip-array (chanmodes 2-4).  Without chip-array is the most
compatible mode, but is the slowest.  With the chip-array, hsolve is much
faster because the original elements are no longer used, instead all
simulation parameters are stored in a huge array (this improves memory access
times).  Unfortunately you can no longer expect that it will update the fields
in computed objects (like Vm in a compartment or Ca in Ca_concen) so that
graphic or file output might not work.  Vice versa, if you change a field
(like inject in compartment) it might not affect the simulation.  However,
there are methods available to get values in and out of the chip-array, which
involve special settings and/or the use of the HPUT, HGET, HSAVE and HRESTORE
actions listed above.  This is ilustrated in another example below.  The
documentation for findsolvefield describes another method, introduced in
GENESIS 2.1, that also allows access to these values.

The example above illustrates the process of setting up the hsolve element.
First, one should create the cell as an hsolve element at the root of the cell
element tree.  This may be done in one step by using the "-hsolve" option with
readcell.  If readcell is not used, then the hsolved cell should be created
with statements like

    create hsolve /test
    create compartment /test/soma
    create tabchannel /test/soma/Na_channel
    ...

Next, set any fields of the hsolve which are needed to specify non-default
values of chanmode, comptmode, calcmode, storemode, etc.  Then, one needs to
call the SETUP action in order to tell the hsolve element to create all the
solution arrays and tables.  Finally, chose either method 10 (backwards Euler)
or 11 (Crank-Nicholson) as the method to be used.  All elements which lie
outside this tree will continue to be treated by the previous explicit method
(typically exponential Euler).  The Scripts/examples/hines directory contains
an example script which demonstrates both chanmodes 0 and 2.

Although it is not presently necessary to create the hsolve element as the
root of the element tree, future versions of hsolve may require this.  The
older method of creating the hsolve is to create the cell as a neutral
element, create the hsolve element as a child element, and then set the hsolve
path field to indicate which elements will be taken over.  Typically, a
wildcard path is used to refer to all compartment elements in the simulation.
This includes all hsolvable sublelements of these compartments.  For example,

        // readcell will place the compartments below the neutral '/test'
        readcell test.p /test

        // create the hines solver element below the cell '/test'
        create hsolve /test/solve

        // Specify the path for the solver
        set /test/solve path /test/##[][TYPE=compartment]


RESTRICTIONS

It is important to be aware of some of the restrictions imposed by the use
of hsolve:

Only the objects compartment, tabchannel, tab2Dchannel, tabcurrent, spikegen,
Ca_concen, nernst, Mg_block, ghk, taupump, mmpump, difshell, fixbuffer,
difbuffer, dif2buffer, synchan, and the oldconn library channels channelC2 and
channelC3 are handled by hsolve.  If your simulation uses these listed
objects, hsolve will increase speed significantly.  In principle, unlisted
objects will also be computed correctly (though slower, as they are integrated
by the 'older' explicit methods).  Note that symcompartment objects are NOT
handled by hsolve.  This means that there is little advantage in using hsolve
for dendritic trees composed of symmetric compartments.

An important restriction introduced in GENESIS version 2.1 is that, for
chanmodes 2-4, the element tree of your cell (or other element tree to be
taken over by hsolve) must not contain any non-hsolvable elements other than
neutral elements.  For existing simulations which violate this restriction, it
will be easiest to switch to chanmode 0 or 1.

It is not guaranteed that messages from unlisted objects to listed objects
will work, though solve should alert you about any such incompatibilities.
Most incoming messages will work if you use chanmodes 2-4.  Messages from
listed to unlisted objects will only work for certain chanmode settings.

hsolve does not keep track of changes made to the model after the hsolve SETUP
command (particularly the following commands: create, copy, delete, addmsg,
deletemsg).  In chanmode 0 or 1 this only affects the listed objects and
messages between them, in chanmodes 2-4 this affects the listed objects and
ALL messages going in or out from them.  The hsolver should be used in these
modes only for finished models (you can use it for parameter searches); do not
use it if you are still constructing and testing a model.

hsolve may miscalculate if you change clocks used by tabchannels,
tab2Dchannels, synchans, or channelC2/C3 objects without doing a reset (only
in chanmodes 2-4).

The Hines solver utilizes a considerable amount of memory.  Memory use
increases as the result of comptmode + chanmode - no_elminfo flags.  In
particular, going from chanmode 0 or 1 to chanmode 2, 3, or 4 causes a big
jump in memory usage.  Approximately 100 bytes are required per compartment if
the speed-optimized version of the hsolve element is used. Most of this
storage is for tables describing the sequence of calculations. These tables
can, however, be shared between cells which are identical in topology and
differ only in parameter values.

FURTHER EXAMPLES

* Copying cells with the hsolve element

When a cell using the hsolve element is copied, the pointers in the
duplicated hsolve element are unchanged. In other words, they refer back to
the original cell. One could simply change the path to refer to the current
cell and call SETUP again, but that would unnecessarily duplicate a lot of
tables.  The efficient option would be to use the original tables where they
are identical, and construct new ones where they refer to the current cell.
This is done using the DUPLICATE command.  Continuing with the previous
example,

        // Copy the original cell to /test2
        copy /test /test2

        // Duplicate the hsolver. The DUPLICATE action
        // takes the new path as an argument
        call /test2/solve DUPLICATE /test2/##[][TYPE=compartment]

There are several commands, including createmap and cellsheet, which copy
cells. The DUPLICATE command should be issued for the hsolvers on each copy.

* Deleting hsolve elements

When an hsolve element is set up it removes the relevant channels and
compartments from the list of elements to be processed, by setting a bit
(0x100) on the flag field of those elements. These elements are re-enabled
and the bit set back to 0 when the hsolve element is deleted.

WARNING: in the present implementation, the hsolve element does not check
whether it has had duplicates made using the DUPLICATE command. This makes it
possible to delete the tables for all of the copies by deleting any one of
them, resulting in segmentation violations and similar amusements. In other
words, do not delete hsolves on duplicated cells.

* Accessing data fields in chanmodes 2-4.

A script similar to this example might be used for running a long simulation
as a background job, using no graphics.  The HPUT and HSAVE actions are used
in chanmode 2 or 3 to allow the simulation results and the final state of
the simulation to be saved to disk.  A disk_out element is used to output the
Vm of a soma compartment in a compressed binary format.  However, it is
equally possible to output Vm from every compartment, or from an array of
cells.  Later, a script using a disk_in element can display the results using
messages from the disk_in to an xgraph or xview.  The save command is used
here to save field values of all elements except nernst elements and the
hsolve element.  This will allow the simulation to be resumed from its final
state by using the restore command.

For more details, see Scripts/examples/XODUS/fileview and the documentation
for disk_out, disk_in, save, and restore.

        /* load scripts and global variables */
        include defaults
        include other_stuff

        pushe /library
        make_my_stuff
        pope

        /* make the model */
        readcell my_cell {my_cellpath} -hsolve

        /* set the clocks */
        setclock 0 1e-5   /* integration */
        setclock 1 1e-4   /* output */

        /* create the output or graphics elements */

        /* note that if you want to output Vm only, but from multiple
        ** compartments, you should use chanmode == 2; if you want to
        **  output other fields or Vm from only one compartment, 
        ** use chanmode == 3 */

        create disk_out /output/disk
        useclock /output/disk 1
        addmsg {my_cellpath}/soma /output/disk Vm
        addmsg ...

        /* create any other elements */
        ....

        /* setup the hines solver */
        setfield {my_cellpath} \
                comptmode   1 \
                chanmode    3 \
                outclock    1
        call {my_cellpath} SETUP
        setmethod 11              // Crank-Nicholson integration method

        /* initialize output */
        setfield /output/plot_out filename {filename} initialize 1
        setfield /output/plot_out filename {filename} append 1 leave_open 1

        reset

        step 0.10 -t
        /* do a current injection */
        setfield {my_cellpath}/soma inject 1.0e-9         /* in Amps */
        /* update chip array */
        call {my_cellpath} HPUT {my_cellpath}/soma 
        step 2.00 -t

        /* save the integration values to disk */
        call {my_cellpath} HSAVE
        save {my_cellpath}/##[][TYPE!=nernst][TYPE!=hsolve] {savename} 

        quit

---------------------------------------------------------------------------
DETAILED DESCRIPTION

The Hines library provides elements and functions for the efficient implicit
solution of the systems of differential equations arising in single-neuron
models. The sparse matrix arising from the the branched structure of neurons
is ordered by the method described by Michael Hines, which permits it to be
solved in order N operations using Gaussian elimination without pivoting.
The nonlinear equations resulting from the Hodgkin-Huxley description of ion
channels are treated as conditionally linear, and also solved in an
efficient, second-order manner.  Compatibility with other integration
schemes is maintained so that mixed integration schemes are feasible.

The element sets up a data structure whereby the only change needed for
other identical cells is to reassign pointers to the compartment and channel
elements.  This avoids having to reallocate and rederive the solving
scheme.  Solutions are done using gaussian forward and backward elimination
without pivoting. The numbering and evaluation sequence ensures that no new
off-diagonal terms are formed which might mess up the sparse matrix
representation.  The sparse matrix is represented by a single 'values' array
indexed using the ri and cip arrays.  The actual solution system is stored
as a linear sequence of operations on the 'values' array, in an attempt to
speed things up a bit.

The implicit method leads to numerically stable solutions for all time
steps.  Numerical accuracy, however, imposes limits on the integration time
step which must be empirically evaluated for each simulation.  Typical
values are 100 microsecond time steps for purely passive membranes and 20
microsecond time steps for membranes with active channels.  This confers a
considerable speed up in detailed neuronal simulations where the presence of
electrotonically small compartments (such as dendritic spines) leads to
systems of equations which are numerically very stiff. In order to obtain
similar accuracy using explicit integration methods, time steps in the
nanosecond range may be required.

In addition to the substantial speed advantage gained from the use of an
implicit solution, the coding of the Hines solver element has been done with
a view to computational efficiency.  This results in a speed up of around 50%
compared to the same model with the same time step, using the conventional
explicit Euler integration scheme.

Code changes needed for the Hines library

This section is probably of interest only to individuals who have developed
their own code libraries and who are deeply entangled in GENESIS coding
issues. For most users the changes are transparent, once the .simrc and
schedule.g file have been updated to reflect the addition of a new library.

The incorporation of a completely new integration scheme to the simulator can
be expected to have numerous repercussions. Fortunately, the changes needed for
the Hines library turned out to be relatively painless. No changes were needed
for the code of any of the existing elements. There is a slight rearrangement
of the order of fields in the various channel objects, and a new globally
#define'd type called CHAN_TYPE has been created so that all these channel
objects have the following common fields at identical memory offsets: Ik, Gk
and Ek (See src/sim/struct_defs.h). All channels whose structures obey this
convention can be used in cells utilizing the hsolve element.  A very small
number of channel objects (such as channelC) do not share these fields and
therefore cannot be part of cell models which use the hines solver.

A new flag (0x100) has been employed for the Hines solver, which causes the
removal of compartment and tabchannel elements from the action list (the list
of elements whose action functions are to be called according to the clocks).
This flag is similar to the disable option except that it leaves the children
of these elements intact.

In the interests of speed (which is, after all, what the Hines method is all
about) I have 'unrolled' the sparse matrix solution into a single giant
function array. This is done at setup time, so the actual solution does not
involve any conditionals and minimises array lookups. This is moderately
expensive in terms of memory. The size of the function array allocated is

     S = FA * sizeof (int) ;  FA = 10 + 1.5 * M^2 / N

where S is the size of the array, FA is the number of functions allocated, M
is the number of non-zero coefficients in the solution matrix and N is the
number of compartments. M depends strongly on the branching pattern of the
cell. FA is an approximation to, and is greater than F, which is the actual
number of locations needed in the function table.  For example, in a mitral
cell model, which has limited branching:

     N = 286 ; M = 856 ; FA = 3853 ; S = 15412 ; F = 3710

In a granule cell model with numerous dendritic spines:

     N = 944 ; M = 2830 ; FA = 12736 ; S = 50944 ; F = 12264

A reasonable approximation is that each compartment requires about 54 bytes in
the function table, which is not too bad.

References:     Hines, M. (1984) Efficient computation of branched nerve
                equations.  Int. J. Bio-Med. Comp.  15: 69-76

                Mascagni, M.V. (1989) Methods in Neuronal Modeling Ed: Koch
                and Segev. Chapter 13. 439-484
See also: setmethod , findsolvefield

25.20 leakage

Object Type:    leakage

Description:    Providess a constant conductance in series with a battery.
                This is often used to implement a passive "leakage" channel
                having a fixed conductance.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  leakage_type  [in src/segment/seg_struct.h]

Size:           96 bytes

Fields:         Gk              the Gk to be sent in a CHANNEL message
                Ek              the leakage battery
                activation      the leakage conductance used to calculate Ik
                Ik              channel current
                inject          not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       Leakage  [in src/segment/leakage.c]

Classes:        segment
                channel

Actions:        PROCESS         Calculates Ik
                RESET           Sets Ik = 0
                CHECK           Checks to see if an incoming VOLTAGE
                                message has been established.

Messages:       VOLTAGE Vm

------------------------------------------------------------------------------

Notes:          This object is intended to be used as a flexible leakage
                term in conjunction with the membrane model.  As with any
                other type of channel, it normally is used to send its
                conductance (Gk) and reversal potential (the battery in series
                with Gk) to the parent compartment using a CHANNEL message.
                In this case, Gk has a constant value, to be set by the user.
                
                Although this feature is not often used, a leakage element
                also calculates the current, Ik = (Ek - Vm)*activation.  Here,
                Vm is the compartment membrane potential received with a
                VOLTAGE message, and "activation" is a conductance.  This
                would normally be set by the user to the same value as Gk, but
                this is not done automatically.  As Gk does not depend on Vm,
                a VOLTAGE message is not strictly required if Ik not is
                needed.  However, the check command will issue a warning if
                one has not been established.
Example:        
                create leakage K_leak
                setfield K_leak Ek {EK} Gk {Gleak}
                addmsg K_leak   ..     CHANNEL Gk Ek
                addmsg ..       K_leak VOLTAGE Vm

See also:       

25.21 metadata

Object Type:    metadata

Description:

File formats such as netcdf allow the inclusion of descriptive content in
addition to actual data. This is extremely useful from the perspective of 
having important documentation, such as time of creation, author, purpose 
or critical information about individual variables or the file as a whole, 
alongside the actual data in the same file. 
The genesis metadata object allows the user to manipulate this descriptive 
data that is in an existing file or write new metadata content into it. As
already mentioned, descriptive data can describe individual variables in 
the file (local metadata) or the file as a whole (global metadata). This 
distinction is replicated well, through the hierarchical element structure
in genesis. So a metadata object will be identified as a local attribute if
the immediate parent is a 'variable' object and global if the 'diskio' object
is the immediate parent.

Author:         V.Jagadish (9/96)

------------------------------------------------------------------------------

ELEMENT PARAMETERS:

DataStructure:  Gen_Metadata_Type [in src/diskio/diskio_struct.h]

Size:           92 bytes

Fields:         datatype        The type of the value(s) held in the metadata   
                                - The list of valid types are given in the 
                                  notes section of this document.
                                - Defaults to 'char8' (8-bit char)

                size            The maximum number of descriptive values the 
                                object can hold.
                                - Like variables, metadata objects can hold 
                                  an array of descriptive values the size of 
                                  which is limited by the value of this field.
                                - If the datatype is 'char8' (default) the 
                                  user could provide a string as an argument 
                                  to the value field without 
                                  specifying a size or index, and the size 
                                  (which is the number of chars in the string 
                                   including the '/0' character) is 
                                  internally calculated and set in this field. 
                                - The default value is 1.
                
                value           The value(s) held by the metadata. 
                                - Since metadata can hold an array of values or 
                                  a single one, an index (with the genesis style 
                                  indexing syntax) needs to be specified while 
                                  setting or showing this field. The index 
                                  defaults to 0 if not specified, the exception 
                                  to it being the case that the datatype is 
                                  'char8'. 
                                - Not specifying the index for a 'char8' type
                                  metadata will translate to mean the entire 
                                  string and individual indices will mean the 
                                  character in that position.
                                - As in the case of the variable object, 
                                  multiple argument values can be specified for
                                  this field (see examples) and the values will
                                  be accessed starting with index 0.
                                - The default value is 0 for numerical datatypes 
                                  and ''(blank) for character types  

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       Gen_Metadata [in src/diskio/gen_metadata.c]

Classes:        output

Actions:        CREATE PROCESS RESET SET SHOW ADDMSGIN

                FLUSH:
                UPDATE: the object commits the underlying metadata values 
                        to the file on disk.

                DELETE: commits any changes to disk if necessary and then       
                        deletes the object but does not remove the 
                        underlying attribute on file.

------------------------------------------------------------------------------

Notes:

The default metadata is an 8-bit single blank character (char8) 
The datatype field stores the type of the variable as a string. The types
are chosen to be as generic as possible. They are not based on the usual
'C' data types but rather on the user's perspective.
Table 1.2 shows the valid datatype names and what they mean to the user.
Please note that not all these types are supported by all file formats. 
An error to that effect will be printed if a metadata obeject of an 
unsupported type is attempted to be created. 


As opposed to variables, the size and datatype fields of metadata objects 
can be reset within netcdf. 

A smaller size setting than the original truncates values and a larger size
does not disturb the old values but adds the appropriate number of default 
values (0 or ''). 

Changing the datatype for a metadata object defaults all the values 
(as specified by the size field) to the new type. The old values will be lost.

Table 1.2 - Valid datatypes 

Name                            Description
____            |               ___________
                |
                |
uint8           |               8-bit unsigned int
                |
int8            |               8-bit signed int
                |
uint16          |               16-bit unsigned int
                |
int16           |               16-bit signed int
                |
uint32          |               32-bit unsigned int
                |
int32           |               32-bit signed int
                |
uint64          |               64-bit unsigned int
                |
int64           |               64-bit signed int
                |
float32         |               32-bit float
                |
float64         |               64-bit float
                |
uchar8          |               8-bit unsigned char
                |
char8           |               8-bit signed char
                |
char16          |               16-bit (unicode) char
                |
string          |               string type (i.e not an array of chars)
                |
________________+______________________________________________________


Examples:

create diskio /dout -filename "testfile.nc" -accessmode w

create metadata /dout/author -value "Venkat Jagadish"

showfield /dout/author value // This will print out the entire string
showfield /dout/author value[2] // This will print the 3rd char - 'n'

create variable /dout/Vmtrace -datatype float32 
create metadata /dout/Vmtrace/starttimes -datatype float32 -size 3  \
-value "5 45 65"
create metadata /dout/Vmtrace/stoptimes -datatype float32 -size 3 \
-value "20 60 80"
setfield /dout/Vmtrace/starttimes value[1] 55
setfield /dout/Vmtrace/stoptimes value[1] 70


setfield /dout/Vmtrace/starttimes datatype float64 
showfield /dout/Vmtrace/starttimes value[1] // Setting datatype resets
                                            // values to default - 0 
                                            // (in this case)

_______________________________________________________________________
See also: diskio , variable

25.22 nernst

Object Type:    nernst

Description:    Calculates the Nernst potential for the given
                ionic concentrations and temperature.

Author:         M. Wilson, Caltech (3/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  nernst_type  [in src/device/dev_struct.h]

Size:           96 bytes

Fields:         E               equilibrium (Nernst) potential
                T               temperature in degrees Celsius
                valency         ionic valency z
                scale           voltage scale factor
                Cin             internal ionic concentration
                Cout            external ionic concentration
                constant        scale*(R/zF)*(T + 273.15)
                                This is set by the element,
                                and should not be set by the user.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       Nernst  [in src/device/nernst.c]

Classes:        device
                channel

Actions:        PROCESS         sets the fields from incoming messages
                                and calculates constant and E.
                RESET           similar to a single PROCESS step.
                CHECK           checks for valid messages and parameters.

Messages:       CIN Cin         sets the Cin field.
                COUT Cout       sets the Cout field.
                TEMP T          sets the T field, and calculates constant.

------------------------------------------------------------------------------

Notes:          A nernst element calculates E = constant * ln(Cout/Cin)
                = scale*(R/zF)*(T + 273.15)*ln(Cout/Cin), where R is the
                universal gas constant (1.9872 cal/mol deg) and F is Faraday's
                constant (23061 cal/volt mol).  Note that the temperature in
                degrees Celsius is internally converted to degrees Kelvin.  A
                scale factor of 1 gives E in volts, and a scale factor of
                1e3 gives E in millivolts.

                A nernst element is usually used with a channel and a
                Ca_concen element to calculate the channel equilibrium
                potential (Ek) from the internal ionic concentration in a
                shell near the compartment surface.  The equilibrium potential
                is sent from the nernst element to the channel with an EK
                message, and the nernst element receives the concentration
                from the Ca_concen element with a Cin message.  The Ca_concen
                element calculates this concentration from ionic currents
                delivered with an I_k message.

                It is also possible to perform a "one-time" calculation of E
                with fixed values of the ionic concentrations by setting these
                fields instead of setting up messages, and performing a reset.
                If this is done, the nernst element should be disabled to
                avoid wasting time performing the PROCESS action.

Example:        
        // assume that a  tabchannel `Ca' has been set up
        create Ca_concen conc
        setfield  conc                          \
            B       {5.2e-6/(area*shell_thick)} \
            Ca_base 4.0e-5                      \
            tau     1e-4                        \
            thick   {shell_thick}

        create nernst nernst
        setfield nernst \ 
            Cout    4.0 \   // external Ca concentration of 4 mM.
            T       21  \   // near room temperature
            valency 2   \   // Ca++
            scale   1       // E in volts

        addmsg Ca       conc        I_Ca    Ik
        addmsg conc     nernst      Cin     Ca
        addmsg nernst   Ca          EK      E
See also: Ca_concen

25.23 neutral

Object Type:    neutral

Description:    empty object used for grouping

Author:         Caltech

ELEMENT PARAMETERS

DataStructure:  element_type  [in src/sim/sim_struct.h]

Size:           68 bytes

Fields:         [none]

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       NULL [i.e., none]

Classes:        element

Actions:        [none]

Messages:       [none]

------------------------------------------------------------------------------

Notes:          A set of default element types is distributed with GENESIS.
                One of the simplest is the "neutral" object which can be
                used to create an empty element used for grouping, much like
                a directory in the UNIX file system.  It is often used to
                represent a cell, containing subelements for compartments,
                channels, etc.  Although it has no other fields, it has the
                usual setable [x,y,z] coordinate fields possesed by other
                objects.  This allows it to be given a position in a network.

                The addfield, addaction, and addmsgdef commands can be used
                to give a neutral element new fields, actions, and messages,
                allowing it to be used as customizable element, or the basis
                of an extended object

Example:        

See also:       

25.24 playback

Object Type:    playback

Description:    update a pre-filled buffer

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  playback_type  [in src/buffer/buf_struct.h]

Size:           100 bytes

Fields: 
                tmin
                size
                current
                start
                end
                event_size
                event
                state

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       PlaybackBuffer  [in src/buffer/playback.c]

Classes:        buffer

Actions:        PROCESS
                RESET
                COPY BufferCopy
                CREATE BufferCreate

Messages:       none

------------------------------------------------------------------------------

Notes:          The putevent command may be used to fill the buffer

Example:        

    create playback /test
    putevent /test 10 10.0 20 0.0 30 30.0 40 0.0 50 50.0 60 0.0
    create xform /testform
    create xgraph /testform/graph
    addmsg /test /testform/graph PLOT state *playback *blue
    xshow /testform
    reset
    step 100
See also: putevent

25.25 pool

Object Type:    pool

Description:    Pool of molecules involved in chemical reactions and
                transport between cellular compartments. Keeps track of the
                number of molecules resulting from forward and backward
                reactions. Uses mean-rate theory which assumes large numbers
                of molecules, not probabilities of transitions of individual
                molecules.

                Does Michaelis-Menten enzyme kinetics when hooked to the 'enz'
                object, and standard kinetic reactions with the 'reac' object.
                The MM scheme is modeled as:
                                        k1              k3
                Substrate + Enzyme  <-----> EnzComplex ----> Enz + Prd
                                        k2
                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

                Note that vol, n and Co are interdependent. vol is never
                changed except by the user or by messages. n changes if Co is
                changed.  Co changes if either vol or n is changed.  Volume is
                typically scaled by the Avogadro number, so that Co is in
                convenient units such as micromolar. 
                
                During integration, all calculations are done in terms of
                n, and, where needed, vol. Co is calculated as n / vol on
                each timestep.
                
Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1993).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  pool_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         Co                      Concentration of molecule. Calculated
                                        from 'n' as n/vol.
                CoInit                  Initial concentration of molecule.
                                        Co gets set to this value on RESET.
                CoTotal                 Total concentration of molecule. Used
                                        when applying conservation rules.
                CoRemaining             CoTotal - Co.
                n                       Number of molecules. This is the 
                                        value used for all calcultions.
                nInit                   Initial number of molecules.
                                        'n 'gets set to this value on RESET.
                nTotal                  Total number of molecules. Used
                                        when applying conservation rules.
                nRemaining              nTotal - n
                nMin                    Minimum allowed number of molecules.
                                        Normally zero.
                vol                     Volume occupied by pool. Often involves
                                        extra units so as to have direct
                                        conversion from 'n' to some sensible
                                        units of Co, such as micromolar.
                slave_enable            Flag used to control buffering and
                                        other overrides. Values:
                                        1 - Obey slave message, representing n
                                        2 - Obey slave message, representing Co
                                        4 - Buffering on: n is set to nInit,
                                                Co to CoInit, every timestep.
                                        See below for details.
                keepconc                Flag determining whether to change
                                        concs or n when volume changes
                consv_flag              Internal flag keeping track of presence
                                        of CONSERVE and SUMTOTAL msgs

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       PoolFunc  [in src/kinetics/pool.c]

Classes:        segment, concentration

Actions:        CREATE
                PROCESS
                RESET
                SET

Messages:       REAC            A B     [A is increment to n,
                                        B is decrement to n,
                                        where n is number of molecules in pool.
                                        This message is used for hooking up
                                        all reactions and enzymes.]
                MM_PRD          A       [increment n by A. This message is
                                        used for the product of enzymes.
                                        We assume it is irreversible, so there
                                        is no B term]
                SLAVE           number  [Sets n or Co to this command number 
                                        depending on the slave_enable status,
                                        described below. This message is 
                                        used to make concentrations in the pool
                                        follow an external signal.]
                REMAINING       n       [decrement to nRemaining]
                CONSERVE        n nInit [This message is used for setting up
                                        conservation relationships.
                                        n from all derived molecules is summed
                                        to do the conservation. nInit is used
                                        during RESET to calculate the total
                                        number of molecules. See notes.]
                VOL             vol     [volume of pool]
                SUMTOTAL        n nInit [This message is used to make a pool
                                        whose n is the sum of that of several
                                        other pools. nInit is used at
                                        RESET to get the initial levels]


------------------------------------------------------------------------------

Notes:

        The pool has numerous extras used in practical simulations.
        Most of these are readily accessed from within kinetikit, which is
        the recommended way of developing kinetic simulations. For
        completeness, here is a list of features of the pool:

        1. Buffering. When slave_enable is set to 4, then all the pool
        does is assign n to nInit and Co to CoInit every timestep.

        2. Following an external signal. This works when the SLAVE
        message is passing in the external number. if slave_enable is
        1 then the external number represents n. If it is 2 the
        external number represents Co.

        3. Conservation relationships. In some cases it helps stability
        and accuracy to apply explicit conservation relationships,
        rather than rely on the implicit ones that arise from the
        numerical integrations. Warning: in some cases explicit
        conservation relationships actually worsen stability ! So
        try it for each case before relying on it. Conservation
        relationships are set up in two phases:
        - identify the pool whose value you want to be calculated
        from conservation.
        - Send CONSERVE messages from all pools to which this molecule
        gets converted. Be sure you have found ALL the pools: this is
        a very common source of error. For example, you may need to
        send a CONSERVE message from enzyme intermediates, which
        are represented by 'enz' objects.

        4. Summation. In some cases the final amount of an active
        species recieves contributions from several independent pathways.
        An example is an enzyme whose active site always has the same 
        activity regardless of the means of activation. The total amount
        of the active enzyme could then be represented as the sum of
        the active forms from several independent activation pathways.
        The SUMTOTAL message is used for such cases.

        5. Calculating the amount of the molecule that has reacted, and is
        no longer in this pool.
        The nRemaining field plus the REMAINING message are used for this.
        Again, the REMAINING message must come in from all other molecules
        into which this pool may convert. This is mainly useful for checking
        accuracy and stability.


        The combination of pools, reacs, and tables is capable in principle of 
        implementing very complicated ODEs, not restricted to
        chemical reactions. The pools represent the variables, reacs represent
        processes increasing and decreasing variables, and the tables can
        twiddle the rate constants of the reacs according to arbitrary
        complicated functions. It should be stressed that this is an
        extremely inefficient but reasonably general way of doing this.

Example:
                                
Message setup between pools, reacs and enzymes:
        
        For the reaction 

                  kf
        2X + Y <======> Z
                  kb
        
        we would have 3 pools, and 1 reac. The messaging would be as follows:
        
                addmsg  X       reac    SUBSTRATE       n
                addmsg  X       reac    SUBSTRATE       n
                addmsg  reac    X       REAC            A B
                addmsg  reac    X       REAC            A B

                addmsg  Y       reac    SUBSTRATE n
                addmsg  reac    Y       REAC            A B
        
                addmsg  Z       reac    SUBSTRATE       n
                addmsg  reac    Z       REAC            B A

        Some points about this messaging scheme:
        1. We need N sets of SUBSTRATE and REAC messages between a pool and
        a reac, where the order of the reaction for that pool is N.
        2. The Z pool, which is the product, has the A and B state variables
        reversed in the message. This is because any decrease in X or Y is an
        _increase_ in Z.
        

        Setting up the enzymatic reaction:

                Sub + X --> Prd

        We normally put the enzyme site enz as a child of the pool which
        represents the enzyme.

                create enz X/enz
        
        A given pool can have any number of enzyme
        'sites'. This is required when an enzyme has different levels
        of activity for different substrates, as each of the enzyme 'sites'
        can then be given different rates. The messaging would look like this:

                addmsg  X       X/enz   ENZYME          n
                addmsg  X/enz   X       REAC            eA B

                addmsg  sub     X/enz   SUBSTRATE       n
                addmsg  X/enz   sub     REAC            sA B

                addmsg  X/enz   prd     MM_PRD          pA

        Some points about this messaging scheme:
        1. In the irreversible Michaelis-Menten model we are using, the
        enzyme cannot reduce the level of the product. So there is only one
        term required in the outgoing message, and no incoming message from 
        the product to the enzyem
        2. If this scheme doesn't suit you, you can always build better
        enzyme models using combinations of reacs and intermediate pools.
See also: enz , reac

25.26 pulsegen

Object Type:    pulsegen

Description:    General purpose pulse generator

Author:         M. Nelson, Caltech (4/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  pulsegen_type  [in src/user/user_struct.h]

Size:           120 bytes

Fields:         level1          level of pulse1
                width1          width of pulse1
                delay1          delay of pulse1
                                  (wrt ext. input - trig or gate mode)
                                  (wrt pulse2     - free run mode)
                level2          level of pulse2
                width2          width of pulse2
                delay2          delay of pulse2 (wrt pulse1)
                baselevel       baseline level
                trig_mode       flag: 0=free run, 1=ext. trig, 2=ext. gate
                output          output
                trig_time       internal state variable
                previous_input  internal state variable

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       PulseGen  [in src/user/pulsegen.c]

Classes:        device

Actions:        PROCESS  RESET

Messages:       INPUT "gate/trig"   (0 = low, non-0 = high)
                LEVEL pulse# level
                WIDTH pulse# width
                DELAY pulse# delay

------------------------------------------------------------------------------

Notes:

This device can generate a variety of pulse patterns:  single pulses, double
pulses (each with its own level and width), and pulse trains (of single
pulses or pairs).  It can be triggered, gated, or allowed to free run.

In combination with a spikegen object, it can be used to generate bursts of
spikes for use as synaptic input.  (See Scripts/neuron/inputs.g.)

The following diagram illustrates the relationships between the fields:

                      +-----------------+ level1
  trigger             |                 |
     |                |                 |        +-------------+ level2
     |                |                 |        |             |
     V                |                 |        |             |
     +--- baselevel --+                 +--------+             +----

     <---- delay1 ----><---- width1 ---->         <-- width2 -->
                       <--------- delay2 -------->
If delay2 <= width1, then level2 starts imediately after the end of the
pulse at level1.  This means that if delay2, width2 and level2 are not set
and remain at their default values of 0, there will be only one type of
pulse.  It will repeat after a time delay1 after the end of the pulse
(free run mode) or a time delay1 after it is triggered (trigger or gate
mode).

Example:        Scripts/examples/pulsegen/PulseGenDemo.g

See also:       

25.27 randomspike

Object Type:    randomspike

Description:    place a random event into the buffer

Author:         M. Wilson, Caltech 6/88, Dave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Randomspike_type  [src/newconn/newconn_struct.h]

Size:           100 bytes

Fields:         min_amp         minimum amplitude of event
                max_amp         maximum amplitude of event
                rate            rate of generation of events
                reset           flag for whether to reset after each event
                reset_value     what to reset state to
                state           current state of object
                abs_refract     minimum time between events

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       RandomEvent  [in src/newconn/randomspike.c]

Classes:        buffer

Actions:        INIT
                RESET
                PROCESS

Messages:       RATE    rate
                MINMAX  min max

------------------------------------------------------------------------------

Notes:          Generates a time series of events at a rate given by the rate
                parameter. The probability of an event for a single time step
                is given by rate*dt where dt is the clock rate of the
                element.  However, no event will be generated at a time less
                than abs_refract.  When an event has been generated, the
                amplitude of the event is a random variable uniformly
                distributed between min_amp and max_amp.  The state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not normally set by user
                norm            internal variable, not normally set by user

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor2  [in src/olf/receptor2.c]

Classes:        segment
                channel

Actions:        INIT
                PROCESS
                RESET
                RECALC
                SET
                CHECK
                SAVE2
                RESTORE2

Messages:       VOLTAGE Vm              usual message from parent compartment
                                        to channel to tell what the membrane
                                        potential is

                ODOR activation odor_no describes odor; activation = strength
                                        of particular odor; odor_no = integer
                                        specifying response table index having
                                        weight for that odor

                MODULATION modulation   sets modulation field; provides means
                                        for scaling the overall sensitivity of
                                        receptor up or down

------------------------------------------------------------------------------

Notes:          Does a weighted sum of odors to get activation
                of a channel with usual conductance properties.

                The receptor2 element is a much more realistic version of an
                olfactory receptor protein-membrane channel complex than the
                receptor element. The receptor2 is a channel similar to the
                synchan element, except that this channel responds to odors
                via ODOR messages, and does not have synapses with weights and
                delays.

                Any number of odor messages may be sent to the receptor2.
                They are scaled by the weights in the response table, and then
                their summed effects act as the activation of the channel. The
                channel has the usual time courses and conductance fields, and
                can be incorporated into membrane compartments just like
                ordinary synaptic channels.

Example:        Scripts/neurokit/prototypes/newbulbchan.g
See also: receptor

25.31 script_out

Object Type:    script_out

Description:    executes a script command at each step of a simulation

Author:         M. Wilson, Caltech (2/89)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  script_output_type  [in src/out/out_struct.h]

Size:           80 bytes

Fields:         command     Command string (function name + optional args)
                argc        Number of arguments, including function name
                argv        array of arguments (argv[0] = function name)

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ScriptOutput  [in src/out/out_script.c]

Classes:        output

Actions:        PROCESS
                SET
                RESET
                RECALC

Messages:       none

------------------------------------------------------------------------------

Notes:

The command field of a script_out element is used to hold the name of a script
language function which will be executed at every step of the clock used by
the script_out.  This will normally by clock 0, the default simulation clock.
As the definition of this script function will be interpreted by the SLI,
execution will be much slower than with the compiled PROCESS action of other
predefined GENESIS objects.  For that reason it is best to assign a slower
clock to the script_out element.

If the command field is set to a string consisting of the function name
plus one or more optional arguments, then argv[{n}] will contain the
nth argument.  Extended objects provide a much more flexible alternative
to the script_out object.

Example:

// spikebeep.g - illustrate the use of the script_out element to beep
// whenever a spike is produced  (assuming your terminal window
// beeps when a ctrl-G is echoed).
// Include this file at the end of Scripts/tutorials/tutorial4.g

// The script_out element checks for a spike at every simulation step
create script_out /catchspike
setfield /catchspike command "checkspike"
useclock /catchspike 0

function checkspike
        if ({getfield /cell/soma/spike state} != 0)
               echo {chr 7} -nonewline
        end
end
reset
See also: Extended , Scripts/orient_tut/ret_input.g

25.32 sigmoid

Object Type:    sigmoid

Description:    

Computes the sigmoidal tranformation of the input and places the result in
'state'.  The equation being applied is

        state = amplitude*(tanh(gain*(input - thresh)) + 1)/2.0;

This gives a ``squashing'' function which is commonly used in connectionist
models as an approximation to the relation between the amount of synaptic
input to a cell and its firing rate.

Author:         M. Wilson, Caltech (6/88)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

Data Structure: sigmoid_type  [in src/buffer/buf_struct.h]

Size:           116 bytes

Fields:         thresh
                amplitude
                input
                state
                gain

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SigmoidEvent  [in src/buffer/sigmoid.c]

Classes:        buffer
                segment

Actions:        PROCESS RESET COPY CREATE

Messages:       INPUT   input
                THRESH  threshold
                GAIN    gain 
                AMP     amplitude 

------------------------------------------------------------------------------

Notes:          

Example:        Scripts/examples/sigmoid.

See also:       

25.33 spikegen

Object Type:    spikegen

Description:    Performs threshold spike discrimination.
                Generates an impulse each time an input crosses the
                spike threshold at a maximal rate set by abs_refract.

Author:         M. Wilson, Caltech 6/88, ave Bilitch 1/94

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  Spikegen_type  [in src/newconn/newconn_struct.h]

Size:           88 bytes

Fields: 
                state           current spiking state
                thresh          threshold level for spike generation
                abs_refract     minimum interval between spikes
                output_amp      spike event amplitude

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       SpikeEvent  [in src/newconn/spikegen.c]

Class:          spiking

Actions:        RESET                   clear the history buffer, removing
                                        any existing events
                PROCESS                 determine whether a spike is
                                        generated, set the state to 0 for no------------------------------------------- state field
                has the value of the event amplitude if an event has been
                generated. If an event is not generated then the value of
                the state field depends on the reset field.  If reset is
                non-zero then the state is takes on the value given in
                reset_value. Otherwise the state will behave like a latch
                containing the amplitude of the previous event.

Example:        Scripts/tutorials/tutorial4.g

See also:       

25.28 reac

Object Type:    reac

Description:    Chemical reaction object. Works with pools to provide kf and
                kb. Reacs calculate the changes in concs for each pool hooked
                into them. The pool is responsible for adding up all the
                up and down changes resulting from various reactions it is
                involved in. Each reac can handle any number of substrates
                and products, though reactions of order greater than 2 are
                rare. Any number of reacs can be hooked up to a given pool.

                The generic reaction scheme is:
                                        kf
                Substrate1 + S2 + ..  <----> Prd1 + Prd2 + ...
                                        kb

Author:         U. S. Bhalla, National Centre for Biological Sciences,
                Bangalore, India. (1996).

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  reac_type  [in src/kinetics/kin_struct.h]

Size:           bytes

Fields:         kf                      Forward rate constant. Units depend
                                        on the order of the reaction, ie,
                                        the number of molecules on the
                                        left hand side. First
                                        order is sec^-1, second order is
                                        sec^-1.num^-1, etc.
                kb                      Backward rate constant. Units depend
                                        on the number of molecules on the
                                        right hand side, in a similar way.
                A, B                    Internal state variables, used to
                                        communicate with pools. A represents
                                        increase in the pool n, B is the
                                        decrease.

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       ReacFunc  [in src/kinetics/reac.c]

Classes:        segment

Actions:        PROCESS
                RESET
                SET

Messages:       SUBSTRATE       n       [Number of molecules in substrate pool]
                PRODUCT         n       [Number of molecules in product pool]
                KF              kf      [Forward rate constant]
                KB              kb      [Backward rate constant]

------------------------------------------------------------------------------
Notes: See pool documentation for complete example.

25.29 receptor

Object Type:    receptor

Description:    takes the weighted sum of up to 10 odors to determine membrane
                voltage and spike rates.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor_type  [in src/olf/olf_struct.h]

Size:           144 bytes

Fields:         response        table of weights to apply to incoming odor
                                messages

                Vmin            minimum bound of membrane potential
                Vmax            maximum bound of membrane potential
                gain            scaling factor on input odors
                Vm              calculated current membrane potential

                min_rate        minimum bound of spike firing rate
                max_rate        maximum bound of spike firing rate
                state           spike flag; will be 1 if receptor has fired,
                                0 otherwise

                activation      not used
                transfer_form   not used

------------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:       OlfReceptor  [in src/olf/receptor.c]

Classes:        segment

Actions:        INIT
                PROCESS
                RESET
                RECALC
                CHECK
                SAVE2
                RESTORE2

Messages:       ODOR strength           strength of odor
                GAIN sensitivity        sets gain field in element; globally
                                        scales sensitivity of receptor to odors

------------------------------------------------------------------------------

Notes:          

                The receptor is used as an olfactory receptor, taking a
                weighted sum of up to 10 ODOR messages, to represent
                components of olfactory stimulus. The weights are defined in
                an array on the element, this enables one to construct any
                combination of odor sensitivities on the neuron.  The output
                is both in the form of a membrane potential and a spike.

                The receptor element takes the weighted sum of up to 10 odors
                to determine membrane voltage and spike rates. The odor inputs
                arrive as messages. These can be scaled by the gain field
                which can also be set by messages.  Each odor is weighted by
                the appropriate entry in the response table.

                response - table of 10 weights for incoming odor messages
                (messages are multiplied by weights before being scaled by
                gain and summed to get Vm).

                Vm is meant to be the equivalent of membrane potential,
                calculated by:

                  sum [from i=0 to i=nodors-1] of odor_i x response[i] x gain

                (always bounded by Vmin and Vmax). There is no time course
                involved in Vm, it is simply recalculated every time step.

                state is calculated in a probabilistic manner every time step
                as follows:

                  state is set to 1 if:

                    min_rate + Vm * (max_rate - min_rate)  >
                       a random number (calculated every time step)
                         between 0 and 1

                State is meant to be used as the origin of a message to an
                axon, for connecting to other neurons.

                This element had been largely superseded by the receptor2
                element, which is is a much more realistic version of an
                olfactory receptor protein-membrane channel complex.
Example:        
See also: receptor2

25.30 receptor2

Object Type:    receptor2

Description:    Olfactory Receptor. Takes weighted sum of any number of
                messages to get the activation for a channel. The messages
                represent components of an olfactory stimulus.

Author:         U. S. Bhalla, Caltech (1/90)

------------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:  olf_receptor2_type  [in src/olf/olf_struct.h]

Size:           172 bytes

Fields:         response        table of weights to be set for each odor
                nodors          number of odors
                tau1            open time constant of channel
                tau2            close time constant of channel
                gmax            peak conductance
                Ik              channel current
                modulation      scale all odors; gain control on responses
                Gk              resulting channel conductance
                Ek              equilibrium potential

                activation      channel activation calculated from incoming
                                messages

                allocated       internal flag
                X               state variable for time response
                Y               state variable for time response
                xconst1         internal variable, not normally set by user
                xconst2         internal variable, not normally set by user
                yconst1         internal variable, not normally set by user
                yconst2         internal variable, not n