SYNETSIM

Software for quantitative realistic modeling of neural networks

Page updated: October 9, 1996

SYNETSIM is a program for simulation of simple neural nets using multicompartmental reprogrammable neurons having realistic cellular properties and second-messenger-mediated modulation thereof.
Descriptions of the program can be found in the following papers:

  • Hartline, D.K. (1989) "Simulation of restricted neural networks with reprogrammable neurons" IEEE Trans. Circuits Systems 36: 653-660
  • Hartline, D.K. (1991) "The neuron as a reprogrammable computing element in neural networks" in Fraser, M., ed., Advances in Control Networks and Large Scale Parallel Distributed Processing Models vol. 1, Ablex, Norwood, NJ pp 58-82.
    This manual describes the use of the software. To retrieve a functioning copy, you must have a copy of Microsoft QuickBASIC 4.5 to compile the source code. Proceed as follows:
    1. Download the source module for the main program SYNETSIM.33B into a text file, strip the HTML material above and below the two rows of "###### ..." and compile a stand-alone .EXE version using QuickBASIC version 4.5.
    2. Download the source module for the net compiler NET2PRM.V18 into a text file, strip the HTML material above and below the "########..." rows and compile a stand-alone .EXE version using QuickBASIC.
    3. Download the auxiliary page SYNETSIM-AUX into a text file and parcel the parts sandwiched between the "xxxxxxx ################# ...." delineations into separate text files named as given by the "xxxxxxx"
    4. You should now have the following files on your DOS disk:
      • SYNETSIM.33B
      • SYNETSIM.EXE
      • NET2PRM.V18
      • NET2PRM.EXE
      • NET2MST.CNF
      • NET2PRM.CNF
      • NET2SBT.CNF
      • SYNTEST.NET
      • SYNTEST.PSP
    5. You should be able to run the test network as follows (see manualbelow):
      • NET2PRM SYNTEST
      • SYNETSIM SYNTEST
    The manual below also contains instructions for loading and running the program from a distribution floppy disk. Please contact the author for further information:
                    ***********************************************
                    *                                             *                  
                    *                                             *
                    *          SYNETSIM 3.3 USERS' MANUAL         *
                    *                                             *                 
                    *                                             *
                    ***********************************************
                                Copyright (C) 1990, 1996 by
                                    Daniel K. Hartline
                                    Bekesy Lab
                                    1993 East-West Rd.
                                    Honolulu, HI 96822
    
    
    
    [interim version; not fully updated; use cautiously!]
    
    
    
    SYNETSIM-3 and this manual were produced under the support of NIH grant 
    NS15314.  NET2PRM was written by Greg Wolodkin, Dept. of Electrical 
    Engineering, Univ. of Maryland, College Park, MD.
         The software may be used without license fees for non-profit 
    scientific or educational purposes only.  Inquiries regarding licensing 
    other applications should be addressed to D. Hartline.
    
    Copyright (C) 1990, D. Hartline
    
    This manual is valid for SYNETSIM 3.3, revision B dated 8/23/90.
    See file READ.ME for updates pertaining to subsequent releases.
                            TABLE OF CONTENTS
    
    I. GENERAL INFORMATION                  APPENDICES                    
         A.  Overview                        I:   Error messages          
         B.  Hardware/Software required      II:  Implementation notes    
         C.  Installation and checkout             Program logic in brief 
         D.  Common problems                       Hodgkin-Huxley branches
         E.  Availability of help                  Synaptic potentials    
         F.  References                            Facilitation           
                                             III: User-generated additions
    II. USING SYNETSIM 3.3                   IV:  Netlist manual          
         A.  Startup                               (by Greg Wolodkin)     
         B.  Main menu                       V:   Input file structures   
         C.  Output                          VI:  SYNTEST.NET             
         D.  End-of-run display              VII: Variable list           
         E.  SYNTEST                         VII: Speed tests             
                                             IX:  Source listing          
    III. MODEL DESCRIPTION
         A.  Netlist structure
         B.  Compartmental representation of branching neurons
              CMPT    - Basic electrical compartment
              SOMA    - Spherical compartment
              CYL     - Cylindrical segment
              INFCYL  - Infinite-cylinder cable termination
    
         C.  Electrical properties
              TRIGR   - Trigger zone simulation
              ELECTN  - Electrotonic connections
              DIODE   - Rectifying electrical connections
              SPIKE   - Schmitt-trigger type spike generation
              COND    - Simple conductance and battery
              DRIVER  - Driver and plateau potentials
              HHFXD   - Hodgkin-Huxley kinetics with fixed time-constants
              HH      - Full Hodgkin-Huxley kinetics
              CONNOR  - Hodgkin-Huxley kinetics for crab axon A-current
              SYNAPSE - Spike-generated chemical synapse
              CHEMOX  - Chemotonic (non-spiking) synapse
    
         D.  Pools, second messengers, and biochemistry
              POOL    - Basic chemical compartment
              POOLK   - Chemical reaction and diffusion kinetics
              POOLX   - Pool-dependent modulation
    
         E.  Other netlist features
              .DEFINE block structure
              .BLOCK block structure
              .BATCH block structure
    
         F.  Data files
              Synaptic transmitter file (*.PSP)
              Save file (*.SAV)
              Output file (*.PRN)
    
    IV.  PROGRAM COMPATIBILITY
    V.   PROGRAM BUGS
    VI.  UPDATES IN 3.0 AND 3.2
    
    
    
    
                                         GENERAL INFORMATION
    
    -->  Persons already familiar with SYNETSIM should read the information in 
    the UPDATES section.  A major addition in version 3.3 and later is the 
    "netlist compiler", written by Greg Wolodkin, which makes setting model 
    parameters much easier than before.
    
    A.  OVERVIEW
    
         The SYNETSIM series of neural network models has been developed for 
    the realistic simulation of small networks of individually distinct 
    neurons using parameters measured from physiological experiment.  Previous 
    models of the series have been limited by certain simplifications made to 
    facilitate derivation of model parameters, or by restrictions on computer 
    memory or speed.  The SYNETSIM-3 versions represent a more advanced and 
    versatile model written in BASIC to run on various microcomputers and 
    capable of simulating a variety of electrical and biochemical integrative 
    properties of neural networks.   
    
         SYNETSIM-3 includes the following design features:
    
         1. Compartmental structure:   The network consists of an array of 
    compartments treated uniformly in model computations.   Each is 
    characterized by a capacitance, a leak resistance, and a leak battery.  In 
    addition, any number of active "branches" may  be included to generate 
    appropriate electrical properties.   Cells are constructed through 
    resistive coupling of appropriate compartments.   Electrotonic connections 
    between cells are generated similarly.  A separate set of "diffusionally" 
    connected compartments, termed "pools", is used for chemical components. 
    
         2.  Current-based representations are used for synaptic interactions, 
    for active responses, and optionally for spike-generating regions.   This 
    improves the physiological accuracy of the simulations compared to 
    voltage-based representations (e.g. SYNETSIM 2.4: Hartline 1987), although 
    deriving parameters is more difficult.
    
         3.  Synaptic interactions, both spike-mediated and non-spiking 
    chemical ("chemotonic") operate through simulation of transmitter released 
    and bound to postsynaptic receptors.  Facilitation/antifacilitation of 
    spike-mediated PSPs is featured.
    
         4.  Active responses, such as plateau potentials and delaying 
    mechanisms are simulated (as in earlier versions) by Hodgkin-Huxley type 
    representations.   Modular branch paradigm coding permits easy addition of 
    user-defined algorithms.
    
         5.  Pools can be used to simulate second messenger systems, trapping 
    of ions in extracellular spaces, and electrogenic pumps, as well as  
    biochemical reaction chains of quite general character.  Modulation of any 
    of the parameters of any compartment can be effected through the pools.  
    This provides much flexibility in the integrative capabilities simulable.  
    
         6.  Intracellular messengers of three kinds are simulated:  a) those 
    produced by voltage-gated processes (e.g.  Ca);   b) those dependent on 
    transmitter (or hormone) binding; and  c) those dependent on other 
    internal messengers  (e.g. internally-released Ca; enzymatically activated 
    pathways).  
    
         7. The model does not directly simulate post-spike integration 
    effects (e.g. branch-point failure).
    
    
    B.  HARDWARE/SOFTWARE REQUIRED
    
         The compiled module of SYNETSIM should run as is on an IBM PC-
    compatible machine having 640K of memory.  Exact memory requirements 
    depend on the particular net being run, but nets are likely to be limited 
    to only two or three cells without extended memory capabilities.  The 
    output requires a graphics board (CGA, EGA or VGA) and monitor configured 
    to operate with BASIC graphics commands (SCREEN x; PSET) [default graphics 
    mode is CGA using SCREEN 2; color capabilities were added to version 3.3B 
    and are more likely to cause problems; they may also cause slowing of 
    execution times].  Note that the compiled version of SYNETSIM requires the 
    Microsoft Run-time module BRUN30, which is protected by Microsoft 
    copyrights.  For even faster execution, you can recompile SYNETSIM.3xx.  
    (QuickBASIC 3 supports a math chip using BRUN3087.EXE; QuickBASIC 4 and 
    4.5 detect the presence of a math chip and use BRUN40.EXE or allow a 
    stand-alone option).  Substantial speed increases can be achieved by 
    compiling with the debug feature deselected.
    
    
    C.  INSTALLATION AND CHECK-OUT (diskette distribution only)
    
         Check to be sure the distribution package is complete.  In addition 
    to this file (SYNETDOC.TXT), the following files should be on the 
    distribution diskette:
          DEMO     - Subdirectory with demonstration modules
          HH.NET        - Net file for Hodgkin-Huxley simulations
          NET2PRM.BAS   - Net-list compiler source code
         @NET2PRM.CNF   - Configuration file for NET2PRM
         @NET2MST.CNF   - Configuration file for NET2PRM
         @NET2SBT.CNF   - Configuration file for NET2PRM
         @NET2PRM.EXE   - Net-list compiler (compiled by QuickBASIC 4.5)
          READ.ME       - Update information on more recent releases, etc.
          SYNETSIM.3xx  - Source program (xx= version number)
         *SYNETSIM.EXE  - A compiled form using Microsoft's QuickBASIC 4.5
         *SYNTEST.MST   - Master file for test run
         @SYNTEST.NET   - Net file for test run
         *SYNTEST.PRM   - Parameter file for test run
         *SYNTEST.PSP   - PSP File for test run
         *SYNTEST.SBT   - Batch file for test run
    
    Copy the "*" files to your logged disk area, then type:
    
       SYNETSIM SYNTEST /B
    
    Press the "Enter" key () when the appropriate prompt appears to test 
    whether the program is operating properly.  The screen should plot out the 
    bursting trajectories shown in the SYNTEST figure at the end of Appendix 
    VI.  To test the net-list compiler, copy the "@" files to your disk and 
    type:
    
       NET2PRM SYNTEST
    
    then proceed as above.  The .MST, .PRM, and .SBT files produced by the 
    compiler should be identical to the ones on the distribution disk.
    
    
    D.  COMMON PROBLEMS
    
    DURING STARTUP
    
         a.  "Subscript out of range in line 495":  Not enough space for the 
    display array.  The space needed can be calculated from:
         (number of compartments) x XSCALE / (TINC x SKIP)
    To retain the same amount of model time without changing the time 
    increment, increase the skip-index to skip more time between plotted 
    points.
    
    DURING RUN
    
         a.  "Overflow":  Time increment too large; reduce it.
    
         b.  Plotted points "blow up" ... going off scale.  Problem may be too 
    large a time increment; also the y-scale value (VSCALE, ISCALE, etc. in 
    the .MASTER section of the net file) may be too small.  
    
    
    E.  AVAILABILITY OF HELP
    
         The file SYNETDOC.TXT [this document] contains documentation for the 
    version of SYNETSIM indicated on the cover page for IBM-PC and AT 
    compatible microcomputers.  This is a program under continual development, 
    so parts have not been fully tested, and reliability is not guaranteed.  
    In case of intractable problems, call the author at (808) 956-8003 (FAX 
    808-956-6984).  Please have hardware and software configuration 
    information available, including:  a) make and model of your computer; b) 
    amount of memory; c) print-out of CONFIG.SYS.  Please assure yourself that 
    GWBASIC works on your system (including PRINT #3, INPUT #3, SCREEN 0, 
    SCREEN 2, and PSET statements) and that neither the compiled 
    (SYNETSIM.EXE) nor the interpreted version (SYNETSIM.3xx) work.  In some 
    cases I may be able to modify the program to fit your particular needs (no 
    guarantees, but I am interested in making it useful to others).  Your 
    suggestions will be appreciated.  A final caution: please note the section 
    PROGRAM BUGS, and please read the file READ.ME for update information not 
    contained herein.
    
    F.  REFERENCES
    
         Hartline, D.K. (1976a) "Simulation of phase-dependent pattern changes 
    to perturbations of regular firing in crayfish stretch receptor."  Brain 
    Res. 110: 245-257.
    
         Hartline, D.K. (1976b) "SNAX: A language for interactive neuronal 
    modeling and data processing." In Brown, P.B., ed, Computer Technology in 
    Neuroscience, Hemisphere, Washington, D.C. pp. 41-65.
    
         Hartline, D.K. (1979) "Pattern generation in the lobster (Panulirus) 
    stomatogastric ganglion.  II.  Pyloric network simulations."  Biol. 
    Cybern. 33: 223-236.
    
         Hartline, D.K. (1987) "Modeling stomatogastric ganglion" in 
    Selverston, A.I. and Moulins, M., eds The Crustacean Stomatogastric 
    System, Springer-Verlag, Berlin, pp 181-197
    
         Hartline, D.K. (1989) "Simulation of restricted neural networks with 
    reprogrammable neurons" IEEE Trans. Circuits Systems 36: 653-660 
    
         Hartline, D.K.(1991) "The neuron as a reprogrammable computing 
    element" in Fraser, M., (ed) Advances in Control Networks and Large Scale 
    Parallel Distributed Processing Models, Ablex, Norwood N.J. pp. [in press]
    
    
    II.                           USING SYNETSIM 3.3
    
    
    A.   STARTUP
         Running this version of SYNETSIM is a two-step process.  First, the 
    "netlist" (.NET) file, specifying the properties and connections of the 
    neural network to be simulated must be compiled using the program 
    NET2PRM.EXE.  This generates three output files with default extensions of 
    PRM, MST, and SBT.  The .PRM (parameter) file contains parameters for 
    properties and connections; the .MST (master) file contains parameters 
    related to the running of the model (integration time step, x and y 
    scales, colors, etc.); the .SBT (SYNETSIM batch) file allows for batch-
    like operation of the various menu options at run-time.  After compilation 
    of the netlist, SYNETSIM.EXE is run to perform the actual simulation.  
    After invoking SYNETSIM, the screen should display parameters from the 
    master file, then loading of PSPs (if any), and ending up with:
    
         "HIT ANY KEY TO CONTINUE"
    
    Doing so leads to the main menu (in batch mode, a sequence of menu options 
    will be executed: see BATCH OPERATIONS below):
    
    
    B.   MAIN MENU
    
    (NO .PRN)
      = RETURN TO DOS
         1= FREE_RUN - Run model with no further perturbations
         2= I_PULSEs - 2-pulse current injection paradigm
         3= PSP_TRAIN - Fire spike train in presynaptic cell
         4= Voltage clamp of a compartment [--> submenu]
         5= POOL INCrement - Change level of a selected pool
         6= TOXINS - Enable/disable specific branch types
         7= Initiate batch mode
         8= CHANGE_PARAMeters - Change selected model parameters
         9= OUTPUT_PRN - Write model output to disk on next sweep
        10= SAVE the model state state on a disk file
        11= RESTORE previous model state from disk file
        12= CHANGE_DISPLAY to output new state variable
        13= Options [--> submenu]
    ?
         Respond to this according to the following list of desired model 
    actions (names of parameters for menu-driven and .BATCH operation are 
    given in caps; names with "*" in left margin can be netlist names in  
    driven operation)
    
         SELECTION 1 (Free_run) will run the main network without perturbation 
    for several sweeps, plotting the display-variable (default = membrane 
    potential; changeable with selection 12).  It is often a good idea to run 
    the model for several sweeps to allow transients associated with non-
    initialized variables to decay.
         NSWEEPS = Number of sweeps to be made before returning to menu.
    
         SELECTION 2 (I_pulse) applies a sequence of two current pulses to any 
    compartment: a "conditioning" pulse of arbitrary size and duration, 
    followed by a test pulse of arbitrary size and duration.  It will also 
    apply a bias current that persists through subsequent sweeps.  The program 
    will prompt you for the compartment to be perturbed, the magnitude of the 
    bias current (in nA: see section Model Units below), the magnitudes of the 
    conditioning and test pulses, and the durations of same (time to be 
    specified in seconds).  Type the parameters on one line separated by 
    commas.  The conditioning pulse will start with no delay at the beginning 
    of the sweep.
    *    CMPT      =    Compartment ID to which pulse is to be applied;
         BIAS      =    Bias current to be applied throughout;
         COND_I    =    Conditioning pulse magnitude;
         COND_DUR  =    Duration of conditioning pulse (sec);
         TEST_I    =    Test pulse magnitude;
         TEST_DUR  =    Duration of test pulse (sec).
    
         SELECTION 3 (PSP_train):  This will produce a train of spikes of 
    specified frequency and duration (following a specified delay) in any unit 
    desired.
    *    SPKFLG    =    Spike flag ID for presynaptic spike;
         RATE      =    Stimulation rate for presynaptic unit;
         DELAY     =    Delay from beginning of sweep to start of PSP train;
         DURATION  =    Duration of presynaptic train (sec).
    
         SELECTION 4 (voltage clamp):  This will clamp one specified 
    compartment as indicated by a submenu:
      1 = HOLD - to a given hold potential for a specified number of sweeps.
    *         CMPT      =    Compartment clamped;
              HOLD_V    =    Hold potential;
              NSWEEPS   =    Number of sweeps hold will be applied;
              SAVFILE   =    Name of file to save final model state.
    
      2 = VC_CT - gives conditioning and test clamp commands as in Selection 
    2.  
                  The display for the specified compartment indicates clamp 
    current, 
                  rather than voltage. 
    *         CMPT      =    Compartment clamped;
              COND_V    =    Conditioning pulse level (abs mV);
              COND_DUR  =    Duration of conditioning pulse (sec);
              TEST_V    =    Test pulse level (abs mV);
              TEST_DUR  =    Duration of test pulse (sec);
              HOLD_V    =    Hold potential to be returned to after test.
    
      3 = IV - gives runs of the condition/test type, systematically stepping 
    through a set of 
                  test values, then changing the conditioning level and 
    rerunning.  
                  Current at the end of each test pulse is stored in a .IV 
    file.
    *         CMPT      =    Compartment clamped;
              COND_V    =    Conditioning pulse level (abs mV);
              COND_DUR  =    Duration of conditioning pulse (sec);
              COND_STEP =    Increment size for conditioning pulses (mV);
              NCOND     =    Number of conditioning pulses (minimum is 0);
              TEST_V    =    Test pulse level (abs mV);
              TEST_DUR  =    Duration of test pulse (sec);
              TEST_STEP =    Increment size for test pulses (mV);
              NTEST     =    Number of test pulses (minimum is 1);
              SAVFILE   =    .SAV File holding initial state;
              IVFILE    =    File for storage of I(V) output.
    
    
    
         SELECTION 5 (Pool_inc):  This permits the abrupt increment of any 
    pool, permitting the effects of that pool by itself to be examined.
    *    POOL =    ID of pool to be incremented;
         INC  =    Increment
    
         SELECTION 6 (Toxins) allows control of which physiological properties 
    are enabled.  It functions like a set of specific toxins for particular 
    property types.  Any property ("branch type" ... see below) except the 
    principal compartment type can be blocked by giving the property mnemonic 
    code and answering "B" to the input request (answer "U" to unblock a 
    previously blocked property). 
         CODENAME  =    Name of property to be blocked;
         FLAG      =    B or U for blocked or unblocked
    
         SELECTION 8 (Change_param):  Model parameters are specified by a 
    branch code [WHICH AT THIS POINT MUST BE NUMERIC RATHER THAN MNEMONIC], a 
    branch number, and a parameter number.  For interaction parameters (codes 
    3 and 21), the branch and parameter numbers are replaced with the numbers 
    of the two compartments or pools between which the interaction takes 
    place. [.BATCH mode operation of this has not yet been implemented]
    
         SELECTION 9 (Output_prn): is used to activate output to disk for one 
    sweep.  The status display "(NO .PRN)" on the main menu will change to 
    "(.PRN OUTPUT)" when this option is active.  Answer the next query with 
    the name of a disk file, which may include a drive\directory 
    specification, but must not include an extension (see OUTPUT below).  A 
    second use of selection 9 before an output run will cancel the output 
    mode.
         PRNFILE   =    Output file name (.PRN will be added as extension)
    
         SELECTIONS 10 and 11 (Save; Restore): allow storing and recalling the 
    model state (all state variables and the PSP summation array).  This 
    allows saving a state just prior to a manipulation, so that several 
    parameters in the manipulation can be tested if desired.  Note that the 
    model must already have the appropriate .MST, .PRM, and .PSP files in 
    memory. 
         SAVFILE   =    Save-file name (.SAV extension must be specified)
    
         SELECTION 12 (Change_display):  allows changing which state variables 
    are plotted on the screen, or written to the output .PRN file, if the 
    latter option has been selected.  The default option is compartment 
    membrane potential (V).  The menu selection first asks for the mnemonic 
    code for the branch-type of the state variable desired (e.g. "CMPT"), then 
    for the mnemonic for the state variable (same as the variable name given 
    in the parameter file block of the Model Description section)[UNTESTED]
         
         SELECTION 13 (Options):  The following options may be elected
    through this selection (the assignment FLAG=ON or FLAG=OFF is used in 
    BATCH operations):
         1= TIME_RESET - Sets U-variable [time] for reset/no reset at 
    beginning of sweep.
         2= BELL - Turns bell on/off (beeps at end of sweep, for slow models).
         3= ZERO_LINE - Turns y=zero axis plot on/off.
         4= SPIKE_TIC - Turns spike plot on/off
         5= Y_OFFSET - Permits the y-offset of the plot to be changed
              OFFSET = offset in mV (no FLAG)
         6= DEBUG_MODE - Activates/inactivates a debug mode
              NSWEEPS = the number of sweeps in .BATCH mode
    
         Following menu selections 5 and above, the model program returns to 
    the main menu and waits for another selection.  Following menu selections 
    1-4, the model will plot membrane potential (or another selected display 
    variable), along with spikes fired, for one (or in some cases more) sweep, 
    before returning to Main Menu.
    
    
    C.   OUTPUT
    
         To screen:  
         Normal output is a screen plot of a Plot Variable, initially membrane 
    potential (for each compartment), and modifiable by Selection 12 
    (=CHANGE_DISPLAY in the netlist .BATCH block) of the Main Menu.  Colors 
    can be used with screens supporting graphics mode 9 by setting GMODE=9 in 
    the .MASTER block of the netlist (see MASTER BLOCK below).  In the absence 
    of color or screen specification, SYNETSIM defaults to CGA (graphics mode 
    2) format.  Note that the model may run a lot (e.g. 2x) slower in these 
    alternate screen modes!
    
         To printer:
         If the "PRINT" option is active, parameters of the run will be listed 
    on the printer operated by BASIC's LPRINT statement.   Activation is via 
    menu item 13, or setting PRINT=ON in the .BATCH block, or setting PRINT=-1 
    in the .MASTER block.
    
         To .PRN and .SPK files:
         If output to disk is selected using main menu item 9 (=OUTPUT_PRN in 
    and the extensions ".PRN" and ".SPK".  The .PRN file will contain Lotus 1-
    2-3 compatible data columns.  The first column is model time.  The 
    subsequent columns are the display-parameter variables from selection 12 
    (if not left as membrane voltage).  The file can be read directly into a 
    Lotus worksheet (using the "Import/Numbers" operations) and plotted using 
    the usual Lotus facilities.
         The .SPK file contains two columns, Time a spike fired and Unit # 
    firing.
    
    
    D.   END-OF-SWEEP DISPLAY
    
         At the end of the run (if not in batch mode), a "SWEEP COMPLETE:   
     TO MAIN MENU" message appears.  At this point, the cursor keys (and 
    the Word-Star cursor control cluster of ^E, ^S, ^F, ^X, ^A, ^F) are 
    active, and permit positioning a cursor on any point of any trace.  Use 
    the up-down arrows to switch between traces.  Hold  key down with 
    right or left arrow to make larger jumps.  The  key (or ^V) toggles 
    between the first cursor and a second one.  Y and T values for both 
    cursors are displayed at the upper left of the screen; differences between 
    the two cursor values in Y and T are shown at the right.  The cursors are 
    useful for making small numbers of quantitative measurements on model 
    output without having to write large files to disk.  Type  to return 
    to main menu.
    
    
    III.                         MODEL DESCRIPTION
    
         SYNETSIM models a set of "Compartments" each composed of "Branches" 
    and "Pools".  Branches correspond to physiologically identifiable 
    contributions to the conductance and to the ionic current of a compartment 
    (i.e. its electrical properties).  Pools deal with biochemical and 
    modulatory properties.  The various types of branches, pools, and certain 
    interactions are given "Branch Codes" Except for the "Principal Branch" 
    (Code "CMPT" [1], specifying basic parameters for a given compartment: 
    capacitance, leak battery and leak conductance), there is no limit to the 
    number of branches of a particular type that can be associated with a 
    given compartment.  The following describes the characteristics of each of 
    the branches, pools, or interactions, then describes how to specify 
    necessary parameters in the netlist file 
    A.  NETLIST STRUCTURES
    
         The first step in creating a network is producing a netlist file 
    (.NET extension) which describes the network desired.  This file is then 
    compiled using the compiler NET2PRM and run as described in the STARTUP 
    section above.  The netlist contains several sections: a parameter block 
    and a DEFINE block, consisting of component declaration lines which 
    generate a parameter file (.PRM extension); a MASTER block and a BLOCK 
    block, which generate a master file (.MST extension); and a  BATCH block, 
    which generates a batch file (.SBT extension).  Only the parameter and 
    master blocks are mandatory.  These are described briefly in this section, 
    and the remaining block types are discussed later under SPECIAL NETLIST 
    FEATURES.  Details of the netlist are given in Appendix IV and of each of 
    the input files in Appendix V.
    
    PARAMETER BLOCK
           The first line of the netlist file is a text identifier (enclosed 
    in quotes).  What it contains is arbitrary, but it might be used to 
    identify the run characteristics.  Following are lines laying out the 
    network structure, cell by cell, with properties belonging to a given cell 
    grouped with that cell. 
         The following netlist (plus a MASTER block described later) specifies 
    two single-compartment cells ("Drivr" and Follower"), each with a spike-
    generating trigger zone.  The Drivr cell bursts endogenously through a 
    repetitive driver potential property, and it inhibits the follower with a 
    spike-mediated chemical synapse.  There is also a non-rectifying 
    electrotonic connection between Drivr and Follower (this netlist has been 
    written with several lines for each parameter set to keep them on the 
    page; in practice, only one line for each property is permitted; a less 
    cumbersome method for assigning property parameters is described in the 
    
    "Demo netlist"
    'Code Name                Parameters                        Connections
    CELL Drivr
     CMPT One     (C=.005 RP=-50 GL=.2) 
      TRIGR       (E0=0 TAUM0=0.04 PMTHR=0 KPM=2 TAUPM=.25 
    +              KA1=0.3 TAUA1=0.5 TAUA2=5.8 THRINF=4 
    +              TAUTHR=.004 DV0=-4 MAXV=-4 DTHR0=5 
    +              MAXTHR=5)
      DRIVER      (VNA=40 GBARNA=.5 V0NA=-40 MUNA=5 VK=-90 
    +              GBARK=.5 V0K=-40 MUK=5 GBARK1=.36 TAUK1=.4)
    
    
    
    '          
    CELL Follower
     CMPT One     (C=.005 RP=-50 GL=.2) 
      TRIGR       (E0=0 TAUM0=0.04 PMTHR=0 KPM=2 TAUPM=.25 
    +              KA1=0.3 TAUA1=0.5 TAUA2=5.8 THRINF=4 
    +              TAUTHR=.004 DV0=-4 MAXV=-4 DTHR0=5 
    +              MAXTHR=5)
      HHFXD       (VEQ=-90 GBAR=100 QM=1 V0M=-35 MUM=4
    +              TAUMA=.005 QH=1 V0H=-70 MUH=-5 TAUH=.04)
      ELECTN      (GC=.1)                                     Drivr/One
      SYNAPSE     (VREVS=-75 GAMMA=0.06 KDS=1 PSPSHP%=1       
    +              DLY=.003 A0S=.1 TAUF=0)                    Drivr/One/TRIGR
    
         As can be seen from this example, each cell is declared with a CELL 
    reserved word, followed by a name.  All components following pertain to 
    that cell until the next CELL declaration, or until a terminating code 
    (e.g. .MASTER) is encountered.  A series of property declaration lines 
    follows (continuation lines must start with a "+"; total number of 
    characters in a declaration is 256).  Each has three fields: the code 
    field, the parameter field, and the connection field.  
         Code field:  contains one of the standard (reserved word) names of 
    branch types, as presented in the next section (e.g. CMPT, TRIGR, DRIVER).  
    In the cases of CMPT (as for CELL) there is an additional mandatory name 
    field after the code field (in other cases, the name, if needed, is 
    appended to the code field with a "/").
         Parameter field:  contains parameter asssignments.  Parameter 
    assignments are indicated with "=" and those for different parameters are 
    separated with spaces (not commas).  The assignment segment is enclosed in 
    ().  This format is intended to follow the SPICE simulation conventions.  
    The order in which parameters are given does not matter, but any parameter 
    not assigned will be given a value of 0.
         Connection field:  contains sources of input from or output to other 
    compartments or branches.  If the connection deals with a compartment, 
    only the full compartment name (including cell name) need be given (e.g. 
    the ELECTN electrotonic connection above).  If it deals with a specific 
    property (such as the trigger zone in the SYNAPSE above), it must include 
    the name of the cell AND the property (if there are more than one copies 
    of a property-type in one compartment, they must be given unique names in 
    their declaration lines [e.g. TRIGR/One and TRIGR/Two] and the appropriate 
    one referenced by this name in the connection field).
    
    MASTER BLOCK
         The following aspects of the model are determined by assignments made 
    in a master block within the netlist, and reflected in entries made in the 
    master file (.MST extension):
    
    PRMFILE   =    Name of Parameter File (less .PRM extension)
    PSPFILE   =    Name of PSP File (less ".PSP") [defaults to "NONE"]
    BATFILE   =    Name of batch file (less ".SBT") [defaults to "NONE"]
    XSCALE    =    Full-scale X-axis value for screen plot (sec)
    VSCALE    =    Full-scale Y-axis value for voltage plot (mV)
    ISCALE    =    Full-scale Y-axis value for current plot (nA)
    GSCALE    =    Full-scale Y-axis value for conductance plot (umho)
    KSCALE    =    Full-scale Y-axis value for rate & binding constant plots
    PSCALE    =    Full-scale Y-axis value for pool level plot.
    Y0        =    Vertical offset for plotted horizontal axis line
    TINC      =    Integration time increment (in sec) [typical: .001]
    SKIP      =    Plot skip index (point-plotting interval: 1=none skipped)
    PSPDM     =    PSP duration multiplier (normally=1): scales time course
    PSPL      =    Length of PSP table (PSPTB) [typical: 500]
    SUMTBL    =    Length of PSP summation table (SUMTB) [typical: 500]
    SPKHT     =    Spike height (vertical line drawn when spike fired, in mV)
    ADPFLG         Set = -1 to elect y=KA(E-sum A) tz option (else yinf=KA*E)
    PF             Set = -1 to print run protocol on printer, otherwise 0
    ZPF            Set = -1 to plot zero line (axis), otherwise set = 0
    SPF            Set = -1 to plot spikes, otherwise set = 0
    
    The master block is indicated by a .MASTER code followed by a "(", and it 
    need not be contained on a single line.  Continuation lines must start 
    with a "+".  The block ends with a ")".  Except for file names, parameters 
    omitted from the master block default to 0.  PRMFILE defaults to the same 
    name as the netlist file.  PSPFILE and BATFILE default to "NONE".   An 
    example follows which if added to the end of the parameter block above 
    will allow a net to be compiled by NET2PRM and run by SYNETSIM which 
    serves to illustrate various points covered so far:
    
    '
     .MASTER (PSPFILE=syntest XSCALE=1 VSCALE=200 ISCALE=2000 GSCALE=10
    +        KSCALE=1000 PSCALE=5 Y0=50 TINC=0.001 SKIP=5 PSPDM=1 PSPL=500
    +        SUMTBL=500 SPKHT=40 ADPFLG=1 ZPF=-1 SPF=-1)
     .END
    
    
    B.   REPRESENTATION OF BRANCHING NEURONS
    
         Several reserved-word codes in a NET2PRM netlist generate parameter 
    lines in the .PRM file appropriate for the compartmental representation of 
    branching neurons:
    
    CMPT - Basic electrical compartment
         The basic electrical unit in the model is a compartment, consisting 
    of a capacitance, a resting potential, and leak conductance.  The 
    parameters are set in the netlist using the following designations:
    
    C    -    Capacitance of compartment (in uf)
    VLK  -    Leak battery (mV absolute, e.g. -65)
    GL   -    Leak conductance (e.g. umho; units of C/GL = sec)
    
    The netlist line:
    
    CELL A
     CMPT Name (C=.002 RP=-50 GL=.2)
    
    Will generate a compartment with a capacitance of 2 nf (.002 uf; see 
    section MODEL UNITS for discussion of units used by SYNETSIM), a leak 
    battery of -50 mV, and a leak conductance of 0.2 umho.  Alternatively, the 
    same compartment could be generated with the line:
    
    CELL A
     CMPT Name (C=.002 RP=-50 GAMMA=.1)
    
    where GAMMA is the leak conductance density in mmho/uf.  In general, any 
    trans-membrane conductance can be given either as a straight conductance 
    (in umho) or as a density (in mmho/uf).  In the latter case, the density 
    is multiplied by the capacitance (in uf) to obtain the actual value for 
    that conductance.
    
    SPHERE - Spherical compartment
         Instead of calculating compartment parameters for certain common cell 
    geometries, NET2PRM will make the calculations and produce appropriate 
    compartment parameters.  For a spherical structure, such as a soma, the 
    code SPHERE, followed by the following parameter assignments will effect 
    this:
    
    DIAM -    Soma (e.g.) diameter (in microns)
    RHOM -    Specific membrane resistance (ohm-cm2)
    FOLD -    Infolding ratio (ratio of capacitance to that of equivalent 
    sphere)
    RP   -    Resting potential (as in CMPT)
    
    The lines:
    
    CELL A
     SPHERE SOMA (DIAM=100 RHOM=50000 FOLD=2 RP=-50)
    
    is compiled into compartment parameters equivalent to a sherical soma with 
    diameter 100u, a membrane resistivity of 50kohms-cm2, an infolding ratio 
    of 2.0 and a resting potential of -50mV.  The compartment is named 
    "A/SOMA".
    
    CYL - Cylindrical segment
         As for a sphere, a compartment with parameters representing a 
    cylindrical segment of membrane can be generated with the code CYL and the 
    parameter assignments:
    
    L    -    Length of cylinder (e.g. axon or dendrite; in microns)
    DIAM -    Cylinder diameter (in microns)
    RHOM -    Specific resistance of membrane (ohm-cm2; as in SPHERE)
    RHOI -    Specific resistance of cytoplasm (ohm-cm)
    FOLD -    Infolding ratio (as in SPHERE)
    RP   -    Resting potential (as in CMPT)
    
         Compartments may be strung together using electrical connections to 
    produce branching cables or electrotonically-connected cells.  Regular 
    compartments must use the ELECTN code (see below), but cylinders may 
    (though they need not) be connected to other compartments using the 
    connection field.  Thus the lines:
    
    CELL A
     SPHERE SOMA (DIAM=100 RHOM=50000 FOLD=2 RP=-50)
     CYL    X    (L=100 DIAM=10  RHOM=50000 RHOI=70 FOLD=2 RP=-50)   A/SOMA
    
    specify a cylindrical segment (named "X") connected to a sphere ("A/SOMA" 
    in the connection field gives the name of the compartment to which the 
    connection is made), and the lines:
    
    CELL A
     SPHERE SOMA (DIAM=100 RHOM=50000 FOLD=2 RP=-50)
     CYL    X    (L=100 DIAM=10  RHOM=50000 RHOI=70 FOLD=2 RP=-50)   A/SOMA
     CYL    Y    (L=100 DIAM=5   RHOM=50000 RHOI=70 FOLD=2 RP=-50)   A/X
     CYL    Z    (L=100 DIAM=5   RHOM=50000 RHOI=70 FOLD=2 RP=-50)   A/X
    
    specify the same configuration with the addition of two cylindrical 
    segments, Y and Z, branching off of segment X.  
         CYLinders are constructed so that half of their longitudinal 
    resistance is on the the proximal side of the compartment, and half on the 
    distal side (i.e. compartment parameters are associated with the midpoint 
    of the cylinder).  Two important restrictions result:
    
         1. Only one explicitly-specified connection is permitted per 
    cylinder.  This means that connections in branching trees are specified at 
    the proximal ends of cylindrical segments only.  For connections at the 
    distal ends, the connection fields of other cylinders are used.
    
         2.  No more than three cylinders may join at a branch point.  This 
    means, for example, that in the last case above, no more cylinders could 
    be attached to cylinder X.  This is because a "Y-to-Delta" transform is 
    necessary to properly link cylindrical compartments, and NET2PRM can only 
    handle the simplest case.  If multiple branches are needed from a single 
    point, short cylindrical pieces can be inserted between three-way 
    junctions, or appropriate values for standard CMPT compartments can be 
    calculated for the particular configuration needed.
    
    INFCYL - Infinite-cylinder cable termination
         A CYLinder with no entries in the connection field will have an 
    infinite termination resistance.  The COND code (see below), used as one 
    of the components of the compartment, can provide other termination 
    conductances.  Alternatively, the INFCYL code generates a COND code 
    appropriate to an infinite cylinder of specified characteristics.  Thus in 
    the previous example, the final lines:
    
     CYL    Z    (L=100 DIAM=10  RHOM=50000 RHOI=70 FOLD=2 RP=-50)   A/X
      INFCYL           (DIAM=10  RHOM=50000 RHOI=70 FOLD=2 RP=-50)
    
    provides a termination conductance appropriate to an infinitely extended 
    cable of the same diameter as the compartment.  Note that there is no 
    connection field for INFCYL, since it is only a branch circuit on 
    compartment Z defined in the previous declaration line.
    
    
    B.   ACTIVE ELECTRICAL PROPERTIES
    
         Special electrical branches provide characteristic electrical 
    properties for neurons.  Among the cellular properties so represented are 
    various types of active conductances and simplified repetitive firing 
    characteristics (trigger zone kinetics).  Among various types of 
    interactions between cells or compartments are resistive coupling 
    ("electrotonic"), spike-mediated chemical synaptic coupling, and non-spike 
    chemical ("chemotonic") coupling.
    
    CODE "COND"  - Fixed conductance  (Numerical code 7)
         This branch type gives a fixed conductance in series with a fixed 
    EMF.  Its intended purpose is to serve as a terminating conductance for 
    cables and as a target of modulation by the pools, as in simulating 
    second-messenger-mediated PSPs.
    
         Parameter-field names are:
    VCOND          EMF
    GCOND          Conductance
    GAMMA          Capacitance-normalized conductance
    
    As described under the CMPT code, any transmembrane conductance can be 
    given either as an absolute conductance (G) or as a capacitance-normalized 
    conductance (GAMMA).  Only one of the two should be assigned in the 
    netlist.  Example:
    
    CELL A
      SPHERE SOMA   (DIAM=100 RHOM=50000 FOLD=2 RP=-50)
      COND   TARGET (VCOND=-75 GCOND=0)
    
    could be a target conductance used to produce a 2nd-messenger-dependent 
    IPSP with a reversal potential of -75 mV (GCOND would be modulated by a 
    second messenger represented by a pool, as described below).
    
    
    CODE "DRIVER" - Driver-potential kinetics (Numerical code 8) 
         This code generates active plateau-potential kinetics based on a 
    time-independent mixed "Na-K" conductance with sigmoidal voltage-
    dependence for activation, and two slowly changing voltage-dependent K 
    ("restoring") conductances.  The voltage-dependence has the form:
    
              ginf = gbar / (exp(-(V-Vo)/mu) + 1)      (8.1)
    
    where ginf is the steady-state conductance, gbar is the maximum 
    conductance, Vo is the half-activation voltage for the sigmoid and mu is 
    the "characteristic" voltage, defining 1/(1+e) = .27 of the full value.  
    The time-dependence has the form:
    
            dg/dt = (ginf - g)/tau                         (8.2)
    
    where tau is a first-order time-constant.
    
            Parameter field:
    VNA      Sodium (or other inward current) reversal level
    GBARNA       Maximum sodium conductance
    GAMMA        Normalized sodium conductance
    V0NA         Sodium half-activation voltage
    MUNA         Sodium activation characteristic voltage
    VK           Potassium (or other outward current) reversal level
    GBARK        Maximum potassium conductance
    GAMMAK       Normalized potassium conductance
    V0K          Potassium half-activation voltage
    MUK          Potassium activation characteristic voltage
    GBARK1       Restoring conductance-1 maximum conductance
    GAMMAK1      Normalized maximum conductance-1
    TAUK1        Restoring conductance-1 time constant
    GBARK2       Restoring conductance-2 maximum conductance
    GAMMAK2      Normalized maximum conductance-2
    TAUK2        Restoring conductance-2 time constant
    
    
    CODE  "HHFXD" - HH fixed-tau kinetics    (Numerical code 9)
         Hodgkin-Huxley conductances with voltage-independent time constants.  
    For this, the activation gating variable, m, and the inactivation 
    variable, h, (instead of conductance) obey Eq. 8.1 and 8.2.  The 
    conductance is then related to the gating variables in the usual way:
    
              g = gbar * m^Qm * h^Qh                       (9.1)
    
    
         Parameter field:
    VEQ       Active current reversal level
    GBAR      Active current maximum conductance
    GAMMA     Normalized maximum conductance
    QM        Active current activation exponent
    V0M       Active current half-activation voltage
    MUM       Active current activation characteristic voltage
    TAUMA     Active current activation time constant
    QH        Active current inactivation exponent
    V0H       Active current half-inactivation voltage
    MUH       Active current inactivation characteristic voltage
    TAUH      Active current inactivation time constant
    
    
    CODE "HH"  - Full HH kinetics (Numerical code 10)     Hodgkin-Huxley type 
    conductances with all features, based on the differential equation for the 
    gating particle, x: 
    
              dx/dt = alpha (1 - x) - beta x               (10.1)
    
    in which the voltage-dependence of both alpha and beta can be described by 
    an equation of the form: 
    
              alpha= (a +b(V+c))/(exp(-(V+c)/d) + e)       (10.2)
    
    where a,b,c,d, and e are constants.  Rate constants calculated by 10.2 are 
    multiplied by a scale-factor, KTEMP, to adjust for temperature.
    
         Parameter field:
    VEQHH        Reversal potential (Na=55mV; K=-72; Lk=-49.387)
    GBARHH       Maximum conductance 
    GAMMA        Normalized maximum g (Na=120 mmho/uf; K=36; Lk=.3)
    KTEMP        Rate-constant scale factor for temperature
    QMHH         Exponent for activation gate (Na = 3; K = 4)
    QHHH         Exponent for inactivation gate (Na = 1; K = 0)
    AAM, BAM, CAM, DAM, EAM         Constants a,b,c,d,e for alpha-m
    ABM, BBM, CBM, DBM, EBM         Constants a,b,c,d,e for beta-m
    AAH, BAH, CAH, DAH, EAH         Constants a,b,c,d,e for alpha-h
    ABH, BBH, CBH, DBH, EBH         Constants a,b,c,d,e for beta-h
    
    For the Hodgkin-Huxley (1952) squid axon (6.3 degrees C, resting potential 
    = -60), these constants are (for rates in 1/sec):
       a       b       c       d      e     for Sodium
       0    -100      35      10     -1     alpha-m
    4000       0      60     -18      0     beta-m
      70       0      60     -20      0     alpha-h
    1000       0      30      10      1     beta-h
    
                                            for Potassium
       0     -10      50      10     -1     alpha-n
     125       0      60     -80      0     beta-n
    
         The netlist realization of a 1 nf compartment of squid membrane would 
    be:
    
    CMPT SQUID     (C=.001 RP=-49.387 GAMMA=0.3) 
      HH  SODIUM    (VEQHH=55 GAMMA=120 KTEMP=1 QMHH=3 QHHH=1 
    +                   AAM=0 BAM=-100 CAM=35 DAM=10 EAM=-1
    +                   ABM=4000 BBM=0 CBM=60 DBM=-18 EBM=0 
    +                   AAH=70 BAH=0 CAH=60 DAH=-20 EAH=0
    +                   ABH=1000 BBH=0 CBH=30 DBH=10 EBH=1)
      HH  POTASSIUM (VEQHH=-72 GAMMA=36 KTEMP=1 QMHH=4 QHHH=0 
    +                   AAM=0 BAM=-10 CAM=50 DAM=10  EAM=-1 
    +                   ABM=125 BBM=0 CBM=60 DBM=-80 EBM=0) 
    
    Note that parameters with 0 value would not have to have been explicitly 
    specified, this being the default value.  In fact, those for potassium 
    inactivation have been omitted to achieve this end.
    
    
    Code CONNOR - Special A-current kinetics (Numerical code 13)
         Connor, Walter, and McKown (1977: Biophys. J. 18: p102) give somewhat 
    different empirical equations for A-current activation and inactivation 
    kinetics:
    
    For steady-state gating particle concentrations (x):
    
         xinf = (a exp [(V+b)/c]/{1+exp[(V-Vo)/mu]})q   (13.1)
    
    For gating particle time-constants:
    
         tau = tauo + a'/{1+exp[(V-Vo)/mu']              (13.2)
    
    Time constants are divided by a temperature coefficient.  The forms of the 
    equations are the same for both activation and inactivation except that 
    the numerator of 13.1 = 1 for inactivation.  The exponent, q, has the 
    values:
    
         qm = 1/3 = 1/QMC for activation and
    
         qh =  4  = QHC for inactivation.
    
    Conductance is given by:
    
         g = gbar mQMCh                                     (13.3)
    
    
         Parameter field:
    VEQCON                             A reversal level
    GBARCON                            A maximum conductance
    GAMMA                              Normalized maximum conductance
    KTEMPC                             Temperature factor
    QMC                            A-activation exponent
    MCA, MCB, MCC, V0MC, MUMC          Constants for minf3
    TMC0, TMCA, V0TM, MUTM             Constants for taum
    QHC                                A-inactivation exponent
    V0HC, MUHC                         Constants for hinf
    THC0,THCA,V0TH,MUTH                Constants for tauh
    
         The values given in Connor et al (1977) for crab axon at 18oC 
    translated into netlist format are:
    
    CONNOR (VEQC=-75 GAMMA=47.7 KTEMPC=1 QMC=3 
    +          MCA=76.1 MCB=94.22 MCC=31.84 V0MC=-1.17 MUMC=28.93
    +          TMC0=.0003632 TMCA=.001158 V0TM=-55.96 MUTM=20.12 
    +          QHC=4 V0HC=-53.3 MUHC=14.54 
    +          THC0=.00124 THCA=.002678 V0TH=-50 MUTH=16.027)
    
    
    D.   GRADED INTERACTIONS
    
         These are interactions between cells or between parts of the same 
    cell in which the strength of the effect felt is smoothly graded as a 
    function of the force (membrane potential) driving the interaction.
    
    CODE "ELECTN" - Electrotonic interactions  (Numerical code 3)
         This code type specifies two compartments which are resistively 
    coupled by a bi-directional coupling conductance.  These use the current-
    based equations:
    
              I(i,j) = gc(i,j)[V(j)-V(i)]                  (3.1)
    
    where I(i,j) is the current into compartment i from compartment j, V(i) is 
    the membrane potential of compartment i, and gc(i,j) is the coupling 
    conductance.  These are summed with other sources of current to charge the 
    membrane capacitance.  The parameter field has only one parameter, GC, the 
    coupling conductance (in umho).  To specify a coupling between two 
    compartments (code CMPT) in a netlist, one is arbitrarily chosen as the 
    "postjunctional" compartment, and the code line placed within the domain 
    of that compartment.  The "prejunctional" compartment name should then 
    appear in the connection field.  Thus the lines:
    
    CELL A
     CMPT X  (C=.002 VLK=-50 GL=.2)
    CELL B
     CMPT Y  (C=.001 VLK=-60 GL=.1)
      ELECTN (GC=.2)                    A/X
    
    couples the two compartments X and Y with a conductance of .2 umho.
    
    
    CODE "DIODE" - Rectifying electrical connection (Numerical code 4)
         This code functions much the way the previous one does, but the 
    coupling is unidirectional.  Current flows from prejunctional to 
    postjunctional compartment only if the membrane potential in the 
    prejunctional compartment is more positive (depolarized) than that in the 
    postjunctional one.  Its method of specification is the same as for 
    bidirectional electrotonic connections.
    
    
    CODE "CHEMOX" - Chemotonic inputs (steady state)  (Numerical code 12) 
         In SYNETSIM 3 synapses, chemical synapses simulate the release and 
    binding of transmitter on the postsynaptic cell.  In non-spiking chemical 
    transmission, transmitter release is an exponential function of 
    presynaptic voltage.  This can occur in two ways:  the steady-state value 
    can bear this exponential relationship (a non kinetic situation), or the 
    release rate can.  Thus:
    
              Xmtr= Xmtro exp(Vpre/Muc)                  (12.1)
    
              dXmtr/dt= Xmtr'o exp(Vpre/Muc)             (12.2)
    
    where Xmtro and Xmtr'o are respectively the transmitter concentration or 
    release rate at Vpre=0, Vpre is the presynaptic voltage, and Muc is the 
    characteristic voltage for the release curve. Released transmitter affects 
    synaptic conductance according to:
    
              g(t)= gbarc * Xmtr(t)/(Kdc + Xmtr(t))      (12.3)
    
    where gbarc is the maximum possible conductance (saturation: all channels 
    open), Xmtr(t) is transmitter concentration at time t, and Kdc is the 
    effective dissociation constant for transmitter binding to the 
    postsynaptic receptor.  Synaptic current (I) is then calculated as for all 
    other ionic currents:
    
              I(t)=g(t)(V-Vrevc)                           (12.4)
    
    where Vrevc is the reversal potential for this particular synapse.
    
            Parameter field:
    VREVC     Chemotonic reversal potential
    GBARC     Maximum chemotonic conductance
    GAMMA     Normalized maximum conductance
    KDC       Dissociation constant for transmitter binding
    S0C       Transmitter release at 0 mV presynaptic voltage
    MUC       Presynaptic voltage giving release of S0C * e
    KS        Decay time-constant of transmitter
    
         If KS=0, then a steady state situation is simulated.
         Presynaptic compartments are specified in the connection field of the 
    netlist.  Thus the lines:
    
    CELL A
     CMPT X  (C=.002 VLK=-50 GL=.2)
    
    CELL B
     CMPT Y  (C=.001 VLK=-60 GL=.1)
      CHEMOX (VREVC=-75 GBARC=.2 KDC=1 S0S=.1 MUC=15 KS=.01)    A/X
    
    would use the voltage in cell A compartment X to release transmitter onto 
    cell B compartment Y.  
         Note that the transmitter pools pertaining to spikes and those 
    pertaining to chemotonic interactions are separate.  This may be 
    physiologically inaccurate since a given synapse could well operate in 
    both modes, and this would produce errors in calculation of receptor-
    saturation proportions.  
    
    
    E.   SPIKE-FLAG-RELATED PROPERTIES
    
         Spike flags allow for simulations in which the crossing of threshold 
    by membrane potential generates a spike, which in turn can activate a 
    synapse, releasing transmitter onto a postsynaptic cell.  The same 
    processes can be simulated using the HH properties to simulate spike 
    generation and the CHEMOX properties to generate synaptic potentials, but 
    the simulations, while physiologically more correct, require much more 
    computer time.
    
    CODE "TRIGR"  - Trigger-zone kinetics (Numerical code 2)
         This property provides repetitive firing kinetics using the "active 
    pacemaker model" of Hartline 1976a.  It operates by setting a "spike flag" 
    when threshold conditions have been met, and this spike flag can be used 
    to drive other spike-flag-sensitive properties (i.e. SYNAPSE-type 
    synapses) It gives a nearly linear pacemaker response relation (f-I 
    curve), with up to three components of adaptation.  The present 
    implementation approximates the trigger zone of SYNETSIM 2.4.  [WARNING: 
    There is a known flaw in this module which renders the simulation 
    quantitatively inaccurate, though qualitatively acceptable; further, 
    various programming relics of version 2.4 have not yet been removed, and 
    not all features of the SNAX version 2.4 are included in SYNETSIM-3].  The 
    trigger zone is driven by the voltage of the parent compartment, and 
    providing they are given uniques names, there may be more than one trigger 
    zone in each compartment.  The SYNETSIM 3 versions to date have no 
    feedback to the parent compartment (e.g. simulating spike-
    invasion/shunting or loading phenomena).  Use Code HHFXD type branches for 
    this.  Loading may be added in future versions.  
         The kintics of SYNETSIM trigger zones are discussed in Hartline 
    (1989) and the reader is referred to this source for details.  Parameter 
    names are as follows:
    
         Parameter field:
    E0      Base excitation
    TAUM0   Base level membrane time constant
    PMTHR   Threshold for active pacemaker response
    KPM     Pacemaker sensitivity factor
    TAUPM   Pacemaker response increase time constant
    KCOND   Spike conductance sensitivity factor
    TAUCOND Spike conductance time constant
    KAR     Resting-potential adaptation sensitivity factor
    TAUAR   Resting-potential adaptation time constant
    KA1     Adaptation component 1 sensitivity factor
    TAUA1   Adaptation component 1 time constant
    KA2     Adaptation component 2 sensitivity factor
    TAUA2   Adaptation component 2 time constant
    THRINF  Asymptotic spike threshold value
    KTHR    Spike threshold sensitivity factor
    TAUTHR  Spike threshold time constant
    DV0     Base increment in membrane voltage
    MAXV    Maximum membrane voltage reset level
    DG0     Base increment in spike conductance
    MAXG    Maximum spike conductance
    DAR0    Base resting-potential adaptation increment
    MAXAR   Maximum resting-potential adaptation level
    DA10    Base adaptation 1 increment
    MAXA1   Maximum adaptation 1 level
    DA20    Base adaptation 2 increment
    MAXA2   Maximum adaptation 2 level
    DTHR0   Base threshold increment
    MAXTHR  Maximum threshold
    
    (Note that not all TRIGR parameters have been implemented as modulation 
    targets yet)
    
    
    CODE "SPIKE"  - Spike flag (Numerical code 5)
         This branch type generates a "Schmidt trigger" type of spike when the 
    voltage in its compartment exceeds an "on" threshold; it is "refractory" 
    until voltage goes below an "off" threshold.  The intended use is to allow 
    Hodgkin-Huxley spikes to set spike flags.
    
         Parameter field:
    ONTHR          On-threshold (mV absolute)
    OFFTHR         Off threshold (mV absolute)
    
    Synapses are linked to both of these spike generators (TRIGR and SPIKE) 
    through their connection field in the netlist (see below).
    
    CODE "SYNAPSE"  - Spike-mediated PSP inputs  (Numerical code 11)
         In SYNETSIM 3, spikeflag-produced PSP time-courses are computed by 
    tabular interpolation to obtain the time-course of transmitter 
    concentration.  Transmitter is accumulated separately at each synapse.  
    Concentration is assumed to be additive (not a valid assumption under some 
    conditions).  The amplitude function, representing intrinsic synaptic 
    strength and facilitation effects, is computed as described in Hartline 
    (1989) and yields a transmitter release coefficient.  Conductance and 
    current are calculated as they are for chemotonic inputs.  
    
            Parameter field:
    VREVS       PSP reversal potential
    GBARS       Maximum synaptic conductance
    GAMMA       Normalized maximum conductance
    KDS     Dissociation constant for transmitter binding
    PSPSHP          PSP shape # (sequence number during .PSP file read-in)
    DLY     Synaptic delay
    A0S     Base amount of transmitter release
    ------------------[ repeating unit] ------------
    TAUF        Facilitation time-constant
    NF              Facilitation exponent
    C2F             Base facilitation increment
    C1F             Facilitation increment factor
    ------------------------------------------------
    
    The repeating facilitation unit permits several facilitation "pools" to be 
    associated with a single synapse.  SYNETSIM continues to read in 
    facilitation blocks until it encounters a TAUF=0.
         Presynaptic "units" in the model refer to the spike flag name in the 
    netlist.  Thus the lines:
    
    CELL A
     CMPT X  (C=.002 VLK=-50 GL=.2)
      SPIKE/1
    CELL B
     CMPT Y  (C=.001 VLK=-60 GL=.1)
      SYNAPSE/i (VREVS=-75 GBARS=.2 KDS=1 PSPSHP%=1 A0S=.1)  A/X/SPIKE/1
    
    would use spikes generated by the Schmidt-trigger generator in cell A 
    compartment X to generate PSPs in cell B compartment Y.  Note that the 
    full name of the spike source must be given, including the name of the 
    property (SPIKE) generating it.  The synapse in this example has been 
    given an optional name ("i") by which can be referenced (see Pool Type 1 
    example, below)
    
    STIM reserved word
         This word used in a connection field specifies the need for a spike 
    flag that has not been attached to either a TRIGR branch or a SPIKE 
    branch.  It would then be available for use in the "PSP_train" option of 
    the main menu (option 3).  If it is given a name (e.g. STIM/electrode1), 
    then several different synapses could be acitvated by the same stimulator.
    The flag number will be printed out on the screen by NET2PRM when the 
    netlist is compiled.  This number must be used when specifying the 
    spikeflag in menu option 3.
    
    F.   POOLS, SECOND MESSENGERS, AND BIOCHEMISTRY
    
         Non-electrical neuronal properties (e.g. biochemically derived) are 
    simulated through a set of POOLS.  Each pool has an amount of material 
    (Xpool) contained in a specific volume (XVOL parameter in netlist).  In 
    addition, each pool potentially has an additive base level (XPOOL0 in the 
    netlist) which is not subject to "diffusion" and "degradation".  This can 
    be used to bias the level of modulation produced in target parameters, if 
    desired.  (Note: in Hartline 1989, different symbols were used: S=Xmtr, 
    P=Xpool, Po=Xpool0, R=Xtarg, and Ro=Xtarg0.)
         For the netlist, the pool type is specified by a TYPE=__ assignment, 
    assignments for XVOL and XPOOL0, and several type-specific assignments as 
    delineated below.  The pool specifications (as for other compartmental 
    components) must be grouped under the compartment definition line.
    
    CODE "POOL" - Pool definition (Numerical code 20)
         Pool types are defined using this code.  Four types of pools can be 
    specified according to the rules for their filling and emptying:
    
         TYPE 1:  Bound transmitter pool.  Pool level is proportional to the 
    concentration of bound transmitter at a synapse:
    
              Xpool= C * Xmtr/(Kd + Xmtr)                (20.1)
    
    where C is a constant of proportionality and Kd is the dissociation 
    constant for transmitter binding.  The synapse must be one of the Code 
    "SYNAPSE" (=11) synapses, but this can be made to have no PSP (if desired) 
    by setting GBARS=0.  Note that the dissociation constant controlling the 
    pool can in general be different from that for the Code SYNAPSE synapse 
         The netlist line is of the form:
    
      POOL[/Name] (TYPE=1 XVOL=xx XPOOL0=xx KD=xx C=xx)      SynapseName
    
    The connection field contains the full name of the synapse associated with 
    the pool.  An example:
    
      POOL/cAMP (TYPE=1 XVOL=1 XPOOL0=0 KD=1 C=.005)      B/Y/SYNAPSE/i
    
    where the synapse is the one given above for SYNAPSE.
    
    
         TYPE 2:  Filling rate proportional to bound transmitter.
    
              dXpool/dt = C1 * Xmtr/(Kd + Xmtr) - C2 * Xpool (20.2)
    
    where terms are analogous to type 1.  This can be used to simulate 
    activation of an enzyme producing second messenger at a rate proportional 
    to bound transmitter.
         The netlist line is similar to that for Type 1:
    
    CELL A
     CMPT X
      POOL[/Name] (TYPE=2 XVOL=xx XPOOL0=xx KD=xx C1=xx C2=xx)  
    CELL/CPT/SYNAPSE/ID
    
         TYPE 3: Filling rate proportional to ionic current, with first order 
    decay.
    
              dXpool/dt = C1 * I(k,j) - C2 * Xpool        (20.3)
    
    where I(k,j) is the current flowing in the kth branch of type code j.  
    This can be used to simulate entry of ions through channels, e.g. Ca.
         The netlist line is of the form:
    
      POOL[/Name] (TYPE=3 XVOL=xx XPOOL0=xx K=xx J=xx C1=xx C2=xx)
    
    Note that the K and J specified must correspond to values assigned in the 
    parameter file.  To find those values, the netlist must be compiled twice, 
    the first time with dummy K,J's (e.g. 1,1).  [THIS NEEDS TO BE CHANGED TO 
    PERMIT NAMED SOURCES IN THE CONNECTION FIELD]
    
         TYPE 4: Constant filling rate with first-order decay.
    
              dXpool/dt = F - K * Xpool                  (20.4)
    
    where F is the filling rate and K the rate constant for decay.  This can 
    be used to simulate a substance which is synthesized and degraded, rates 
    of which can then be modulated by other pools, e.g. enzymatic regulation 
    of synthesis and degradation.
         The netlist form is:
    
      POOL[/Name] (TYPE=4 XVOL=xx XPOOL0=xx F=xx K=xx)
    
         Additional pool types can be added as needed.  Pool-defining 
    ("spring") subroutines must be added starting at line 11340.  Follow the 
    format for existing types.
    
         TYPE 5:  Bound transmitter from CHEMOX branch.  Essentially a Type 1 
    pool for CHEMOX. 
              Xpool= C * Xmtr/(Kd + Xmtr)                (20.5)
    
      POOL[/Name] (TYPE=5 XVOL=xx XPOOL0=xx KD=xx C=xx)      ChemoxName
    
    
    CODE "POOLK" - Inter-pool diffusion (Numerical code 21)
         All pools are potentially interconnected by first-order "diffusional" 
    rate constants:
    
            dXpool(k)/dt = SUM{K(k,j) Xpool(j)/Xvol(j)}        (21.1)
                    - SUM{K(j,k)} Xpool(k)/Xvol(k)
    
    where K(k,j) is the first-order rate constant into pool k from pool j.  
    Note that the rate constants in the two directions need not be equal.  
    This can be used to simulate not only diffusion within and between 
    compartments and cells (in which intrinsic rate constants in the two 
    directions would be equal), but also first-order chemical reactions.
         Netlist format is:
    
       POOLK[/Name] (K=xx)       SourcePoolName
    
    The pool k of eq. 21.1 is the pool under which the definition line 
    appears.  The connection field gives the full name of pool j.  For 
    example, a situation for a modulator-activated cAMP pool diffusing away 
    from the site of origin into the interior of the cell might be represented 
    by the following netlist:
    
      POOL/cAMP1 (TYPE=2 XVOL=1 XPOOL0=0 KD=1 C1=5)      A/X/SYNAPSE/e
       POOLK     (K=.1)                                  POOL/cAMP2
      POOL/cAMP2 (TYPE=4 XVOL=1)
       POOLK     (K=.1)                                  POOL/cAMP1
    
    
    
    CODE "POOLX" - Pool interactions (Numerical code 22)
         Pool levels can affect various "targets": other pools and compartment 
    parameters of the model.  Seven types of interaction have been programmed 
    (in the following, Xpool refers to the sum of the calculated pool level 
    plus a base level, Xpool0, which can be specified with the Code POOL 
    parameters).  A base level of interaction in the presence of 0 control-
    pool levels (Xtarg0) is set automatically for any non-zero value in the 
    input (.PRN) file.
         Netlist interaction entries must follow after the pool-definition 
    line for the pool controlling (driving) the interaction.  The name of the 
    target (a pool or a parameter) is specified in the interaction fields.  
    The name structure for a pool target is:
    
         [Cell-name/Compartment-name/]POOL/Pool-name
    
    and for a parameter:
    
         [Cell-name/Compartment-name/]CODE/Branch-name/Parameter-name
    
    Note the "/"s are required between cell and compartment names in this 
    structure.  The cell and compartment names may be omitted (indicated by 
    []) if they are the same as for the compartment generating the 
    interaction.  As an example, the target name for the maximum synaptic 
    conductance (GBARS) in Cell B of the SYNAPSE example given below would be:
    
         B/Y/SYNAPSE/i/GBARS
    
    
         TYPE 1: Direct proportionality.  The value of the target is a 
    constant multiple of the pool value plus a base level:
    
                    Xtarg = C Xpool + Xtarg0                   (22.1)
    
    where Xtarg is the value of the target, C is a constant, and Xtarg0 is the 
    value of Xtarg if Xpool = 0.
         Netlist declaration line:
    
    POOLX (TYPE=1 C=1)      Target
    
    where Target is the name of either a pool or of a parameter to be 
    modulated.
    
    Example:
    CELL A
     CMPT X     (C=.002 VLK=-50 GL=.2)
      SPIKE/1   (ONTHR=-30 OFFTHR=-40)
    
    CELL B
     CMPT Y
      SYNAPSE/i (VREVS=-75 GBARS=.2 KDS=1 PSPSHP%=1 A0S=.1)  A/X/SPIKE/1
       POOL/cAMP1 (TYPE=2 XVOL=1 XPOOL0=0 KD=1 C1=5)         SYNAPSE/i
        POOLX (TYPE=1 C=1)                                   A/X/GL
    
    In this case, the target was a model parameter instead of a pool.
    
         TYPE 2: Equilibrium receptor binding.  The value of the target above 
    base is proportional to the binding of the control pool to a receptor:
    
            Xtarg = C Xpool/(Kd + Xpool) + Xtarg0              (22.2)
    
         Netlist declaration line:
    
    POOLX (TYPE=2 C=1 KD=1)      Target
    
    
         TYPE 3: Bimolecular reaction with pseudo first-order kinetics.  The 
    rate of change in target value is proportional to the difference in rates 
    of forward and backward reaction of the form:
    
                           A + Xpool <---> Xtarg
    
            dXtarg/dt = alpha * Xpool(A0-Xtarg) - beta * Xtarg (22.3)
    
    where alpha and beta are the two rate constants and A0 is the total amount 
    of the limiting reactant (Xpool is assumed not to change as a result).  
    This can be used, for example, to simulate the kinetics of receptor 
    binding, or enzymatic phosphorylation of a channel.  Note that for the 
    steady state:
    
                    Xtarg = A0/(1 + beta/alpha/Xpool)          (22.4)
    
         Netlist declaration line:
    
    POOLX (TYPE=3 ALPHA=xx BETA=xx A0=xx)      Target
    
         TYPE 4: Ionic battery interaction.  The target value is related to 
    the pool level by the Nernst equation:
    
                    Xtarg = 26 * ln (Xpool/Conc)               (22.5)
    
    where Conc is the concentration of ion on the other side of the membrane.  
    In conjunction with a Type 3 pool, trapping of ions in extracellular 
    spaces can be simulated.  
         Netlist declaration line:
    
    POOLX (TYPE=4 CONC=xx)      Target
    
         TYPE 5: Modulation of target synthesis.  The rate of change of the 
    target is proportional to pool value:
    
                    dXtarg/dt = C * Xpool                      (22.6)
    
    This can be used to simulate the enzymatically-limited synthesis of a 
    compound from a large substrate pool.  It can also be used as an 
    alternative to Type 3 to simulate the production of a second messenger at 
    a rate proportional to bound transmitter.
    
         Netlist declaration line:
    
    POOLX (TYPE=5 C=xx)      Target
    
    
         TYPE 6: Modulation of coupling conductance.  The target conductance 
    is proportional to the controlling pool:
    
                    GC(Post, Pre) = C * Xpool + Xtarg0     (22.7)
    
         Netlist declaration line:
    
    POOLX (TYPE=6 C=xx)      PostTargetCmpt    PreTargetCmpt
    
    Since electrotonic interactions involve two compartments, specifying one 
    for modulation requires two names in the interaction field, one for the 
    post- and one for the prejunctional compartment.
    
         TYPE 7: Modulation of diffusion rate constant between pools.  The 
    target constant is proportional to the controlling pool:
    
                    K(Post, Pre) = C * Xpool + Xtarg0      (22.8)
    
    This can be used to simulate the effect of changing enzyme concentrations 
    on the rates of first-order reactions.
         Netlist declaration line:
    
    POOLX (TYPE=7 C=xx)      PostTargetPool    PreTargetPool
    
    As with type 6, this interaction requires two connection-field entries.
    
         Other interaction types can be added.  Appropriate subroutines should 
    be inserted beginning at line 12800.
    
    
    G.  SPECIAL NETLIST FEATURES
    
    ".DEFINE" BLOCKS
    
         A standard parameter set for any type of branch can be defined in a 
    DEFINE line and assigned a unique name, by which it can be invoked.  This 
    name is then placed just prior to the parameter-assignment segment.  This 
    has the effect of setting default template values for all branch 
    parameters.  Only those parameters that differ from this template then 
    need be assigned in the assignment segment.
         For example, a neuron represented as a spherical soma with a 5-
    segment 5 micron diameter two-times infolded uniform axon which could be 
    represented by the netlist:
    
    CELL X
     SPHERE SOMA (DIAM=60 RHOM=50000 FOLD=5 RP=-50)
     CYL    AXON1 (L=100 DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)  X/SOMA
     CYL    AXON2 (L=200 DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)  X/AXON1
     CYL    AXON3 (L=300 DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)  X/AXON2
     CYL    AXON4 (L=400 DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)  X/AXON3
     CYL    AXON5 (L=500 DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)  X/AXON4
    
    could be more clearly and efficiently represented by:
    
    CELL X
     SPHERE SOMA (DIAM=60 RHOM=50000 FOLD=5 RP=-50)
     CYL    AXON1  AXON (L=100)                       X/SOMA
     CYL    AXON2  AXON (L=200)                       X/AXON1
     CYL    AXON3  AXON (L=300)                       X/AXON2
     CYL    AXON4  AXON (L=400)                       X/AXON3
     CYL    AXON5  AXON (L=500)                       X/AXON4
     .DEFINE CYL AXON (DIAM=5.0 RHOM=50000 RHOI=50 FOLD=2 RP=-50)
    
    
    ".BLOCK" BLOCKS
         Physiological properties can be blocked with a set of toxin flags, 
    one for each property type (=branch code).  These flags may be set during 
    run time using main menu option 6 (or an equivalent .BATCH block call).  
    Initial values are also set by the master file, which in turn is 
    automatically written by NET2PRM so that any branch codes found in the 
    declaration lines will be unblocked, and those missing will be blocked.  
    However, this latter default can be overridden by including the branch 
    code in the parameter field of a .BLOCK statement, e.g.:
    
     .BLOCK (ELECTN HHFXD POOLK)
    
    in SYNTEST.NET blocks these three properties.
    
    
    BATCH BLOCKS and BATCH OPERATIONS
         If a .BATCH block is present in the netlist, and a "/B" switch is 
    used in invoking SYNETSIM (e.g. "SYNETSIM SYNTEST /B "), normal menu-
    driven input from the keyboard will be suspended and command sequences and 
    parameters will be taken from the batch file (in the example just given, 
    this would default to the file SYNTEST.SBT, which is also the default name 
    of the file generated by NET2PRM for SYNTEST.NET; the third file given in 
    the command lines for both NET2PRM and SYNETSIM is assigned to the batch 
    file, if this is to be different from the default name).  The batch file 
    consists of lines of numbers or strings which would be normally the 
    responses to INPUT prompts.
    
    The batch file is generated from a .BATCH block in the netlist which might 
    contain something like:
    
     .BATCH HOLD    (CMPT=1/1 HOLD_V=-100 NSWEEPS=20 SAVFILE=FILE.SAV)
           IV      (CMPT=1/1 COND_V0=-100 NCOND=1 TEST_V0=-60 SAMPLE_T=.006
                     TEST_STEP=10 NTEST=13 SAVFILE=FILE.SAV IVFILE=FILE.IV)
     .ENDBATCH
    
    This would generate a file with the lines:
    
    SYNETSIM 3.3.2
    4,1,1,-100,20,FILE.SAV,0
    4,3,1,-100,0,0,1,-60,.006,10,13,FILE.SAV,FILE.IV,0
    7
    
    The first line is a format check line; the next two are the numbers that 
    must be entered to guide the SYNETSIM menu system through a hold-potential 
    voltage clamp run followed by an I(V) curve run.  The last line ("7") 
    terminates the batch mode, and is generated by the mandatory ".ENDBATCH" 
    directive in the netlist.
         It will be seen that the batch mode allows using names for the 
    various parameters that must be given to SYNETSIM to set up a given run 
    (the same names appear in the screen prompts of the menu mode).  Any 
    numerical parameters not assigned will be set (effectively) to zero.  If 
    file names are to be omitted, the assignment (file)NAME = NONE must be 
    made.
         Batch mode also allows using netlist names for compartments 
    (parameter name "CMPT"), spikeflags ("SPKFLG"), pools ("POOL"), pool 
    targets ("TARGET"), and toxin and display-variable names ("CODENAME").  In 
    addition, the parameter "FLAG" can be set equal to "ON" (=-1 or true) or 
    "OFF" (=0 or false).  See NET2SBT.CNF discussion in the Appendix.
         Batch block parameter names are listed in the description of the main 
    menu above.  
    
    H.  DATA FILES
    
    SYNAPTIC TRANSMITTER FILE (PSPFILE$.PSP)
         This file contains time-course data for all PSPs.  It must be 
    constructed with an editor,  word processor, or user-generated program.  
    Two formats for specifying the data are possible.  In one, the PSP is 
    given as transmitter-level and time pairs.  In the other, the PSP 
    transmitter level is calculated as an analytic function.  The choice is 
    specified by the entries in the file.  The first three entries are:
    
    STITLE$   Title of PSP file
    SFIDD$    SYNETSIM 3.0.1 (12/25/87 file format code)    
    NPSP%     Number of PSP's in file (any number of PSPs can be 
                       contained in a file, but only the first NPSP% of 
                       those will be read in)
    
    Subsequent entries are specific to the two formats.  Formats can be 
    intermixed:
    
    Format 1:
         In the first format, entries consist of of alternating time (T3) and 
    value (V3) (transmitter level) entries in sequential order but no 
    specified interval.  The latter should be normalized to a peak 
    concentration of 1.0.  Each PSP must begin with the pair 0,0, which also 
    serves as the termination code for the preceding PSP.  Each PSP must 
    extend beyond the end of the PSP storage array (PSPTB), this being 
    accomplished, for example, by having a final T,V pair = 1000,0.  The final 
    PSP must have a 0,0 termination pair at its end.  
    
    4:        0
    5:        0
    6,8,...   T1, T2 ... Tm-1, 1000  Time of points on 1st PSP.
    7,9,...   V1, V2 ... Vm-1,    0  Value of points on 1st PSP.
    
    
    n-1:      0     End code
    n:        0
    
    Format 2:
         For PSPs calculated from an equation, the first entry must be a 
    negative number, the magnitude of which specifies which of various 
    analytic functions is to be used for the calculation.  In SYNETSIM 3.3, 
    only an instantaneously rising, exponentially decaying function is 
    implemented, but other formats are readily programmed (see line 685 ff).  
    For this "Type -1" PSP, the second entry is the decay time constant of 
    transmitter (sec).  Example:
         -1,0.07
    specifies a sharp-rise transmitter release with a decay of 70 msec.
    
    SAVE FILE (*.SAV; set as File#1)
         When option 10 of the Main Menu is selected to save the model state, 
    it writes a file having the following format [.SAV is a suggested, though 
    not mandatory, extension]:
    
    PFILE$  -       Parameter file format code
    U       -       Model time
    SUMTB0% -       Pointer to current place in psp summation array
    V(i)s   -       Membrane potentials for all compartments (1 to N%)
    {j%, k%, s.v} - Indices and state-variable for branch (j%,k%)s
                    [j%=1 to 12 (excl 3); k%=1 to N%(j%)]
    XPOOL(k%)s      Pool values for all pools (1 to N%(POOL%))
    0,0             Block termination
    SUMTB(j%,t%)s   Synaptic transmitter concentrations for all synapses
    "END"           End-code
    
    
    SAMPLE NETWORKS
    
    SYNTEST 2-CELL NET
         The SYNTEST network consists of a circuit of two cells ("Drivr and 
    "Follower": see wiring diagram in Appendix IV).  This network features an 
    endogenously bursting network-driver neuron which inhibits and is 
    inhibited by the follower.  Drivr is electrotonically coupled to Follower 
    by a rectifying connection.  In addition to the spike-mediated synapses, 
    there is a blocked reciprocal chemotonic inhibition between Drivr and 
    Follower that can be unblocked (set toxin flag CHEMOX = "U" with menu 
    option 6) as a demonstration of the chemotonic feature of the model.  In 
    addition, transmitter released by Drivr activates the synthesis of a 
    "second messenger" pool in Follower which induces a voltage-dependent 
    inward current in the cell, causing it to produce plateau potentials.  For 
    purposes of demonstration a second pool is "diffusionally connected" to 
    the second messenger one if the "diffusion" property is enabled (set toxin 
    flag POOLK to "U" using menu option 6).  This could represent "buffering" 
    of the second messenger, or its reversible inactivation through a chemical 
    reaction.  In the SYNTEST net, only codes TRIGR, ELECTN, DRIVER, SYNAPSE, 
    POOL, and POOLX (=2,3,8,11,20,22) are unblocked (spikes, electrotonic 
    connections, plateaus, spike-mediated synapses, pools and pool targets).  
    The resulting output is plotted using LOTUS in the figure accompanying 
    Appendix IV.
            See APPENDIX VI for an annotated listing of the SYNTEST parameter 
    file, and output plots.
    
    SQUID AXON
         A 1-compartment cell with parameters appropriate for a .001 cm2 patch 
    of space-clamped Hodgkin-Huxley squid axon is also provided.  The 
    parameters are for an axon at 6.3oC as specified in J. Physiol. 117: 500-
    544 (1952), using a resting potential of -60 mV.  To utilize this, run 
    NET2PRM and then SYNETSIM using HH in the command line.  Choose menu 
    selection 1 for several sweeps to let the state variables settle, then use 
    selection 2 with Compartment=1, Bias=0, Cond_I=0, Test_I=900, 150, 70, and 
    60 (nA/nf=uA/cm2) in sequence, Cond_durn=0.001, and Test_durn=0.0001 to 
    generate Fig. 12 of HH '52 (be sure to allow several recovery sweeps 
    between stimuli).
    
    
    DEMONSTRATION MODULES
         A set of demonstration modules is included which is suitable for 
    training students in the application and properties of various SYNETSIM 
    branch types and the physiological phenomena they represent.  See the 
    separate description SYNETDEM.TXT.
    
    MISCELLANEOUS
    
    PROGRAM COMPATIBILITY
         The current version of SYNETSIM is completely compatible (to the best 
    of my belief) with QuickBASIC 3.0.  The source code provided in 
    SYNETSIM.3xx is intended to be mostly GWBASIC compatible as well.  In 
    recompiling it with QuickBASIC, comment out line 50 (GWB%=-1).  Small 
    networks (<=3 branches per compartment) can be run under GWBASIC.  In 
    transporting it to a foreign version of BASIC a problem may be encountered 
    owing to the frequent use of the same name for an array and for a standard 
    variable.  Thus N% is the number of compartments in the model, whereas 
    N%(i) is the number of branches having code i.  Also, T is a scratch time 
    variable whereas T% is a time index for an array.  GWBASIC permits these, 
    but other BASICs (e.g. BetterBASIC) may not. 
    
    MODEL UNITS
         The basic unit of time in SYNETSIM is the second.  Thus time 
    increments (TINC), display X-axis length (XSCALE) and stimulus durations 
    (from Main Menu) must be given in this unit.
         The basic unit of voltage is the millivolt.  This is the unit for 
    activation voltages, reversal potentials, etc.  There is no absolute 
    voltage reference built into the model.  The demonstration models (e.g. 
    SYNTEST) use the external bath potential as the zero reference, but one 
    could as well use resting potential.
         Other units in the model (current, conductance, capacitance, 
    concentrations, binding constants) are arbitrary, but must be kept 
    consistent with the time and voltage units.  In SYNTEST and most 
    demonstration modules, current has been given in nA, making resistance 
    units = Mohms, conductance units = umho, and capacitance units = uf.  To 
    bring specific conductances into line with current usage, these (i.e. 
    GAMMAs) are given in mmho/uf.  One can use other units, but keep in mind 
    that membrane conductances in the model are calculated from densities with 
    the equation G = GAMMA/(1000*C).
    
    PROGRAM BUGS
         TRIGR inaccuracies:  The present version still has the known 
    inaccuracy in the spike calculation routine of 3.0, which renders it 
    inaccurate, though usable.  
         Type 3 pool interaction:  There is a known minor inaccuracy in this 
    interaction in line 12310.
         SYNAPSE facilitation: reported not to work (S. Lin, personal comm.)
         Untested options:  Not all options have been tested.  The following 
    sections, in particular, have NOT been tested in the current version and 
    may be particularly prone to errors:
         Code TRIGR details, including RP adaptation; spike resets; threshold-
              crossing corrections;  handling of excitatory drive.
         Code POOL pools of types 2 and 3
         Code POOLK (inter-pool diffusion)
         Code POOLX pool interactions of types 4,6,7, and 8
    
         DIMension limitations:  The model as it stands does not DIMension 
    many arrays, giving them default dimensions of 10.  If more than 10 
    branches are required, DIM statements will have to be added after line 63, 
    and MAXBR% in line 60 must be changed to the new maximum number of 
    branches.
           Despite every attempt to minimize them, errors are inevitable.  
    Your help in drawing attention to such will be greatly appreciated.
    
    
    
    OTHER NOTES
         Interpreted-mode:  If need be, a truncated version of the source 
    program (SYNETSIM.3xx, where xx=version and revision #) can be run in 
    interpreted mode with GWBASIC (or BASICA), although much more slowly (see 
    Speed tests, Appendix V).  The "comment" mark (') must be removed from 
    line 50 before attempting this.  The program itself must also be 
    shortened, and unnumbered lines must be deleted.  It is suggested that 
    lines 13000 to the end be deleted and that pool interactions be blocked.
    
    UPDATES IN 3.0 AND 3.2
    
         This release of SYNETIM has several changes from the two previous 
    releases (3.0D and 3.2C), primarily in the implementation of Greg 
    Wolodkin's net-list compiler, NET2PRM.  This is reflected in the rewritten 
    descriptions of network properties above, and in separate sections on 
    NET2PRM (see also the NET2PRM manual in Appendix V).  
    
    A.  Modifications of the Parameter File (.PRM)
         The parameter file is now created from the netlist file.  Old 
    parameter files must be translated into the new form.  As an aid, empty 
    templates for each v3.0 and 3.2 SYNETSIM property are given below as   
    which must be inserted: see NET2PRM documentation):
    
    "Netlist title (1 line of text enclosed in quotes)"
    'Code Name      Parameters (changes)     Connections
    '-------------------------------------------------------------------------
    ----
     .DEFINE CMPT    x  (C=       RP=       GL=       ) 
    
     .DEFINE TRIGR   x  (E0=      TAUM0=    PMTHR=    KPM=      TAUPM=
    +         KCOND=    TAUCOND=  KAR=      TAUAR=    KA1=      TAUA1= 
    +         KA2=      TAUA2=    THRINF=   KTHR=     TAUTHR=   DV0=
    +         MAXV=     DG0=      MAXG=     DAR0=     MAXAR=    DA10=
    +         MAXA1=    DA20=     MAXA2=    DTHR0=    MAXTHR=   )
    
     .DEFINE ELECTN  x  (GC=      )
    
     .DEFINE SPIKE   x  (ONTHR=   OFFTHR=   )
    
     .DEFINE COND    x  (VCOND=   GCOND=    )
    
     .DEFINE DRIVER  x  (VNA=     GBARNA=   V0NA=     MUNA=     VK= 
    +         GBARK=    V0K=      MUK=      GBARK1=   TAUK1=    GBARK2=   
    +         TAUK2=    )
    
     .DEFINE HHFXD   x  (VEQ=     GBAR=     QM=       V0M=      MUM=
    +         TAUMA=    QH=       V0H=      MUH=      TAUH=    )
    
     .DEFINE HH      x (VEQHH=    GBARHH=   KTEMP=1   QMHH=     QHHH=
    +                   AAM=      BAM=      CAM=      DAM=      EAM=
    +                   ABM=      BBM=      CBM=      DBM=      EBM=
    +                   AAH=      BAH=      CAH=      DAH=      EAH=
    +                   ABH=      BBH=      CBH=      DBH=      EBH=     )
    [NOTE that this property contains the additional parameter KTEMP, for
    temperature scaling, which cannot be defaulted to 0 and hence atleast
    a value of 1 must be inserted in any v3.3 netlist]
    
     .DEFINE SYNAPSE x  (VREVS=   GBARS=    KDS=      PSPSHP%=  DLY=
    +         A0S=      TAUF=     )
    
     .DEFINE CHEMOX  x  (VREVC=   GBARC=    KDC=      S0=       MUC=     )
    [NOTE: "S0" replaces "XMTR0C"]
    
     .DEFINE POOL    x  (TYPE=1   XVOL=     XPOOL0=   KD=    C=    )
     .DEFINE POOL    x  (TYPE=2   XVOL=     XPOOL0=   KD=    C1=   C2=   )
     .DEFINE POOL    x  (TYPE=3   XVOL=     XPOOL0=   C1=    C2=   )
     .DEFINE POOL    x  (TYPE=4   XVOL=     XPOOL0=   F=     K=    )
    
     .DEFINE POOLK   x  (K=       )
    
     .DEFINE POOLX   x  (TYPE=1   XVOL=     XPOOL0=   C=   )
     .DEFINE POOLX   x  (TYPE=2   XVOL=     XPOOL0=   C=      KD=    )
     .DEFINE POOLX   x  (TYPE=3   XVOL=     XPOOL0=   ALPHA=  BETA=  A0= )
     .DEFINE POOLX   x  (TYPE=4   XVOL=     XPOOL0=   CONC=   XBRN%= XPRM%= )
     .DEFINE POOLX   x  (TYPE=5   XVOL=     XPOOL0=   C=      XBRN%= XPRM%= )
     .DEFINE POOLX   x  (TYPE=6   XVOL=     XPOOL0=   C=      )     
     .DEFINE POOLX   x  (TYPE=7   XVOL=     XPOOL0=   C=      )     
    
    Specific changes which have been made in parameter file structure are:
         1. HH parameter lines add KTEMP after GBAR (normally = 1), the 
    temperature-dependent rate-constant scale factor (added to 3.2.4, v3.2D).
         2.  Omitted parameters are no longer allowed in parameter lines (e.g. 
    omitting the exponent in HH lines to abort the further read-in of non-
    utilized activation or inactivation properties).  This is to maintain 
    compatibility with NET2PRM, which, except for certain special exceptions, 
    expects a fixed parameter line format.
         3.  DIODE branch replaces "ELECTN" for unidirectional connections; 
    ELECTN is reserved only for bidirectional ones.  Branch Code for DIODE is 
    4; SPIKE has been reassigned code 5.
         4.  Conductance densities.  Version 3.3 adds the option of 
    conductance densities (per uf of capacitance) to be specified in place of 
    conductances, wherever they appear in the old parameter set.  If only a 
    single conductance is present for a particular property, the density is 
    simply called "GAMMA" in the netlist.  Where several conductances appear, 
    the density for the first is GAMMA, and in the remainder, "GBAR" is 
    replaced by "GAMMA" in the name (e.g. the density for GBARK1 is GAMMAK1 in 
    DRIVER).
    
    B.  Master File (.MST) is replaced by .MASTER block:
    
         The master file is now created from a .MASTER block in the netlist 
    file.  Old master files must be translated into the new form.  As an aid, 
    the .MASTER block-equivalents for SYNTEST.MST is given for version 3.0 and 
    3.2C:
    
    Version 3.0D:
     .MASTER (PRMFILE=SYNTEST PSPFILE=SYNTEST
    +  XSCALE=1 VSCALE=50 TINC=.002 SKIP=1 PSPDM=1 PSPL=500 SUMTBL= 500
    +  SPKHT=15 ADPFLG=-1
    +  ZPF=-1 SPF=-1) 
     .BLOCK (ELECTN HHFXD CHEMOX POOLK)
    
    Note that the plot switches (PLTSW%) of v3.0D have been eliminated except 
    for the zero-line plot (ZPF) and the spike-tic plot (SPF) [the original 
    plot switches have been replaced by plot variables: see main menu 
    selection 12; note that this replaces main menu option 6].  All switches 
    and flags have been converted to a Boolean form (i.e. using -1 instead of 
    1).  The header information for the master file is generated automatically 
    by NET2PRM.
    
    Version 3.2D:
     .MASTER (PRMFILE=SYNTEST PSPFILE=SYNTEST
    +  XSCALE=1 VSCALE=100 ISCALE=2000 GSCALE=10 KSCALE=1000 PSCALE=5 Y0=50
    +  TINC=.002 SKIP=1 PSPDM=1 PSPL=500 SUMTBL=500
    +  SPKHT=20 ADPFLG=-1
    +  ZPF=-1 SPF=-1)
     .BLOCK (ELECTN HHFXD CHEMOX POOLK)
    
    The master file for v3.3B also includes the parameter BATFILE (for batch 
    file operation) and the flag PF (for protocol printout), which default to 
    NONE and 0, respectively, if they are left unassigned.
    
    C.  Additional features of 3.2 and 3.3:
    
         1.  Voltage-clamp conditions can be applied to a single compartment 
    at a time (Main Menu option 4; options 4 & 5 renumbered).  see Main Menu 
    section (3.2).
    
         2.  A cursor-supplied screen display, useful for making measurements 
    on simulation runs, has been added.  It automatically comes up at the end 
    of each run (3.2).  See End-of-Run Display section.
    
         3.  Three new branch types have been added.  "SPIKE" (code 4) 
    branches generate spikes from membrane potential via a "Schmidt trigger", 
    so that Hodgkin-Huxley branches can be linked to synapses (3.2).  "COND" 
    (code 7) branches give fixed conductances which can be modulated by second 
    messengers to simulate slow PSPs (3.2).  "CONNOR" (code 13) branches 
    specify HH-type rate constants for A-current as developed by Connor et al 
    (3.3).
    
    D.  Bugs corrected
         HH Branch line 5020 incorrectly read IF EAM(K%)=-1 ..."  It has been 
    corrected to read "IF EBM(K%)=-1 ...".  The only situation in which this 
    gave much of a problem was in voltage clamp with a hold potential of -60 
    (which is when V=-CBM) (corrected in 3.3).
    
    E.  Demonstration package for 3.2 and 3.3
         Several modules which illustrate model features are included in this 
    release (see DEMO subdirectory and SYNETDEM documentation).  Some modules 
    require SYNTEST.PSP.
    =============================================================================
                               APPENDIX I
    
    ERROR MESSAGES
    
    
    230: BAD MASTER FILE Need: x Have y
         Discrepancy in .MST file format code.  Program expects format 
         code x but found code y.
    
    360: BAD PARAMETER FILE: Need: x Have: y
         Discrepancy in .PRM file format code.
    
    465: .PRM FILE FRAMING ERROR
         Program failed to find termination sequence "0,0,END" at the
         end point in the .PRM file.  One likely cause is an
         incorrect number of parameters for one of the branch types.
    
    530: BAD PSP FILE: Need: x Have: y
            Discrepancy in .PSP file format code.
    
    680: ILLEGAL PSP TYPE
            Invalid type-code (<-1) encountered in PSP file.
    
    1520: WRONG SAVE FILE
         .PRM format code on the model-state file being loaded does not 
    correspond to the 
         current .PRM file in use.
    
    1585: SAVE FILE END ERROR
         Expected "END" not found at end of .SAV file
    
    5300: ILLEGAL BRANCH CODE CALL IN KINETICS
         An illegal branch-type code was encountered in doing update kinetics.  
    INDICATES 
         PROBABLE MODEL BUG.
    
    6190: INPUT CODE x NOT IMPLEMENTED
         An illegal branch-type code was encountered in the .PRM file.
    
    14950: TARGET-FETCH CALLED ILLEGAL BRANCH CODE x
         An illegal branch-type code was encountered while retrieving a pool-
    target parameter.
    
    14960: TARGET-FETCH INVALID TARGET PARAMETER prm OF BRANCH i INTERACTION k
         In a type k pool interaction, a legal branch type, i, was found with 
    a parameter-
         number (prm) outside the valid range for that branch.  Some 
    parameters for some of 
         the branches have not been implemented yet, but can readily be by 
    following the 
         format laid down in this section of the program.  
    
    16950: TARGET-SAVE CALLED ILLEGAL BRANCH CODE x
            See 14950
    
    16960: TARGET-SAVE ILLEGAL TARGET PARAMETER prm OF BRANCH i INTERACTION k
            See 14960
    
    =============================================================================
                                                     APPENDIX II
    
    IMPLEMENTATION NOTES
    
    A.  PROGRAM LOGIC, IN BRIEF
         The Initializations and Parameter Input Calls section does the usual 
    set-up of special constants, reading of parameter files, checking formats, 
    and printing out diagnostic information.  Branch codes, identified in the 
    program by the index J% and decoded/encoded from their ASCII form via the 
    surboutine array following location 100, direct the calling of appropriate 
    subroutines for reading in parameters and making model calculations.  The 
    Branch-data Input Loop uses a simple ON {Branch Type} GOSUB to read 
    appropriate parameters from the parameter file, keeping track of the 
    maximum index number of each branch type with the array N%(j%).  When a 
    branch-type of 0 is encountered, it should be the end of the list, in 
    which case another 0 and a string "END" is expected, or a framing error 
    has occurred.  A minor loop at 475 sets to 1 those pool volumes not set by 
    input data, to prevent later division by 0.  The PSP Shape Table Input 
    Loop tests data for PSP format.  For a tabulated PSP, (time,value) pairs 
    are read in and intermediate values at equal time increments are 
    calculated by interpolation, to be stored in the PSP table, VPSP(K%,T%).  
    For calculated PSPs, a mathematical computation of the functional form of 
    the PSP replaces the interpolation, but either way, the PSPs end up as 
    functions tabulated at intervals of the integration time step.  Voltage 
    values are initialized to resting potential, and base levels (XTARG0) for 
    targets of modulation by pools are set to the initial levels taken from 
    the parameter file.
         NETST Section: Model Run Options operates the main menu.  This is a 
    straight forward ON {Menu Selection} GOTO switch which executes the 
    selection, then returns to line 815 or 820 to clear the screen and 
    redisplay the menu.  Programming for most is uncomplicated.  For selection 
    2 (current pulse), the start and end times are requested, and the model-
    call loop includes testing of current time so that a current is applied 
    through the variable IM0(UNIT%) to compartment UNIT% during the interval.  
    Saving and restoring the model state (selections 10 and 11) involves a ON 
    {Branch Type} GOSUB switch to subroutines at 7000+NAME%*10 and 
    7500+NAME%*10 to write/read corresponding state variables to/from disk, 
    followed by a write/read of the SUMTB(J%,T%) array.  Additional conditions 
    for the model can be programmed by following the pattern set by menu 
    selections 2 and 3.  The key line to insert is:
    
                    GOSUB 1800: IF X=0 THEN GOTO 815
    
    This executes one time-increment of the model, plots results, and clears 
    any spike flags that have been set.  If you need the spike flag 
    information, use GOSUB 3000 to run the model and GOSUB 2000 to plot, deal 
    with the flags yourself, and test for X=0 to see if the sweep is finished.  
    The return to 815 clears previous disk-write modes.  Return to 820 to 
    avoid this.
         NETWRK Subroutine (at line 3000) is the heart of the model.  The 
    first part, PATCH, calculates the sum of all ionic currents (II(I%)) and 
    conductances (GI(I%)) from each branch for each compartment.  It adds the 
    currents to those from other compartments using the coupling conductances 
    GC(I%,J%) or GC(J%,I%).  Which is used is determined by the sign of the 
    voltage difference between the two compartments, hence allowing for 
    rectifying connections (line 3160).  Total currents are used to calculate 
    the change in compartment voltage, DV(k%), due to the charging of the 
    compartment's capacitance.  The second part,  Branch 2 Updates, applies 
    the membrane voltage minus the leak battery (VA(I%)) to the trigger zone 
    subroutine at 4070 and updates its state variables.  If a spike is fired, 
    the SPIKE subroutine at 4600 is called to reset trigger zone variables 
    appropriately.  The third section, PATCHI, does the updates on all of the 
    other electrical branch codes (7-13), using the ON {Code} GOSUB switch in 
    line 3400.  These call subroutines at 4000+NAME%*100 which contain 
    appropriate kinetics for each branch type.  Most of these are straight 
    forward, but special notes on some are given below.  This results in new 
    values for the conductance G(K%,J%) and the ionic current I(K%,J%) for 
    each branch K% of each code J%.  The fourth part involves producing pool 
    interactions (subroutine at 12000).  Targets are located, a minus flag 
    being used to tag a compartmental parameter as a target, and the lack of 
    the flag being used to specify a pool as a target.  The variable K is used 
    as temporary storage for the value of this target parameter.  The type of 
    operation performed is determined by the type-specifier XINTYP%, which 
    controls the GOSUB switch in line 12080.  The new value for the target 
    parameter is returned to the target variable via K.  Following this, pools 
    are updated by the Inter-pool Diffusion subroutine at location 11000, 
    which includes a type-specific pool "spring" to fill them.  Fluxes are 
    computed to and from other pools, based on the first-order rate constants 
    K(L%,K%), as well as pool "degradation" (specified by the rate constant 
    K(0,K%)), and net pool changes (DPOOL(K%)) are calculated.  Upon return, 
    compartmental voltages are incremented by DV (line 3600), pools are 
    incremented (line 3700), and pool values are printed at the top of the 
    screen.  Finally, the the current location in the transmitter summation 
    table is zeroed and the location pointer, SUMTB0%, is incremented.
         PLOTS:  Returning from the NETWRK subroutine, the PLOTS subroutine is 
    called.  First, a skip-count (SKPCNT%) is tested.  This allows skipping 
    the plotting and writing of time points to make output files more 
    manageable.  If the count is 0, a subroutine at 2200 is called which 
    writes the time on the .PRN file, then tests switch options, and plots and 
    writes appropriate variables.  Next, if any of the spike flags are set, 
    spike tics are generated, spikes are sent to the .SPK file, if 
    appropriate, and spike perturbations (vertical lines of height SPKHT) are 
    generated on the voltage plots and .PRN file. 
         Cursor-accessed display:  The final test is whether the sweep limit 
    on the screen has been exceeded, in which case the run is done, and a 
    "SWEEP COMPLETE" message is generated (line 2125).  If batch file 
    operations or multiple-run conditions pertain, the program returns for the 
    next sweep.  Otherwise, it enters the display mode loop at 2130 which 
    tests for keyboard input and interprets the ASCII codes in terms of curor 
    manipulations on the screen.  An  key returns control to the main 
    menu.
    
    B.  HODGKIN-HUXLEY BRANCHES
         The equations given by Hodgkin and Huxley (1952) for the gating 
    particles have been placed in a uniform format, specified by 5 constants, 
    a,b,c,d,e (see Code 10 description).  This form reduces to 0/0 when a=0, 
    e=-1 (i.e. for alpha-m; alpha-n) and V+c=0.  By applying l'Hospital's 
    rule, alpha = b*d at this point.  The program tests for the condition and 
    uses this alternate calculation if needed.  It should also be noted that 
    the voltage variable, V, given in the H&H paper is with respect to rest, 
    and represents outside minus inside, instead of the currently used inside 
    minus outside.  Thus for their "V", -(V+60) must be substituted, where the 
    new V is absolute membrane potential (-60 is the average squid axon 
    resting potential).
    
    C.  SYNAPTIC POTENTIALS
         Version 3 reads in each synaptic potential from the .PSP file and 
    converts it to a sequence of values at equal time increments corresponding 
    to the integration increment (TINC) in the array VPSP(K%,T%).  At run 
    time, the index K% is used to retrieve a particular shape when needed.  
    Each synapse (indexed by K%) has a PSP summation array, SUMTB(K%,L%), 
    which accumulates the transmitter released.  The array is "circular" for 
    loading or read-out, meaning that it "wraps around" and the point 
    following L%=SUMTBL% (the upper limit) is L%=0.  During a simulation, the 
    pointer variable SUMTB0% gives the starting L% index for all SUMTBs.  This 
    index is incremented by 1 each integration cycle, picking off synaptic 
    input values at progressively later times as model time increases.  When a 
    spike fires in a presynaptic unit, points from the corresponding 
    VPSP(K%,T%), scaled according to amplitude calculations, are added to 
    SUMTB, commencing at index SUMTB0%, wrapping around, and ending at 
    L%=SUMTB0-1.
    
    D.  FACILITATION
         Each spike-mediated synaptic input branch (Numerical code 11) can 
    have several facilitation pools associated with it, the number being held 
    in the variable NF%(K%) for the K%th branch.  These NF% pools are 
    represented by consecutive indices, L%, of the various facilitation 
    parameters (TAUF(L%), NF(L%), C2F(L%), C1F(L%)) and the pool variable, 
    XF(L%).  For the K%th branch, the index L% starts at FLOC%(K%).  To 
    calculate transmitter release, the facilitation pools are first calculated 
    by exponentially decaying their value after the previous spike in the 
    presynaptic unit.  These numbers are raised to the appropriate power (see 
    Hartline 1988) and all summed to give the net facilitation factor, which 
    (as 1+F) multiplies transmitter released.  Increments to each facilitation 
    pool are then calculated and the storage variable for the previous spike 
    on this input branch, TPREV(K%) is updated to the current model time (U).
    
    E.  TARGETS OF MODULATION
         Targets are specified by an integer (XTARG%()) in the parameter 
    block.  If the integer is positive, it is taken as the number of the pool 
    which is the target.  If the integer is negative, its absolute value 
    specifies a branch type code.  The particular branch number and the 
    particular parameter of that branch which will be the target are specified 
    by the additional line entries XBRN%() and XPRM%() respec- tively.  NOTE 
    THAT NOT ALL PARAMETERS ARE LEGAL TARGETS.  In particular, indices and 
    other integers are usually not.  These are recognized (by a non-standard 
    name, such as one ending if "%") and skipped over by NET2PRM in 
    calculating XPRM%.  THE APPROPRIATE TARGET PARAMETER SPECIFIER for XPRM% 
    is given following the parameter name in the Parameter File Block lists.  
    "*" targets (coupling and diffusion) are handled by special interactions 
    (Types 6 and 7).  The POOL which controls the interaction is specified by 
    XSRC%() [generated by NET2PRM from the preceding pool-definition line], 
    and the interaction type by XINTYP%() [taken from the TYPE= assignment].
    =============================================================================
                                  APPENDIX III
    
    USER-GENERATED ADDITIONS
    
    A.  ADDITION OF MAIN MENU OPTIONS
         1.  Changes in source file (SYNETSIM.3xx).  Additions to the main 
    menu can be made readily by adding selections to the NETST section 
    starting at line 1750.  Follow the format of existing selections.
         2.  Changes in NET2SBT.CNF.  To add changes made in the main menu 
    (and any sub-menus added) to the batch capability, additional lines 
    corresponding to the menu selction(s) and input parameters needed must be 
    added to this file.  Follow the examples given in the listing of the file 
    (Appendix __).
    
    B.  ADDITION OF PHYSIOLOGICAL PROPERTIES (branch codes)
         1.  Changes to source file (SYNETSIM.3xx). Intentional gaps have been 
    left in the branch coding for later additions.  Codes 17 - 19 are reserved 
    for user-generated functions.  Each new branch code must have a parameter 
    input section (lines 6160- 6589 reserved).  The input section commences 
    with the third parameter (usually the compartment assignment), since the 
    calling code reads the branch code and index.  The new code must also be 
    provided with a branch update section commencing at line 5700, 5800, or 
    5900 for codes 17, 18, and 19, respectively (accessed through the switch 
    in line 3400).  HIBR% will need to be set to the highest code number used 
    under 20 in line 53.  If the parameters of the new branch type are to be 
    modulated by pools, appropriate subroutines for accessing branch 
    parameters must be added to the FETCH BRANCH PARAMETER VIA K (line 13000 
    ff) and SET BRANCH PARAMETER FROM K (line 16000 ff) sections (follow the 
    examples already there).  If preloading and saving of state variables from 
    the new branch type are required, appropriate subroutines must be written 
    to read and write them on sequential files, starting at lines 8700, 8800, 
    and 8900 for codes 17, 18, and 19 respectively, again following the 
    existing form.  
    
         2.  Changes to NET2PRM.CNF:  For each new property added, a new 
    parameter-configuration line must be added to this file specifying the new 
    code, the names of its parameters, and their order in the parameter file.  
    Read the description of the file in Appendix V (NET2PRM Manual) and follow 
    the examples for other codes.
    
         3.  CHECKLIST for addition of branch codes to SYNETSIM:
         a.  Add NAME% to line 52
         b.  Add IF J$=NAME$ THEN J%=NAME% to line 100+NAME%.
         c.  Add ON J% GOTO .... XXX ....  to line 150
         d.  Change LOWBR% or HIBR% in line 54
         e.  Add kinetic calculations in lines 4000 + 100*NAME%
         f.  Add INPUT #1, CP%(K%, NAME%, prm1(K%), .:RETURN in 6000+NAME%*10
         g.  Add PRINT #1, vrbl1(K%), vrbl2(K%),.... :RETURN in 7000+NAME%*10
         h.  Add INPUT #1, vrbl1(K%), vrbl2(K%),.... :RETURN in 7500+NAME%*10
    
         For addition of parameters to an existing branch code, as well as 
    adding new branch codes:
    
         i.  Add a line NAME%, NAME, name-prm1, name-prm2, ...,END to 
    NET2PRM.CNF
         j.  Add ON XPRM% GOTO beginning at line 13000+NAME%*100
         k.  Add K=prm(XBRN%) line blocks in the appropriate space following
         l.  Add ON XPRM% GOTO 16x05 at line 16000+NAME%*100
              Add prm(K%) = K line blocks in the appropriate space following
    
    
                                                           APPENDIX IV
    
    NETLIST MANUAL
    
    by Greg Wolodkin
         Dept. of Electrical Engineering
         University of Maryland
         College Park, MD
    
    A.  STRUCTURE OF THE NETLIST
    Net2prm reads in a netlist containing information about a compartmental 
    structure which represents some physiological system.  The basic structure 
    consists of compartments (which make up cells) and cells (which make up 
    the network).  While an essay on compartmental modeling is certainly 
    beyond the scope of this manual, some introduction is necessary to make 
    sense of the format of the netlist.  With that in mind, the basic 
    structure is this:
    
    CELL    is the largest 'object' or structure within the netlist.
            A cell can be composed of one compartment, or many.  All        
            compartments which are listed underneath of a CELL belong 
            to that CELL.  The beginning of a cell is marked by a 
            CELL declaration line, consisting of the reserved word CELL
            as the first word on the line, followed by a cell name.  The
            cell name must be unique.  The end of a cell is marked by the
            beginning of a new cell, or the end of the netlist, whichever
            occurs first.  An example of a proper cell declaration is this:
    
            CELL PD
             .
             .
    
            which defines a cell named 'PD' and assigns any items under
            it to belong to 'PD'.
    
            The CELL structure is not used by SYNETSIM, but is rather a 
            human concern.  As we observe networks in the form of cells,
            we would like our model to also represent the various cells
            observed.
    
    CMPT    is the real building block of the compartmental model.  As
            mentioned above, cells can be constructed of one CMPT, or 
            of many.  CMPT declarations work identically to cell declarations,
            in that the beginning of a CMPT is marked by the reserved word
            "CMPT" as the first word on a line, followed by a compartment
            name.  Compartment names must be unique only within the cell.
            (Two cells could have compartments in them with matching names,
            as long as the cells had unique names themselves.)  The CMPT
            declaration must also include a parameter set, which follows
            the compartment name.  For now, we will represent the parameter
            set by the label '[parameter set]'.  Its form in the netlist will
            be discussed later.  A legal CMPT declaration would be:
    
            CMPT Soma [parameter set]
             .
             .
    
            Furthermore, to define a cell with one compartment, we could
            combine the two examples to form:
    
            CELL PD
             CMPT Soma [parameter set]
              .
              .
          
            The indentation here helps to show that the CELL is made up of
            any number of CMPTs, and the CMPT Soma as shown belongs to the 
            CELL PD.  
    
            These two structures (CELL and CMPT) allow us to build the 
            skeleton of a compartmental model.  To reference this skeleton,
            we need a naming convention.  Electrical circuits are typically
            referenced by node number, as in the circuit simulator SPICE.  
            
            In the compartmental model, each compartment is connected at
            two nodes.  One connection represents ground, and all
            compartments share a common ground.  The other connection 
            or node represents the membrane voltage, inside the membrane.
            Since the compartmental model involves dividing a length of 
            membrane into compartments, each compartment has associated 
            with it the membrane voltage for a particular segment of the
            membrane.  Thus each compartment represents a node in the 
            circuit.
    
            We have chosen to reference these nodes by name, and this name
            is formed by the combination cell/compartment.  Notice that
            each cell has a unique name, and each compartment has a unique
            name within the cell.  With this in mind, then, each node has
            a unique name.  For the example above, the node would be named
                    
                    PD/Soma
    
            Each compartment MUST have a name, and all compartments must
            belong to a cell.  Each cell MUST have a name.
    
    ELECTN  The electrical coupling of compartments is accomplished via the 
    DIODE   codes ELECTN and DIODE.  These can be pictured as resistances
            which passively connect one node to another.  This adds another
            field to our netlist form, that being the connection field. 
            A proper ELECTN declaration involves two nodes or compartments, 
            one which the ELECTN belongs to, and the other which is
            specified in the connection field.  The example below shows 
            two compartments which are connected electrotonically.
    
            CELL PD
             CMPT Soma [parameter set]
              ELECTN   [parameter set]  Axon
             
             CMPT Axon [parameter set]
              .
              .
    
            where again the [parameter set] will contain information 
            regarding the specifics of each declaration.
    
            Notice that the connection field for ELECTN above contains
            'Axon', the name of the node to which it connects.  It could
            just as well have contained 'PD/Axon', as that is the FULL
            name of the node.  Since compartment names are unique within
            a cell, however, we can omit the cellname and call it by 'Axon'.
    
            The following example has an identical effect.  
    
            CELL PD
             CMPT Soma [parameter set]
             
             CMPT Axon [parameter set]
              ELECTN   [parameter set]  Soma
              .
              .
    
            For a DIODE, which represents a rectifying connection, the 
            direction of current flow (positive ions) is always INTO the
            parent compartment, FROM the connection field.  For the ELECTN 
            or bi-directional connection, the specification is not
            important.
    
            These four structures (CELL CMPT ELECTN DIODE) are enough
            to build a passive membrane, consisting of resistances, 
            capacitances, and DC voltage sources.  Other properties 
            can be added quite easily, as described below.
    
    B. COMPONENTS WITHIN THE STRUCTURE   [to be continued]
    
    C.  CONFIGURATION FILES
    
    The .CNF files used by NET2PRM specify the names and orders for parameters 
    appearing in various input files for synetsim.  
    
    1. NET2PRM.CNF --->  contains information concerning the codes available
                         in the current version of synetsim.  
    
       - Lines which begin with a single quote ( ' ) are comments.
       - Blank lines (along with comment lines) are ignored.
    
       - The first line of the file represents the synetsim file format.
         It is of the form:
    
             SYNETSIM 3.3.2  
         
         and must match with the current version of synetsim.  The compiler
         passes this string on to any .PRM file which it creates.  Upon
         execution of synetsim, a fatal error will result if this string
         doesn't match with synetsim's internal format.  This is necessary, 
         as the .CNF file contains the order in which to pass parameters to
         the .PRM file.
    
       - All information following the first line must be of the form:
    
            CODENUMBER, CODENAME, [parameter list], END
    
          where CODENUMBER represents the number which synetsim uses to
          index codes, CODENAME represents the name of the code, 
          [parameter list] represents a series of strings, separated by
          commas, which correspond to synetsim parameters and compiler
          reserved-words.  END is used to mark the end of a parameter list,
          and the beginning of a new code definition.
    
          CODENUMBERS must go in sequence, starting with one.  
    
          Valid items in the parameter list include:
    
            PNAME   - a alphabetic string represents a parameter which is
                      to be input from the netlist.  It will be found in
                      the netlist in the form   (PNAME=34),   and the 
                      value 34 will be passed to synetsim.
    
            PNAME%  - a string ending with % indicates a value that will
                      be dependent on the structure of the netlist.  The
                      compiler keeps track of these (cmpt number, branch
                      number, etc...) and passes them to the model quietly.
                      no effort is needed on the part of the user to set
                      these "structural" parameters.  
    
             membrane t.c. = 25 msec)
    CMPT,1,1,DRIVER,  .005,-50,.2        -- Network driver neuron
    CMPT,2,2,FOLLOWER,.005,-50,.2        -- Network follower neuron
    
    Branch Type Code TRIGR (or 2):  Trigger zone parameters
    |     This trigger zone should fire a spike train with a sensitivity of 
    |     ca 8 Hz/nA, adapting to ca 70% of its original frequency with a 
    |     timeconstant of 500 msec (see Hartline 1979).
    |     
    |     K% - Branch index
    |     | CP%(K%,2) - Compartment assignment for branch
    |     | |  E0(K%) - Base excitation
    |     | |  |  TAUM0(K%) - Base level membrane time constant (sec)
    |     | |  |  |  PMTHR(K%) - Pacemaker response thresh (mV rel. to rest)
    |     | |  |  |  | KPM(K%) - PM response excitation (EX) sensitivity fctr
    |     | |  |  |  | |  TAUPM(K%) - Pacemaker response time constant (sec)
    |     | |  |  |  | |  |  KCOND(K%) - Spike conductance EX-sensitivity fctr
    |     | |  |  |  | |  |  | TAUCOND(K%) - Spike-conductance time constant
    |     | |  |  |  | |  |  | | KAR(K%) - "RP" adaptation EX-sensitivity fctr
    |     | |  |  |  | |  |  | | | TAUAR(K%) - "RP" adaptation time constant
    |     | |  |  |  | |  |  | | | |  KA1(K%) - Adapt'n 1 EX-sensitivity fctr
    |     | |  |  |  | |  |  | | | |  |   TAUA1(K%) - Adapt'n 1 t.c. (sec)
    |     | |  |  |  | |  |  | | | |  |   | KA2(K%) - Adapt'n 2 EX-sens factor
    |     | |  |  |  | |  |  | | | |  |   | | TAUA2(K%) - Adaptation 2 t.c.
    |     | |  |  |  | |  |  | | | |  |   | | |   THRINF(K%) -Thresh asymp (mV)
    |     | |  |  |  | |  |  | | | |  |   | | |   | KTHR(K%) - Thresh-EX fctr
    |     | |  |  |  | |  |  | | | |  |   | | |   | |  TAUTHR(K%) - Thresh t.c.
    |     | |  |  |  | |  |  | | | |  |   | | |   | |  |
    TRIGR,1,1, 0,.04,0,2,.25,0,0,0,0,.30,.5,0,5.8,4,0,.004
    TRIGR,2,2, 0,.04,0,2,.25,0,0,0,0,.30,.5,0,5.8,4,0,.004
    
    
     DV0(K%) - Base reset-increment in trigger-zone voltage (mV)
     |  MAXV(K%) - Maximum membrane pot'l spike-reset level (mV relative rest)
     |  | DG0(K%) - Base spike conductance increment (rest units)
     |  | | MAXG(K%) - Maximum spike conductance level (rest units)
     |  | | | DAR0(K%) - Base "RP" adaptation spike-increment (mV)
     |  | | | | MAXAR(K%) - Maximum "RP" adaptation level (mV relative to rest)
     |  | | | | |    DA10(K%) - Base adaptation 1 increment (mV)
     |  | | | | |    | MAXA1(K%) - Maximum adaptation 1 level (mV)
     |  | | | | |    | |    DA20(K%) - Base adaptation 2 increment
     |  | | | | |    | |    | MAXA2(K%) - Maximum adaptation 2 level
     |  | | | | |    | |    | |    DTHR0(K%) - Base threshold increment (mV)
     |  | | | | |    | |    | |    | MAXTHR(K%) - Maximum thresh (mV relative)
     |  | | | | |    | |    | |    | | 
    -4,-4,0,0,0,1000,0,1000,0,1000,5,5
    -4,-4,0,0,0,1000,0,1000,0,1000,5,5
    
    Type Code ELECTN (or 3): Inter-compartmental electrotonic connections
    |      These parameters provide for a rectifying electrotonic connection
    |      between cells 1 and 2 (DRIVER and FOLLOWER).  Conductance is low 
    |      (.01 umho) going from DRIVER to FOLLOWER, but large (.1 umho) in 
    |      the reverse direction.
    |      I% - Postjunctional compartment for low-resistance direction
    |      | J% - Prejunctional compartment for low-resistance direction
    |      | |  GC(I%,J%) - Coupling conductance (umho)
    |      | |  |
    ELECTN,1,2,.01
    ELECTN,2,1,.1
    
    Branch Type Code DRIVER (=8): Driver potential
    |      This parameter set gives plateau and endogenous burst properties to 
    |      the DRIVER cell, and voltage-dependent outward-currents to the
    |      FOLLOWER.  With induction of inward current (through synaptic input 
    |      from DRIVER) FOLLOWER can also generate plateaus.  In addition, 
    |      there are slow restoring conductances in both cells which decay with 
    |      a time constant of 400 msec.  
    |      K%
    |      CP%(K%,8) - Compartment assignment
    |      | | VNA(K%) - I-in reversal potential (mV, abs)
    |      | | |   GBARNA(K%) - I-in maximum conductance (umho)
    |      | | |   |   V0K(K%) - I-in half-activation voltage (mV, abs)
    |      | | |   |   |  MUNA(K%) - I-in characteristic width (mV)
    |      | | |   |   |  |  VK(K%) - I-out reversal potential (mV abs)
    |      | | |   |   |  |  |   GBARK(K%) - I-out maximum conductance (umho)
    |      | | |   |   |  |  |   |   V0K(K%) - I-out half-activation V (mV)
    |      | | |   |   |  |  |   |   |  MUK(K%) - I-out characteristic V (mV)
    |      | | |   |   |  |  |   |   |  |  GBARK1(K%) - Restoring g-max (umho)
    |      | | |   |   |  |  |   |   |  |  |   TAUK1(K%) - K1 decay t.c
    |      | | |   |   |  |  |   |   |  |  |   | GBARK2(K%)
    |      | | |   |   |  |  |   |   |  |  |   | | TAUK2(K%)
    |      | | |   |   |  |  |   |   |  |  |   | | |
    DRIVER,1,1,40,.50,-40,5,-90,.50,-40,5,.36,.4,0,1
    DRIVER,2,2,40,  0,-40,5,-90,.50,-40,5,.36,.4,0,1
    
    
    Branch Type Code HHFXD (=9): Fixed tau active HH current
    |     These parameters specify a hyperpolarization deinactivated,
    |     depolarization activated "A"-type conductance in both network cells.
    |     K%
    |     | CP%(K%,9)
    |     | |  VEQ(K%) - Active current reversal level (mV abs)
    |     | |  |  GBAR(K%) - Maximum conductance (umho)
    |     | |  |  |   QM(K%) - Activation variable (m) exponent
    |     | |  |  |   |  V0M(K%) - m half-activation voltage (mV, abs)
    |     | |  |  |   |  |  MUM(K%) - m characteristic voltage (mV)
    |     | |  |  |   |  |  |  TAUMA(K%) - m time-constant (sec)
    |     | |  |  |   |  |  |  |   QH(K%) - Inactivation variable (h) exponent
    |     | |  |  |   |  |  |  |   |  V0H(K%)
    |     | |  |  |   |  |  |  |   |  |   MUH(K%)
    |     | |  |  |   |  |  |  |   |  |   |  TAUH(K%)
    |     | |  |  |   |  |  |  |   |  |   |  |
    HHFXD,1,1,-90,100,1,-35,4,.005,1,-70,-5,.04
    HHFXD,2,2,-90,200,1,-35,4,.005,1,-70,-5,.04
    
    Branch Type Code HH (=10): Hodgkin-Huxley kinetics (in file HH.PRM)
    |  K%
    |  | CP%(K%,10)
    |  | |  VEQHH(K%) - Equilibrium potential for ion
    |  | |  |   GBARHH(K%) - Maximum conductance (umho)
    |  | |  |   |   QMHH(K%) - Exponent for activation variable
    |  | |  |   |   | QHHH(K%) - Exponent for inactivation variable
    |  | |  |   |   | |      xAM(K%)    |    xBM(K%)   |   xAH(K%)   |   xBH(K%)
    |  | |  |   |   | |   A  B C  D   E   A  B C   D  E A  B C   D  E A    B C  D  E
    |  | |  |   |   | |   |  | |  |   |   |  | |   |  | |  | |   |  | |    | |  |  |
    HH,1,1,+55,120, 3,1,0,-100,35,10,-1,4000,0,60,-18,0,70,0,60,-20,0,1000,0,30,10,1
    HH,2,1,-72, 36, 4,0,0, -10,50,10,-1, 125,0,60,-80,0
    The file HH.PRM also has the following Principal Compartment parameters:
    
            1,1,1,SQUID,.001,-49.387
    
    which corresponds to Table 3 of HH '52.  
    
    Branch Type Code SYNAPSE (=11): Conventional PSP
    |  These PSPs are all based on equal amounts of transmitter released
    |  (A0S= 0.1x Kd) with differences in intrinsic strength deriving from
    |  differences in maximum conductance (GBARS: .1 and .3 for synapses 1 
    |  and 2 respectively).  PSPs rise with 10 msec to peak (Shape 1 from the
    |  SYNTEST.PSP file; shape 2 is a slowly-rising PSP for comparison).
    |       K%
    |       | CP%(K%,11) - Postsynaptic compartment
    |       | |  VREVS(K%) - Revrsl pot'l for synaptic ionic battery (mV, abs)
    |       | |  |   GBARS(K%) - Saturation conductance level (umho)
    |       | |  |   | KDS(K%) - Dissoc. constant for xmtr-receptor binding
    |       | |  |   | | CPS%(K%) - Presynaptic compartment
    |       | |  |   | | | PSPSHP%(K%) - PSP shape index
    |       | |  |   | | | |   DLY(K%) - Synaptic delay (sec)
    |       | |  |   | | | |   |   A0S(K%) - Base peak xmtr conc (Kd units)
    |       | |  |   | | | |   |   | TAUF(FLOC%) - Facil time constant (0=none)
    |       | |  |   | | | |   |   | |
    SYNAPSE,1,2,-75,.1,1,1,1,.003,.1,0 -Synapse 1: weak inhib of FFR by DRIVER
    SYNAPSE,2,1,-75,.3,1,2,1,.003,.1,0 -Synapse 2: strong inhib of DRVR by FFR
    SYNAPSE,3,1,+50,.2,1,3,1,.003,.1,0 -Synapse 3: EPSP to DRVR from input #3.
    
    
    Branch Type Code CHEMOX (=12): Chemotonic exponential interaction
    |      Reciprocal chemotonic interactions between FOLLOWER and DRIVER
    |      are included for demonstration purposes.  They can be activated 
    |      by setting Toxin Flag CHEMOX = "U" using the Main Menu option 6.
    |      K%
    |      | CP%(K%,12) - Postsynaptic compartment
    |      | |  VREVC(K%) - Reversal potential (mV, abs)
    |      | |  |   GBARC(K%) - Saturation conductance (umho)
    |      | |  |   | KDC(K%) -  Dissoc. const. for trnsmttr (arbitrary units)
    |      | |  |   | | CPC%(K%) - Presynaptic compartment
    |      | |  |   | | | XMTR0C(K%) - Transmitter conc at 0 mV (arb. units)
    |      | |  |   | | | | MUC(K%) - Characteristic V for release curve (mV)
    |      | |  |   | | | | |
    CHEMOX,1,2,-75, 5,1,1,1,10
    CHEMOX,1,1,-75, 5,1,2,1,10
    
    Branch Type Code POOL (=20): Pool type
    |  Two types of pools are included.  The bound transmitter one (XTYPE%
    |  = 1) is proportional to synapse 1 (PPRM1: DRIVER to FOLLOWER) trans-
    |  mitter binding (proportionality constant = 1: PPRM2) and has a Kd of
    |  1 (PPRM3).  The two second messenger pools (XTYPE%=4) are synthesized 
    |  at "fixed rates", but this base rate (PPRM1) is zero (input in this 
    |  case will come from interactions and diffusion).  One (pool 2) decays 
    |  with a time constant of 1 sec (1/PPRM2), while the other (pool 3) 
    |  does not decay.
    |    K%
    |    | CP%(K%,20) - Compartment assignment
    |    | | XTYPE%(K%) - Pool type (1-4)
    |    | | |              1= Value : bound transmitter
    |    | | |              2= Filling rate : bound transmitter
    |    | | |              3= Ionic current
    |    | | |              4= Constant filling, first-order decay
    |    | | |        XNAME$(K%) - Pool name
    |    | | |        |            XVOL(K%) - Pool volume (arbitrary units)
    |    | | |        |            | XPOOL0(K%) - Base pool level
    |    | | |        |            | |             Pool:  1     2     3
    |    | | |        |            | | PPRM1(K%)        PreCpt  F     F
    |    | | |        |            | | | PPRM2(K%)        C     K     K
    |    | | |        |            | | | | PPRM3(K%)      Kd    --    --
    |    | | |        |            | | | | | PPRM4(K%)    --    --    --
    |    | | |        |            | | | | | |
    POOL,1,2,1,"BOUND TRANSMITTER",1,0,1,1,1,0  Type 1: Xpool=C*Xmtr/(Kd+Xmtr)
    POOL,2,2,4,"2ND MESSENGER A",  1,0,0,1,0,0  Type 4: dXpool/dt= F - K*Xpool
    POOL,3,2,4,"2ND MESSENGER B",  1,0,0,0,0,0  Type 4:      "        "
    
    Branch Type Code POOLK (=21): Pool Diffusion/Reaction
    |  For demonstration purposes, a bidirectional "diffusion" between
    |  pools 2 and 3, with time constant of 100 msec, can be activated by
    |  setting Toxin Flag POOLK = "U" using option 6 of the main menu.
    |     K% - Recipient pool #
    |     | L% - Source pool #
    |     | |  K(K%,L%) Diffusion/Reaction rate constant (1/sec)
    |     | |  |
    POOLK,2,3, 1
    POOLK,3,2, 1
    
    
    
    
    Branch Type Code POOLX (=22): Pool Interactions
    |  The first line sets up pool 2 as a target (XTARG%) of a "Type 5"
    |  interaction (XINTYP%) controlled by pool 1 (XSRC%).  This means 
    |  that the synthesis rate of pool 2 is proportional to the level
    |  of pool 1.  This, in effect, makes synthesis rate dependent on
    |  bound transmitter at the DRIVER to FOLLOWER synapse.  The second 
    |  line gives the maximum conductance of compartment 2, GBARNA (case 2
    |  of branch type 8, second parameter) a "Type 5" dependence on pool 2.
    |  This means that GBARNA will change according to pseudo first-order
    |  kinetics with rate constant proportional to pool 2 level.
    |     K%
    |     |  XTARG%(K%) - Target pool (if >0) or branch parameter (if <0)
    |     |  | XSRC%(K%) - Source pool exerting the interaction
    |     |  | | XINTYP%(K%) - Interaction type (1-7)
    |     |  | | |             1= Direct proportionality
    |     |  | | |             2= Steady state 2nd messenger bound to receptor
    |     |  | | |             3= Pseudo first-order kinetics
    |     |  | | |             4= Ionic battery
    |     |  | | |             5= Modulation of target synthesis rate
    |     |  | | |             6= Modulation of electrotonic connection
    |     |  | | |             7= Modulation of inter-pool diffusion
    |     |  | | |             Interaction:     1    2
    |     |  | | |  XPRM1(K%)                   C   alpha 
    |     |  | | |  | XPRM2(K%)                 --  beta
    |     |  | | |  | |  XPRM3(K%)              --   A0
    |     |  | | |  | |  | XPRM4(K%)            --   --
    |     |  | | |  | |  | | XBRN%(K%) - Target branch
    |     |  | | |  | |  | | | XPRM%(K%) - Target parameter in branch
    |     |  | | |  | |  | | | |
    POOLX,1, 2,1,5, 1,0, 0,0     Type 5: target= pool 2; dXpool/dt=C*Xpool(1)
    POOLX,2,-8,2,3,20,1,.8,0,2,2 Type 3: GBARNA=alpha*Xpool(2)
             |               | |                    *(A0-GBARNA) - beta*GBARNA
     target: Code 8 (DRIVER) | Pool 2
                             Branch #2
    0,0,END (Termination set)
    
    =============================================================================
                                                     APPENDIX VII
    
                         SPECIAL VARIABLE ASSIGNMENTS 
    
    (excluding those listed above):
    
    BIAS:           Bias current on cell, menu selection 2 (960)
    CURRENT:        Pulse stimulus magnitude, menu sel. 2 (960)
    DBGI%:          Debug loop count (1825)
    FLOC%:          Pointer to facilitation compartment array
    G(K%,J%):       Conductance of K%th branch of type J%
    GC(I%,J%):      Coupling conductance from cmpt J% to cmpt I%
    GI(I%):         Total conductance of I%th compartment
    I(K%,J%):       Current in the K%th branch of type J%
    II(I%):         Total ionic current in compartment I% (sum of all 
    branches)
    IM(I%):         Imposed external membrane current through compartment 
    I%
    IM0(I%):        Biasing offset current to compartment I%
    N%:             Total number of cells (Type 1 codes)
    N%(J%):         Tally of number of branches of code type J%
    NCODE%:         Number of branch codes (set in 60)
    NF(K%):         Number of facilitation compartments for synapse K%
    NPSP%:          Tally of number of PSP shapes
    POOLINC:        Pool increment, menu sel. 4 (1050)
    SUMTB(I%,T%+SUMTB0%):   Summed PSPs for cell I% (time point T%)
    SUMTB0%:        Starting point in SUMTB for synaptic input
    SWP%:           Sweep count, menu sel. 1 (900)
    T%:             Time index for PSP shape calculation
    TINC:           Time increment for integration (msec)
    T1,T2,T3        Special-use PSP shape variables
    U:              Time 
    UEND:           Time of end of stimulus period, menu sels. 2,3 (990 
    ff)
    UNEXT:          Time of next stimulus event, menu sels. 2,3,4 (990 ff)
    UNIT%:          Stimulated unit, menu sels. 2,3,4 (960, 1010, 1050) 
    VPSP(I%,T%)     Converted PSP shape for I%th PSP
    V1,V2,V3        Special use PSP transmitter value variables
    X:              X-axis variable for plot
    Y:              Y-axis variable for plot
    
    ***** STATE VARIABLES (SNAX name) ***************
                   (C# = code pertaining to variable)
    A1(I%):         C2 Adaptation 1 (ADPT)
    A2(I%):         C2 Adaptation 2 (ADPT2)
    AR(I%):         C2 Resting-potential adaptation (RPADPT)
    EI(I%):         C2 Current (I)
    GK1(K%):        C8 Restoring conductance 1
    GK2(K%):        C8 Restoring conductance 2
    GE(I%):         C2 External conductance (CONDCT)
    GS(I%):         C2 Spike-dependent conductance (COND)
    H(K%):          C9 Inactivation variable
    HHH(K%):        C10 Inactivation variable
    J(I%):          C2 Current excitation (CURX)
    M(K%):          C9 Activation variable
    MHH(K%):        C10 Activation variable
    P(I%):          C2 Pacemaker response (PM)
    THR(I%):        C2 Spike threshold (THR)
    TPREV(K%):      C11 Time of previous spike firing, synapse K%
    V(I%):          C1 Absolute membrane potential (ACTV + RP)
    VA(I%):         C2 active voltage from non tz sources: V - RP (ACTV)
    VM(I%):         C2 Membrane potential at trigger zone (VM)
    W(I%):          C2 Perturbation (PTB)
    XF(L%):         C11 Facilitation in f-pool L%
    XSS(I%):        C2 Excess of threshold above membrane potential (THR-
    VM)
    
    ***** FLAGS (see also Master File Format ********
    SPKFLG%(I%):    Spike-fired flag for presynaptic unit I% 
                            (=branch index for corresponding Code 2 
    branch)
    TRGFLG%:        Trigger flag: If <0, skip prefiring of spikes 
    PLTSW%(I%):     Plot switch, specifying which variables will be 
    plotted
    
    ***** TEMPORARY VARIABLES ***********************
    CHI:    C2 chi in paper (excitation less adaptation if ADPFLG=0) 
    (ETOT)
    DJ:     C2 change in current excitation (4240)
    DPG, DPH, DPL: C2 variables used in threshold-crossing correction
    DPM:    C2 change in PM (4270)
    EX:     C2 X in paper (total excitation) (ETOT$)
    GM:     C2 total membrane conductance (= GE()+GS()+1)
    PM:     C2 pacemaker response
    PMTHR:  C2 pacemaker threshold (4090)
    V:      C1 membrane potential
    XMTR:   C12 transmitter concentration (5460)
    XX:     C2 time-increment fragments for threshold crossing (4420)
    YY:     C2 see XX (4420)
    
    *****INDEX VARIABLES ****************************
    I%:     Cell #/Cmpt #/Other
    J%:     Branch type code
    K%:     Branch number
    L%:     Sub-index within a branch: facilitation, PSP time index etc
    T%:     Quantized time index: PSP input and summations
    
    ***** SCRATCH VARIABLES *************************
    A       5300
    F       5260
    G       4610
    H
    L       4380
    T       4620
    XXX     Plots
    YYY     Plots
    
    ========================================================================
                                                     APPENDIX VIII
    
              EXECUTION SPEEDS ON VARIOUS COMPUTERS
    
            Execution time (min:sec) for one sweep of SYNTEST:
    Machine                 GWBASIC         Compiled                
    Compiled
                                            (- math chip)           (+ 
    math chip)
    Zenith Z158             25:              --                     2:10
    8 MHz
    
    IBM PC/AT                                                       1:13
    8 MHz
    
    IBM AT clone            8:34            1:06
    10 MHz (Standard)
    
    Compaq 386/20                                                   0:14.5
    20 MHz
    
    ===============================================================================
    
                                                      APPENDIX IX
    SOURCE LISTING
    
    
    10 ID$ = "SYNETSIM 3.3B  8/24/90": PRINT ID$
    12 MFID$="SYNETSIM 3.3.2": PFID$="SYNETSIM 3.3.2": SFID$="SYNETSIM 3.0.2"
    14 PRINT "(C) COPYRIGHT D.K. HARTLINE 1987, 1988, 1989, 1990."
    16 PRINT "SEE SYNETSIM.TXT FOR OPERATING INSTRUCTIONS"
    18 PRINT " BRUN3087 (C) COPYRIGHT MICROSOFT CORP. 1982, 1983, 1984"
    20 PRINT "                                        1985, 1986, 1987"
    35 'NEEDS MODULATION TARGETS FOR GAMMAS
    36 '3.3B (.33B 8/21/90): Conductance AND density (gamma); color traces 
    37 '3.3A (.33A 8/3/90): Conductance density parameters
    38 '3.2D (.32D 7/9/90): Greg's changes: command line; cursor; mid-swp interrupt
    39 '     7/23 DIODE addition; 7/24 multiple clamp runs
    40 '3.2C (.32C 4/4/90): save refixed; Boolean flags; SPIKE; COND branches
    41 '3.2B (.32B 11/28/89): V-clamp version; cursor fxd; save/restore fxd; CMB3
    42 '3.2A (.32A 9/12/89): ACNLSPDPM version; String codes; Cursor; CMC12
    43 '3.1 (.Q3D 9/2/88): INNS version; minor error correction; CMC11
    44 '3.0C (.Q3C 12/25/87): IEEE version; CMC10
    45 '3.0 (.Q3B 11/87) = Original Soc Neurosci version; Numerical codes; CMC9
    47 '               ##############################################
    48 '################  INITIALIZATIONS AND PARAMETER INPUT CALLS ########
    49 '               ##############################################
    50 'GWB%=-1         'FOR GWBASIC # Branches<=3; COMMENT OUT FOR QuickBASIC
    51 CMPT%=1: TRIGR%=2: ELECTN%=3: DIODE%=4: SPIKE%=5       'BRANCH TYPE CODES
    52 COND%=7: DRIVER%=8: HHFXD%=9: HH%=10: SYNAPSE%=11: CHEMOX%=12
    53 CONNOR%=14: POOL%=20: POOLK%=21: POOLX%=22
    60 LOWBR%=7: HIBR%=14: FRCT%=10                 'CONDUCTANCE-BRANCH CODE RANGE
    65 DSPLYB%=1: D$(0)="V": D$(1)="I": D$(2)="G" 'INVARIANT DISPLAY CHARACTERS
    70 mdly=20     'seconds to elapse before continuing batch mode.
    75 NCODE%=22: IF GWB% THEN MAXBR%=3 ELSE MAXBR%=15
    80 DIM TXFLG%(NCODE%), N%(NCODE%), CP%(MAXBR%, NCODE%), G(MAXBR%, 14), I(MAXBR%, 14)
    85 FLOC%=1                    'INITIAL LOCATION FOR FACILITATION PARAMETERS
    90 RST%=-1                    'Reset to zero initial conditions every sweep
    98 GOTO 199
    99 '************** Subroutine for decoding/encoding Branch Codes ***** 100 
    IF J$="CMPT"    THEN J%=CMPT%:    GOTO 149
    102 IF J$="TRIGR"   THEN J%=TRIGR%:   GOTO 149
    103 IF J$="ELECTN"  THEN J%=ELECTN%:  GOTO 149 
    104 IF J$="DIODE"   THEN J%=DIODE%:   GOTO 149
    105 IF J$="SPIKE"   THEN J%=SPIKE%:   GOTO 149
    107 IF J$="COND"    THEN J%=COND%:    GOTO 149
    108 IF J$="DRIVER"  THEN J%=DRIVER%:  GOTO 149 
    109 IF J$="HHFXD"   THEN J%=HHFXD%:   GOTO 149 
    110 IF J$="HH"      THEN J%=HH%:      GOTO 149 
    111 IF J$="SYNAPSE" THEN J%=SYNAPSE%: GOTO 149 
    112 IF J$="CHEMOX"  THEN J%=CHEMOX%:  GOTO 149
    114 IF J$="CONNOR"  THEN J%=CONNOR%:  GOTO 149
    120 IF J$="POOL"    THEN J%=POOL%:    GOTO 149 
    121 IF J$="POOLK"   THEN J%=POOLK%:   GOTO 149 
    122 IF J$="POOLX"   THEN J%=POOLX%:   GOTO 149 
    140 J%=VAL(J$)
    149 RETURN
    150 ON J% GOTO 151,152,153,189,189,189,189,158,159,160,161,162,189,164,189,189,189,189,189,170,171,172: GOTO 189
    151 J$="CMPT":   GOTO 180                   '(Access from 1920,...
    152 J$="TRIGR":  GOTO 180
    153 J$="ELECTN": GOTO 180
    154 J$="DIODE":  GOTO 180
    155 J$="SPIKE":  GOTO 180
    157 J$="COND":   GOTO 180
    158 J$="DRIVER": GOTO 180
    159 J$="HHFXD":  GOTO 180
    160 J$="HH":     GOTO 180
    161 J$="SYNAPSE":GOTO 180
    162 J$="CHEMOX": GOTO 180
    164 J$="CONNOR": GOTO 180
    170 J$="POOL":   GOTO 180
    171 J$="POOLK":  GOTO 180
    172 J$="POOLX":  GOTO 180
    180 RETURN
    189 J$="": GOTO 180
    199 '*************** Master file input
    '----
        if command$<>"" THEN
         cm$=command$
         sp%=instr(cm$,"/")            'detect a single switch SW$
         if sp%>0 then 
          ep%=instr(sp%,cm$," ")
          if ep%=0 then ep%=len(cm$)+1
          sw$=mid$(cm$,sp%+1,ep%-sp%-1)
          cm$=left$(cm$,sp%-1)+right$(cm$,len(cm$)-ep%+1)
         end if
        end if
    
        while left$(cm$,1)=" "          'remove excess spaces fore and aft
         cm$=right$(cm$,len(cm$)-1)
        wend
        while right$(cm$,1)=" "
         cm$=left$(cm$,len(cm$)-1)
        wend
    
        if cm$<>"" then
         sp%=instr(cm$," ")
         if sp%=0 then sp%=len(cm$)+1
         cm$=left$(cm$,sp%-1)
    
         sp%=instr(cm$,".")
         if sp%=0 then sp%=len(cm$)+1
         mfile$=left$(cm$,sp%-1)
    
        else
    200 INPUT "INPUT MASTER FILE (no ext)[use  for test mode]"; MFILE$
    205 IF MFILE$ = "" THEN MFILE$ = "SYNTEST"
    
        end if
    
    210 OPEN "I", #3, MFILE$ + ".MST"           'OPEN AND PROCESS MASTER FILE
    215 INPUT #3, MTITLE$, MFIDD$, PFILE$, PSPFILE$, BAT$, XSCALE, VSCALE, ISCALE, GSCALE
    217 INPUT #3, KSCALE, PSCALE, Y0, TINC, SKIP%, PSPDM, PSPL%, SUMTBL%
    220 IF SW$="B" OR SW$="b" THEN GOTO 228
    222 IF SW$<>"" THEN PRINT "Invalid switch /";SW$;" ignored.";CHR$(7): GOTO      
    228
    224 BATFILE$=BAT$ 'save name of BAT file in case of menu#7 selection.
    226 BAT$="none"   'force model to ignore BAT file.
    228 IF BAT$<>"NONE" AND BAT$<>"none" THEN OPEN "I",#5,BAT$  ELSE BAT$="" 
    230 YSCALE=VSCALE
    232 IF GWB% THEN SUMTBL%=200: PSPL%=200
    233 '                                       'CHECK FORMATS OF DATA FILES
    234 IF MFID$<>MFIDD$ THEN PRINT "230: BAD MASTER FILE: Need: "; MFID$; " Have: "; MFIDD$: END
    236 INPUT #3, SPKHT, ADPFLG%: IF ADPFLG%<>0 THEN ADPFLG%=-1 'BOOLEAN FLAG
    240 REM         10    -1   
    250 INPUT #3, PF%,ZPF%,SPF%              'PRINT, PLOT FLAGS: ZERO, SPIKES
    252 input #3, gmode%, ncol%, zcol%, scol%, icol%, vcol% 'enhanced graphics mode
    254 if gmode%=0 or gmode%=2 then gmode%=2: scx%=639: scy%=199: GOTO 260
    256 if gmode%=9 then scx%=639: scy%=349                   'Enhanced EGA
    259 REM color 0 is black... not real desirable.
    260 if ncol%=0 then ncol%=15
    262 if zcol%=0 then zcol%=15
    264 if scol%=0 then scol%=15
    266 if icol%=0 then icol%=15
    268 if vcol%=0 then vcol%=15
    270 FOR I%=2 TO NCODE%                        '"TOXIN" BRANCH FLAGS
    272  INPUT #3, L%: IF L%<>0 THEN L%=-1
    274  TXFLG%(I%)=L%
    276  NEXT I%
    278 IF PF% THEN LPRINT ID$; " **** RUN DATE: ";DATE$;" AT ";TIME$;" ****"
    290 PRINT "MASTER FILE= "; MFILE$ + ".MST: "; MTITLE$: IF PF% THEN LPRINT "MASTER FILE= "; MFILE$ + ".MST: "; MTITLE$
    300 PRINT "TINC="; TINC; " SKIP INDEX="; SKIP%: IF PF% THEN LPRINT "TINC="; TINC; " SKIP%="; SKIP%; "PSP-DURN-MPYR="; PSPDM
    310 PRINT "ADPFLG%="; ADPFLG%
    320 IF PF% THEN LPRINT "SPKHT="; SPKHT; " ADPFLG%="; ADPFLG%
    330 GOSUB 1900                                     'PRINT FLAGS/SWITCHES
    339 '*************** Parameter file input
    340 OPEN "I", #1, PFILE$ + ".PRM"          'OPEN AND CHECK PARAMETER FILE
    350 INPUT #1, PTITLE$, PFIDD$
    360 IF PFID$ <> PFIDD$ THEN PRINT "360: BAD PARAMETER FILE: Need: "; PFID$; " Have: "; PFIDD$: END
    370 PRINT "PARAMETER FILE= "; PFILE$ + ".PRM: "; PTITLE$: IF PF% THEN LPRINT "PARAMETER FILE= "; PFILE$ + ".PRM: "; PTITLE$
    410 '***************** BRANCH-DATA INPUT LOOP *****
    420 INPUT #1, J$, K%         'BRANCH TYPE, BRANCH INDEX
    425 GOSUB 100                'DECODE BRANCH CODE
    430 IF J%=0 THEN GOTO 465    'END INPUT LIST?
    435 rem PRINT "J%=";J%,"K%=";K%
    440 IF K%>N%(J%) THEN N%(J%)=K%        'UPDATE BRANCH CODE MAX INDEX
    445 ON J% GOSUB 6010, 6020, 6030, 6040, 6050, 6060, 6070, 6080, 6090, 6100, 6110, 6120, 6130, 6140, 6150, 6160, 6170, 6180, 6190, 6200, 6210, 6220
    450 '     Code:   1     2     3     4                 7     8     9    10    11    12   13                                         20    21    22
    455 GOTO 420
    460 RETURN                             'USED FOR BLANK INDICES
    465 INPUT #1, ID$: IF ID$<>"END" THEN PRINT "465: .PRM FILE FRAMING ERROR. Code:";J$: STOP
    466 CLOSE #1
    470 N% = N%(1)
    475 FOR L% = 1 TO N%(POOL%)
    480  IF XVOL%(L%) = 0 THEN XVOL(L%) = 1
    485  NEXT L%
    490 DIM SUMTB(N%(11), SUMTBL%)    '1 SUMTB SLOT EA SYNAPSE
    495 L%=XSCALE/TINC/SKIP%+3: DIM Y(N%,L%)
    496 PRINT "Y DIM=(";N%;",";L%;")"
    500 '***************** PSP SHAPE TABLE INPUT LOOP ********
    505 IF PSPFILE$="NONE" THEN TXFLG%(SYNAPSE%)=1: GOTO 720
    510 OPEN "I", #2, PSPFILE$ + ".PSP"
    520 INPUT #2, STITLE$, SFIDD$, NPSP%: DIM VPSP(NPSP%, PSPL%)'NUMBER OF PSP SHAPES
    530 IF SFID$ <> SFIDD$ THEN PRINT "530: BAD PSP FILE: Need: "; SFID$; " Have: "; SFIDD$: END
    540 PRINT "PSP FILE= "; PSPFILE$ + ".PSP: "; STITLE$: IF PF% THEN LPRINT "PSP FILE= "; PSPFILE$ + ".PSP: "; STITLE$
    550 FOR K%=1 TO NPSP%
    560  PRINT "LOADING PSP"; K%
    570  INPUT #2, T1                      'TIME
    580  INPUT #2, V1                      'VALUE
    590  IF T1<>0 OR V1<>0 THEN IF T1>=0 THEN GOTO 570 ELSE GOTO 680'GET BEGIN
    600  T2=TINC: T%=1                     'TABULATED PSP (NOTE VPSP(K%,0)=0)
    610  INPUT #2, T3                      'TIME
    620  INPUT #2, V3                      'VALUE
    630  T3=T3*PSPDM                       'SCALE TIME BY PSPDM
    640  VPSP(K%,T%) = V1+(V3-V1)*(T2-T1)/(T3-T1)'INTERPOLATION FORMULA
    650  T%=T%+1
    660  T2=T2+TINC
    665  IF T%>PSPL% THEN GOTO 700
    670  IF T2<=T3 THEN GOTO 640
    675  T1=T3: V1=V3: GOTO 610
    680  IF T1<>-1 THEN PRINT "680: ILLEGAL PSP TYPE": STOP  'COMPUTED PSP
    685  FOR T%=0 TO PSPL%
    690   VPSP(K%,T%) = EXP(-TINC*T%/V1)   'V1 IS DECAY TIME-CONSTANT
    695   NEXT T%
    700  NEXT K%
    710 CLOSE #2
    715 '***** Initialize state variables **************
    720 FOR I%=1 TO N%: V(I%)=VLK(I%): NEXT I%            'PRELOAD V'S
    725 FOR I%=2 TO NCODE%
    726  IF N%(I%)=0 THEN TXFLG%(I%)=-1
    727  NEXT I%
    730 FOR K%=1 TO N%(POOLX%) 'BASE LEVELS FOR MODULATION TARGETS = INITIAL VALUES
    735  XTARG%=XTARG%(K%)
    740  IF XTARG%<0 THEN I%=-XTARG%: XBRN%=XBRN%(K%): XPRM%=XPRM%(K%): GOSUB 13000: XTARG0(K%) = K: GOTO 760
    750  XTARG0(K%)=XPOOL(XTARG%)
    760  NEXT K%
    765 PRINT "HIT ANY KEY TO CONTINUE";
        while inkey$=""
        wend
    770 GOTO 800
    790 RETURN    '(used by ON x GOSUB)
    793 '
    795 '               #######################################
    797 '################  NETST SECTION:  MODEL RUN OPTIONS  ####################
    799 '               #######################################
    800 U=0
    810 X=0
    812 FOR I%=1 to N%(DSPLYB%): Y(I%,0)=0: NEXT I%  'store YSCALES here later
    815 CLOSE #2: CLOSE #3: IF SF% THEN SF%=0        'RESET DISK-STORE-FLAG
    820 IF RST% THEN X=0: U=0                        'RESET U IF RESET-FLAG SET
    821 SCREEN 0: CLS
    822 IF BAT$<>"" THEN INPUT #5,MM$: GOTO 855
    825 PRINT "MAIN MENU": IF SF% THEN PRINT "(.PRN OUTPUT)" ELSE PRINT "(NO      
    827 IF DBF%<>0 THEN PRINT "DEBUG MODE ON"
    830 PRINT "  = END"
    831 PRINT "     1= FREE_RUN"
    832 PRINT "     2= I_PULSE - Current pulses to a compartment"
    833 PRINT "     3= PSP_TRAIN from presynaptic cell"
    834 PRINT "     4= Voltage clamp of a compartment"
    835 PRINT "     5= POOL_INCrement"
    836 PRINT "     6= TOXINS changed"
    837 PRINT "     7= Batch operation"
    838 PRINT "     8= CHANGE PARAMeters"
    839 PRINT "     9= OUTPUT_PRN next sweep"
    840 PRINT "    10= SAVE model state"
    841 PRINT "    11= RESTORE previous model state"
    842 PRINT "    12= CHANGE_DISPLAY variable"
    843 PRINT "    13= Options"
    850 INPUT MM$
    855 MM%=VAL(MM$)
    860 SCREEN GMODE%
    865 if gmode%=9 then color ncol%                'default text color.
    870 ON MM% GOTO 900, 925, 970, 1000, 1090, 1100, 1195, 1200, 1300, 1400, 1500, 1680, 1700
    875 IF PF% THEN LPRINT CHR$(12)
    880 CLOSE: END
    898 '
    899 '***************** 1: Network free run **************************
    900 IF BAT$<>"" THEN INPUT #5, SWEEP0%: GOTO 904
    901 INPUT "NUMBER OF SWEEPS";SWEEP0%
    904 SWP%=SWEEP0%
    905 CLS: PRINT "SWEEP=";SWEEP0%-SWP%+1;" length=";XSCALE;" sec; YSCALE=";YSCALE
    910 GOSUB 1800
    
        'mid-sweep interrupt... space bar followed by "I" for interrupt.
        i$=inkey$
        if i$=" " then
         do
          g$=inkey$
         loop while g$=""
         if g$="i" or g$="I" then
          x=0 : x%=0                      'plot positions
          swp%=0                          'force final sweep
         end if
        end if
    
    915 IF X<>0 THEN GOTO 910
    920 SWP%=SWP%-1
    922 IF SWP%<=0 THEN GOTO 815 ELSE GOTO 905
    923 '
    924 '**************** 2: Single-cell current pulses ****************
    925 PRINT "CURRENT PULSE"
    929 IF BAT$<>"" THEN INPUT #5,CPT%,BIAS,COND,UCEND,TEST,UEND: GOTO 932
    930 INPUT "COMPARTMENT, BIAS-I, COND-I, COND DURN, TEST-I, TEST DURN"; CPT%,BIAS,COND,UCEND,TEST,UEND
    932 IF CPT%=0 THEN GOTO 820
    935 IF PF% THEN LPRINT "CURRENT PULSE TO CMPT "; CPT%;" BIAS=";BIAS;" COND-I=";COND;" DURN=";UCEND;" TEST-I=";TEST;" DURN=";UEND
    940 UCEND=UCEND+U: UEND=UEND+UCEND: CLS: IM0(CPT%)=COND
    945 GOSUB 1800: IF X=0 THEN GOTO 815                       'COND PULSE
    950 IF U"" THEN INPUT #5,UNIT%, PSPF, UNEXT, UEND: GOTO 976
    975  INPUT "UNIT#, PSP RATE (HZ), START DELAY, TRAIN DURN"; UNIT%, PSPF, UNEXT, UEND
    976  UNEXT=UNEXT+U: UEND=UEND+UNEXT
    977  IF UNIT%=0 THEN GOTO 820
    980  IF PF% THEN LPRINT "UNIT# "; UNIT%; " RATE "; PSPF; " FROM "; UNEXT; " TO "; UEND
    985  CLS : TXFLG%(SYNAPSE%)=0: X=0: GOTO 995
    990  UNEXT=UNEXT+1/PSPF
    995  GOSUB 1800: IF X=0 THEN GOTO 815              '1 MODEL STEP
    996  IF U>UNEXT AND U"" THEN INPUT #5, VCMODE$: GOTO 1011
    1002 PRINT "  - RETURN
    1005 PRINT " 1 - HOLD level run"
    1007 PRINT " 2 - VC_CT: Single condition-test run"
    1008 PRINT " 3 - IV: Multiple condition-test runs with file storage"
    1010 INPUT VCMODE$
    1011 VCMODE%=VAL(VCMODE$): IVFILE$="": VCF%=-1: SWP%=0
    1012 ON VCMODE% GOTO 1015, 1030, 1040
    1013 VCF%=0: GOTO 820
    1014 ' ---------- Hold run ---------------
    1015 IF BAT$<>"" THEN INPUT #5,CPT%,HOLD,SWEEP0%,LOD$: GOTO 1019
    1016 INPUT "COMPARTMENT, HOLD-V, # HOLD SWEEPS"; CPT%,HOLD,SWEEP0%
    1017 IF CPT%=0 THEN GOTO 1000
    1018 INPUT "SAVE TO FILE";LOD$
    1019 IF PF% THEN LPRINT "VCLAMP OF CMPT "; CPT%;" HOLD=";HOLD;" FOR ";SWEEP0%;"SWEEPS; SAVED TO: ";LOD$
    1020 U=0: X=0: X%=0: VC=HOLD: V(CPT%)=VC: SWEEP%=SWEEP0%: SWP%=2     '(FLG)
    1022 IF SWEEP%>0 THEN GOTO 1024 ELSE IF LOD$<>"" OR LOD$<>"NONE" THEN GOSUB 1410: GOTO 1000 ELSE GOTO 1000
    1024 CLS: PRINT "SWEEP";SWEEP0%-SWEEP%+1;" length=";XSCALE;"sec";"ISCALE=";ISCALE;"YSCALE=";YSCALE: GOSUB 1800
    1026 GOSUB 1800: IF X<>0 THEN GOTO 1026
    1028 SWEEP%=SWEEP%-1: GOTO 1022
    1029 ' ------------ Single C-T paradigm --------
    1030 IF BAT$<>"" THEN INPUT #5,CPT%,COND0,UCEND,TEST0,UEND,HOLD: GOTO 1035
    1032 INPUT "COMPARTMENT TO CLAMP, COND-V, COND DURN, TEST-V, TEST DURN, HOLD-V"; CPT%,COND,UCEND,TEST,UEND,HOLD
    1035 IF PF% THEN LPRINT "CMPT= ";CPT%;" COND-V=";COND;" DURN=";UCEND;"TEST-V=";TEST;" DURN=";UEND;" HOLD-V=";HOLD
    1037 CLS: SWP%=1: UEND=UEND+UCEND: GOSUB 1070: CLS: GOTO 1000
    1039 ' ------------ Multiple C-T paradigm ---------
    1040 IF BAT$<>"" THEN INPUT #5,CPT%,COND0,UCEND,DCOND,NCOND%,TEST0,UEND,DTEST,NTEST%,LOD$,IVFILE$: GOTO 1045
    1041 INPUT "COMPARTMENT TO CLAMP, INITIAL COND-V, COND DURN, COND-INC, #-COND";CPT%,COND0,UCEND,DCOND,NCOND%
    1042 INPUT "INITIAL TEST-V, SAMPLE TIME, TEST-INC, #-TEST"; TEST0,UEND,DTEST,NTEST%
    1044 INPUT ".SAV-FILE NAME (incl ext), STORAGE FILE NAME (or 'NONE')";LOD$,IVFILE$
    1045 IF IVFILE$<>"NONE" AND IVFILE$<>"none" THEN OPEN "O",#4,IVFILE$: PRINT#4,CHR$(34);IVFILE$;" from ";LOD$;" using ";PFILE$;CHR$(34);CPT%;UCEND;UEND
    1047 SWP%=2
    1048 IF PF% THEN LPRINT "MULTIPLE CT RUN TO COMPARTMENT";CPT%;
    1050 IF PF% THEN LPRINT " COND-V0=";COND0;"COND-DUR=";UCEND;"COND-STEP=";DCOND;"NCOND=";NCOND%;
    1051 IF PF% THEN LPRINT "TEST-V0=";TEST0;"SAMPLE TIME=";UEND;"TEST_STEP=";DTEST;"#-TEST=";NTEST%
    1052 IF PF% THEN LPRINT ".SAV FILE=";LOD$;" IV-FILE=";IVFILE$
    1054 UEND=UEND+UCEND
    1055 CLS: COND=COND0: TEST=TEST0
    1056 FOR VCNT1%=1 TO NCOND%
    1057  FOR VCNT2%=1 TO NTEST%
    1058   GOSUB 1515: GOSUB 1070   'RESTORE INITIAL STATE & OUTPUT PULSE SEQ
    1060   IF IVFILE$<>"NONE" AND IVFILE$<>"none" THEN PRINT #4, COND,TEST,II(CPT%)-IM(CPT%)
    1061   TEST=TEST+DTEST
    1062   NEXT VCNT2%
    1064  COND=COND+DCOND: TEST=TEST0
    1066  NEXT VCNT1%
    1067 CLOSE #4
    1068 IF BAT$="" THEN GOSUB 2100: CLS: GOTO 1000 ELSE CLS: GOTO 1000
    1069 '----------- Output of 1 C-T episode -------------
    1070 X=0: U=0: X%=0: VC=COND: V(CPT%)=VC
    1071 CLS: LOCATE 1,1: PRINT "COND=";COND;" TEST=";TEST;" HOLD=";HOLD;"   "
    1072 GOSUB 1800: IF X=0 THEN PRINT "PREMATURE END": SWP%=0: RETURN 'COND 
    1076 IF U"" THEN INPUT #5,CPT%,POOLINC: GOTO 1092
    1091 INPUT "POOL#, INCREMENT"; CPT%, POOLINC
    1092 IF CPT%=0 THEN GOTO 820
    1094 IF PF% THEN LPRINT "POOL INCREMENT IN POOL "; CPT%; " BY"; POOLINC
    1096 XPOOL(CPT%)=XPOOL(CPT%)+POOLINC
    1098 GOTO 815
    1099 '**************** 6: Toxin selection ****************************
    1100 IF BAT$<>"" THEN INPUT #5, J%,TXFLG%(J%): PRINT "TOXIN:";J%;TXFLG%(J%):GOTO 820
    1101 PRINT "UNBLOCKED CODES: ";
    1102 FOR J%=2 TO NCODE%
    1104  IF NOT TXFLG%(J%) THEN GOSUB 150: PRINT J$;" ";
    1105  NEXT J%: PRINT
    1110 INPUT "TOXIN (TRIGR, ELECTN, HH, etc.):";J$: IF J$="" THEN GOTO 820
    1112 GOSUB 100
    1115 IF TXFLG%(J%) THEN PRINT "BLOCKED: ";  ELSE PRINT "UNBLOCKED: ";
    1120 INPUT "INPUT 'U' TO UNBLOCK, 'B' TO BLOCK";TXFLG$
    1122 IF TXFLG$="b" OR TXFLG$="B" THEN TXFLG%(J%)=-1: GOTO 1125
    1123 IF TXFLG$="u" OR TXFLG$="U" THEN TXFLG%(J%)=0 ELSE PRINT "BAD RESPONSE": GOTO 1120
    1125 IF PF% THEN LPRINT "TOXIN "; J$; "= "; TXFLG$
    1130 GOTO 820
    1194 '*********** 7: **************
    1195 IF BAT$ <>"" THEN BAT$="": CLOSE #5: GOTO 820  'Turn off batch mode if on
    1196 PRINT "BATCH FILE (";BATFILE$;")"; : INPUT BAT$ : IF BAT$="" THEN BAT$=BATFILE$
    1197 OPEN "I", #5, BAT$
    1198 GOTO 820
    1199 '**************** 8: Change parameters *************************
    1200 IF BAT$<>"" THEN INPUT #5,J$,XBRN%,XPRM%: GOTO 1205
    1201 INPUT "CHANGE PARAMETER: BRANCH TYPE, BRANCH #, PARAMETER #";J$,XBRN%,XPRM%
    1203 IF J$="" THEN GOTO 820
    1205 GOSUB 100 : I% = J%
    1210 IF J%=ELECTN% THEN K=GC(XBRN%,XPRM%): GOTO 1250   'CODES ELECTN & POOLK SPECIAL
    1230 IF J%=POOLK% THEN K=K(XBRN%,XPRM%): GOTO 1250
    1240 GOSUB 13000: IF ER% THEN GOTO 1290             'FETCH PARAMETER IN K
    1250 PRINT "OLD VALUE =";K;
    1252 IF BAT$<>"" THEN INPUT #5,K ELSE INPUT "NEW VALUE =";K
    1255 IF PF% THEN LPRINT "PARAMETER ";:LPRINT J$;: LPRINT USING "## ";XBRN%;XPRM%;: LPRINT " NEW VALUE=";K
    1260 IF J%=ELECTN% THEN GC(XBRN%,XPRM%)=K: GOTO 820
    1270 IF J%=POOLK% THEN K(XBRN%,XPRM%)=K: GOTO 820
    1280 GOSUB 16000                                 'SAVE NEW VALUE
    1290 IF ER% THEN ER%=0: INPUT " TYPE ANY KEY";A$
    1295 GOTO 820
    1298 '
    1299 '****************  9: Output file set-up subroutine *************
    1300 IF BAT$<>"" THEN INPUT #5,OFILE$: SF%=-1: GOTO 1325
    1305 IF SF% THEN SF%=0: GOTO 820 ELSE SF%=-1     'TOGGLE DISK OUTPUT FLAG
    1310 IF SF% THEN INPUT "OUTPUT FILE NAME (no .EXT)"; OFILE$
    1320 IF OFILE$ = "" THEN SF%=0: GOTO 820
    1325 OPEN "O",#2, OFILE$+".PRN": IF PF% THEN LPRINT "OUTPUT FILES: "; OFILE$; ".PRN+.SPK"
    1330 OPEN "O", #3, OFILE$ + ".SPK"
    1335 IF PF% THEN LPRINT "OUTPUT START TIME =";U
    1340 GOTO 820
    1398 '
    1399 '**************** 10: Save state ********************************
    1400 IF BAT$<>"" THEN INPUT #5,LOD$: GOTO 1405
    1401 INPUT "SAVE STATE AS FILE"; LOD$: IF LOD$ = "" THEN GOTO 820
    1405 GOSUB 1410: GOTO 820
    1409 '----------------- Subroutine entry (from 1022) ----------
    1410 OPEN "O", #1, LOD$: LOD0$=LOD$
    1412 PRINT #1, CHR$(34); PFILE$; CHR$(34); ",";    '.PRM FILE NAME
    1415 PRINT #1, U; SUMTB0%
    1420 FOR I%=1 TO N%: PRINT#1, V(I%);: NEXT I%: PRINT#1, ""  ' SAVE CMPT V'S
    1425 FOR J% = 1 TO HIBR%                              'SAVE STATE VARIABLES
    1430  IF J% = TRIGR% THEN GOTO 1460
    1435  IF N%(J%)=0 THEN GOTO 1460
    1440  FOR K% = 1 TO N%(J%)
    1445   IF CP%(K%, J%) = 0 THEN GOTO 1455
    1447   PRINT #1, J%; K%;
    1450   ON J% GOSUB 7010,7020,7030,7040,7050,7060,7070,7080,7090,7100,7110,7120,7130,7140,7150,7160,7170,7180,7190,7200,7210,7220
    1453   PRINT #1, ""
    1455  NEXT K%
    1460 NEXT J%
    1462 IF N%(POOL%)=0 THEN GOTO 1464
    1463 FOR K%=1 TO N%(POOL%): PRINT #1,"POOL,";K%;",";XPOOL(K%): NEXT K%  'SAVE POOLS
    1464 PRINT#1,"0,0"                                            'BLOCK TERM.
    1465 IF N%(SPIKE%)=0 THEN GOTO 1475
    1470 FOR K%=1 TO N%(SPIKE%):PRINT#1,REFR%(K%);:NEXT K%:PRINT #1,"" 'SPIKE REFRs
    1475 IF N%(SYNAPSE%)=0 THEN GOTO 1490
    1478 FOR J%=1 TO N%(SYNAPSE%)                                  'SAVE PSP'S
    1480  FOR T%=0 TO SUMTBL%
    1482   PRINT #1, SUMTB(J%, T%);
    1484   NEXT T%: PRINT #1, ""
    1486  NEXT J%
    1490 PRINT#1,"END": CLOSE #1
    1495 RETURN
    1499 '**************** 11: Restore state variables *****
    1500 IF BAT$<>"" THEN INPUT #5, LOD$: GOTO 1507
    1501 PRINT "RESTORE FROM FILE (default=";LOD0$;: INPUT "):";LOD$ 
    1505 IF LOD$ = "" THEN LOD$=LOD0$
    1507 LOD0$=LOD$: IF LOD$="NONE" THEN GOTO 820
    1510 GOSUB 1515
    1513 GOTO 820
    1514 '----------- Restore subroutine entry (called by 1057 and 1510) ------
    1515 OPEN "I", #1, LOD$
    1518 INPUT #1, PFILEE$
    1520 IF PFILEE$ <> PFILE$ THEN PRINT "1520: WRONG SAVE FILE":CLOSE #1:LOD$ = "": return
    1525 INPUT #1, U, SUMTB0%
    1530 FOR I%=1 TO N%: INPUT#1, V(I%): NEXT I%     'COMPARTMENT VOLTAGES
    1535 INPUT #1, J%, K%                            'BRANCH TYPE, BRANCH INDEX
    1540 IF J%=0 THEN GOTO 1560
    1545 ON J% GOSUB 7510,7520,7530,7540,7550,7560,7570,7580,7590,7600,7610,7620,7630,7640,7650,7660,7670,7680,7690,7700,7710,7720
    1550 GOTO 1535
    1560 IF N%(SPIKE%)=0 THEN GOTO 1570
    1565 FOR K%=1 TO N%(SPIKE%): INPUT#1, REFR%(K%): NEXT K%   'LOAD SPIKE REFR%s
    1570 IF N%(SYNAPSE%)=0 THEN GOTO 1585
    1572 FOR J%=1 TO N%(SYNAPSE%)                              'LOAD PSP'S
    1574  FOR T%=0 TO SUMTBL%
    1576   INPUT #1, SUMTB(J%, T%)
    1578   NEXT T%
    1580  NEXT J%
    1585 INPUT#1, A$: IF A$<>"END" THEN PRINT "1585: SAVE FILE END ERROR"
    1590 CLOSE #1
    1595 RETURN
    1598 '****************** 12: Display-parameter handling *****
    1599 '  (accessed by 1696 and 2220)
    1600 ON DSPLYB% GOTO 
    1610,1620,1679,1679,1679,1679,1679,1630,1640,1650,1660,1665
    1605 IF DSPLYB%=20 THEN Y=POOL(K%): YSCALE=PSCALE: RETURN ELSE PRINT "BAD BRANCH REQ:";DSPLYB%: RETURN
    1610 ON DSPLYV% GOTO 1613,1614                                'CMPT
    1612 Y=V(K%): YSCALE=VSCALE
         IF VCF% AND K%=CPT% THEN           'Voltage clamp shows current
          Y=II(K%)-IM(K%)                   'in clamped compartment.
          YSCALE=ISCALE
          PCOL%=ICOL%
          RETURN
         ELSE
          PCOL%=VCOL%
          RETURN  'if DSPLYV%=0, display voltage
         END IF
    1613 Y=II(K%): YSCALE=ISCALE: RETURN
    1614 Y=GI(K%): YSCALE=GSCALE: RETURN
    1620 ON DSPLYV% GOTO 1622,1623,1624,1625,1626,1627,1628       'TRIGR
    1621 GOTO 1679
    1622 Y=I(K%,TRIGR%): YSCALE=ISCALE: RETURN
    1623 Y=G(K%,TRIGR%): YSCALE=GSCALE: RETURN
    1624 Y=VM(K%): YSCALE=VSCALE: RETURN
    1625 Y=EX(K%): YSCALE=VSCALE: RETURN
    1626 Y=W(K%): YSCALE=VSCALE: RETURN
    1627 Y=P(K%): YSCALE=VSCALE: RETURN
    1628 Y=THR(K%): YSCALE=VSCALE: RETURN
    1630 ON DSPLYV% GOTO 1632,1633,1634,1635,1636,1637           'DRIVER
    1631 GOTO 1679
    1632 Y=I(K%,DRIVER%): YSCALE=ISCALE: RETURN
    1633 Y=G(K%,DRIVER%): YSCALE=GSCALE: RETURN
    1634 Y=GNA(K%): YSCALE=GSCALE: RETURN
    1635 Y=GK(K%): YSCALE=GSCALE: RETURN
    1636 Y=GK1(K%): YSCALE=GSCALE: RETURN
    1637 Y=GK2(K%):SCALE=GSCALE: RETURN
    1640 ON DSPLYV%  GOTO 1642,1643,1644,1645                     'HHFXD
    1641 GOTO 1679
    1642 Y=I(K%,HHFXD%): YSCALE=ISCALE: RETURN
    1643 Y=G(K%,HHFXD%): YSCALE=ISCALE: RETURN
    1644 Y=M(K%): YSCALE=1: RETURN
    1645 Y=H(K%): YSCALE=1: RETURN
    1650 ON DSPLYV% GOTO 1652,1653,1654,1655,1656,1657,1658,1659  'HH
    1651 GOTO 1679
    1652 Y=I(K%,HH%): YSCALE=ISCALE: RETURN
    1653 Y=G(K%,HH%): YSCALE=GSCALE: RETURN
    1654 Y=MHH(K%): YSCALE=1: RETURN
    1655 Y=ALPHAM(K%): YSCALE=KSCALE: RETURN
    1656 Y=BETAM(K%): YSCALE=KSCALE: RETURN
    1657 Y=HHH(K%): YSCALE=1: RETURN
    1658 Y=ALPHAH(K%): YSCALE=KSCALE: RETURN
    1659 Y=BETAH(K%): YSCALE=KSCALE: RETURN
    1660 ON DSPLYV% GOTO 1662,1663                                'SYNAPSE
    1661 GOTO 1679
    1662 Y=I(K%,SYNAPSE%): YSCALE=ISCALE: RETURN
    1663 Y=G(K%,SYNAPSE%): YSCALE=GSCALE: RETURN
    1665 ON DSPLYV% GOTO 1667,1668                                'CHEMOX
    1666 GOTO 1679
    1667 Y=I(K%,CHEMOX%): YSCALE=ISCALE: RETURN
    1668 Y=G(K%,CHEMOX%): YSCALE=GSCALE: RETURN
    1679 PRINT "BAD DISPLAY PARAMETER REQUEST: BRANCH=";DSPLYB%;" PARAMETER=";DSPLYV%: RETURN
    1680 IF BAT$<>"" THEN INPUT #5,DSPLYP%,DSPLYV%,Y0: GOTO 820
    1681 INPUT "BRANCH-TYPE TO DISPLAY (CMPT, TRIGR, DRIVER, HHFXD, HH, SYNAPSE); OFFSET";J$,Y0
    1682 GOSUB 100 : DSPLYB%=J% : ON DSPLYB% GOTO 
    1683,1684,1697,1697,1697,1697,1688,1689,1690,1691,1692
    1683 J%=2: GOTO 1695                                           'CMPT
    1684 D$(3)="VM": D$(4)="EX": D$(5)="W": D$(6)="P": D$(7)="THR": J%=7: GOTO 
    1695 'TRIGR
    1688 D$(3)="GNA": D$(4)="GK": D$(5)="GK1": D$(6)="GK2": J%=6:GOTO 1695 'DRIVER
    1689 D$(3)="M": D$(4)="H": J%=4: GOTO 1695                       'HHFXD
    1690 D$(3)="ALPHAM": D$(4)="BETAM": D$(5)="ALPHAH": D$(6)="BETAH": J%=6: GOTO 1695 'HH
    1691 J%=2: GOTO 1695                                             'SYNAPSE
    1692 J%=2: GOTO 1695                                             'CHEMOX
    1695 PRINT J$;: FOR I%=1 TO J%: PRINT USING "; ##=";I%;: PRINT D$(I%);: NEXT I%: INPUT DSPLYV%
    1696 GOSUB 1600 : GOTO 820
    1697 PRINT "ILLEGAL BRANCH TYPE": GOTO 1680
    1699 '**************** 13: Options *********
    1700 IF BAT$<>"" THEN INPUT #5, OM%,J%: GOTO 1760 ELSE PRINT "OPTIONS MENU"
    1701 PRINT "  1=TIME RESET: Change U-variable reset flag"
    1702 PRINT "  2=BELL: Turn bell on/off"
    1703 PRINT "  3=ZERO-PLOT: Turn plot on/off"
    1704 PRINT "  4=SPIKE-TIC: Turn on/off"
    1705 PRINT "  5=Y_OFFSET: new value"
    1706 PRINT "  6=DEBUG_MODE: turn on/off" 
    1707 PRINT "  7=PRINT protocol flag on/off"
    1710 INPUT OM%
    1711 ON OM% GOTO 1722,1724,1726,1728,1730,1732,1734
    1719 '---
    1722 IF RST% THEN A$="ON" ELSE A$="OFF"
    1723 PRINT "U-RESET IS ";A$;C$="; NEW STATUS (ON/OFF)": GOTO 1750
    1724 IF BLF% THEN A$="ON" ELSE A$="OFF"
    1725 PRINT "BELL IS ";A$;"; NEW STATUS (ON/OFF)": GOTO 1750
    1726 IF ZPF% THEN A$="ON" ELSE A$="OFF"
    1727 PRINT "ZERO-PLOT IS ";A$;"; NEW STATUS (ON/OFF)": GOTO 1750
    1728 IF SPF% THEN A$="ON" ELSE A$="OFF"
    1729 PRINT "SPIKE-PLOT IS ";A$;"; NEW STATUS (ON/OFF)": GOTO 1750
    1730 PRINT "Y0=";Y0;"; NEW Y0": GOTO 1750
    1732 IF DBF% THEN A$="ON" ELSE A$="OFF"
    1733 PRINT "DEBUG FLAG IS ";A$;"; NEW STATUS (ON/OFF)": GOTO 1750
    1734 IF PF% THEN A$="ON" ELSE A$="OFF"
    1735 PRINT "PLOT FLAG IS ";A$;"; NEW STATUS (ON/OFF)": GOTO 1750
    1749 '---
    1750 INPUT A$
    1755 IF A$="ON" OR A$="on" THEN J%=-1 ELSE J%=0
    1759 '--- (BAT$ reentry)
    1760 ON OM% GOTO 1762,1764,1766,1768,1770,1772: GOTO 820
    1762 RST%=J%: GOTO 820
    1764 BLF%=J%: GOTO 820
    1766 ZPF%=J%: GOTO 820
    1768 SPF%=J%: GOTO 820
    1770 Y0=VAL(A$): GOTO 820
    1772 DBF%=J%: IF BAT$<>"" THEN INPUT #5,DBGI%: ELSE INPUT "DEBUG ITERATIONS:";DBGI%: GOTO 820
    1773 GOTO 820
    1774 PF%=J%: GOTO 820
    1799 '**************** ONE TIME INCREMENT OF MODEL *******
    1800 GOSUB 3000: IF VCF% THEN V(CPT%)=VC        'KINETIC CALCULATIONS
    1805 GOSUB 2000                                 'PLOTS
    1810 FOR I%=1 TO NSPF%: SPKFLG%(I%)=0: NEXT I%  'CLEAR SPIKE FLAGS
    1820 if inkey$=chr$(27) then end
    1830 RETURN
    1899 '**************** Flag/Switch print-out subroutine ***********
    1900 PRINT "UNBLOCKED BRANCH TYPES: "; :IF PF% THEN LPRINT "UNBLOCKED BRANCH TYPES: ";
    1910 FOR J%=2 TO NCODE%
    1920  IF NOT TXFLG%(J%) THEN GOSUB 150: PRINT J$;" ";: IF PF% THEN LPRINT J$;" ";
    1930  NEXT J%: PRINT : IF PF% THEN LPRINT
    1940 J%=DSPLYB%: GOSUB 150
    1950 PRINT "DISPLAY/WRITE BRANCH-TYPE & VARIABLE:";J$;"/";D$(DSPLYV%)
    1960 IF SF% AND PF% THEN LPRINT ".PRN FILE COLUMNS (Branch-type & variable):";J$;"/";D$(DSPLYV%)
    1990 RETURN
    1995 '                      ###############
    1996 '#######################     PLOTS   #####
    1997 '                      ###############
    2000 SKPCNT%=SKPCNT%+1: IF SKPCNT%=SKIP% THEN SKPCNT%=0
    2005 IF SKPCNT%=0 THEN GOSUB 2200                   'PLOT EVERY SKIPCOUNT
    2015 IF N%(TRIGR%)=0 OR TXFLG%(TRIGR%) THEN GOTO 2050
    2020 FOR I%=1 TO N%(TRIGR%)                            'PLOT TRIGR SPIKES
    2025  J%=CP%(I%,TRIGR%)
    2030  IF SPKFLG%(I%) THEN LINE (XXX, J%*(SCY%+1)/(N%+1)) - (XXX, 5+J%*(SCY%+1)/(N%+1)),scol%
    2035  IF SPKFLG%(I%) AND SF% THEN PRINT #3, I%; X 'WRITE TIME TO .SPK FILE
    2040  IF SPKFLG%(I%) AND SPF% THEN V(J%)=V(J%)+SPKHT: GOSUB 2200: V(J%)=V(J%)-SPKHT: GOSUB 2200: X%=X%-2
    2045  NEXT I%
    2050 IF N%(SPIKE%)=0 OR TXFLG%(SPIKE%) THEN GOTO 2075  'PLOT CODE SPIKE% SPIKES
    2055 FOR I%=1 TO N%(SPIKE%)
    2060  J%=CP%(I%,SPIKE%)
    2065  IF SPKFLG%(SPF%(I%)) AND SPF% THEN V(J%)=V(J%)+SPKHT: GOSUB 2200: V(J%)=V(J%)-SPKHT: GOSUB 2200: X%=X%-2
    2070  NEXT I%
    2075 IF N%(POOL%)=0 THEN GOTO 2080
    2076 LOCATE 1,1: PRINT USING "T= ##.### ";U;
    2077 FOR K%=1 TO N%(POOL%): PRINT "POOL(";K%;:PRINT USING ")= ##.#####";XPOOL(K%);: NEXT K%: PRINT "         "
    3078 PRINT "          ";: FOR K%=1 TO N%(POOLX%): PRINT "TARG(";K%;:PRINT USING ")= ##.###; ";TARG(K%);: NEXT K%: PRINT "     "
    
    2080 U= U+TINC: X=X+TINC                          'INCREMENT MODEL TIME
    2085 IF X1 THEN RETURN  'ABORT END-OF-RUN DSPLY ON MULTIPLE SWPS
         if bat$<>"" THEN
          locate 24,1
          print "Press any key to display cursor.";
          st=timer
          foo%=0
          do
           ft=timer
           A$=inkey$
           if A$<>"" THEN           'go to cursor display if keypress
             locate 24,1
             print space$(40);
             foo%=-1
           end if
           if (ft-st)>mdly then RETURN       'RETURN if too much time
          loop while not foo%                     'elapses
         end if
    2096 IF BLF% THEN PRINT CHR$(7);CHR$(7);CHR$(7);CHR$(7);
    2099 '**************** End-of-run cursor-accessed display **************
    2100 I%=1: XXX=0: YYY=0: F%=2: M%=1: XF%=1: YF=0   'F%,M%=FIXED,MVBL CURSORS
    2105 for k% = 1 to n%(dsplyb%)                'load appropriate Yscales.
          gosub 1600
          yscale(k%) = YSCALE
          pcol%(k%) = pcol%
         next k%
    2109 locate 24,1: print space$(79);: locate 24,1
    
    2110 PRINT "SWEEP COMPLETE:                                      TO MAIN MENU";
    2130 A$ = INKEY$                              'Key-based cursor read-out mode
    2135 IF A$ = "" THEN GOTO 2130                'I%= Trace#; X%= TimePoint#
    2137 A$=RIGHT$(A$,1)                          'Lop off possible space character
    2138 A%=ASC(A$)
    2140 IF A%=5  OR A%=72 THEN I%=I%-1: IF I%<1 THEN I%=1: GOTO 2170 ELSE GOTO 
    2170  'ctrl-E or up arrow
    2141 IF A%=73 THEN I%=1: GOTO 2170
    2142 IF A%=24 OR A%=80 THEN I%=I%+1: IF I%>N%(DSPLYB%) THEN I%=N%(DSPLYB%): GOTO 2170 ELSE GOTO 2170   'ctrl-X or down arrow
    2143 IF A%=81 THEN I%=N%(DSPLYB%): GOTO 2170
    2144 IF A%=19 OR A%=75 THEN X%=X%-1: IF X%<0  THEN X%=0:  GOTO 2170 'Ctl-S or Left arrow
    2146 IF A%=4  OR A%=77 THEN X%=X%+1: IF X%>XSCALE/TINC THEN X%=XSCALE/TINC: GOTO 2170 'Ctl-D or Right arrow
    2148 IF A%=1  OR A%=115 THEN X%=X%-XSCALE/TINC/SKIP%/FRCT%: IF X%<1 THEN X%=0: GOTO 2170 'Ctl-A or Ctl-left-arrow
    2150 IF A%=6  OR A%=116 THEN X%=X%+XSCALE/TINC/SKIP%/FRCT%: IF X%>XSCALE/TINC/SKIP% THEN X%=XSCALE/TINC/SKIP%: GOTO 2170 'Ctl-F or Ctl-right-arrow
    2152 IF A%=27 THEN X=0: X%=0: GOTO 2195            ' TO RETURN
    2154 IF A%=71 THEN X%=0                  'Ctl-Left arrow
    2156 IF A%=79 THEN X%=XSCALE/TINC/SKIP%  'Ctl-Right arrow
    2158 IF A%=22 OR A%=82 THEN SWAP X%,XF%: SWAP F%,M%: SWAP Y,YF: GOTO 2172 'Ctl-V or Ins
    2160 IF A%=48 THEN FRCT%=FRCT%*10        '0
    2161 IF A%=49 THEN FRCT%=2               '1
    2162 IF A%=50 THEN FRCT%=5               '2
    2163 IF A%=51 THEN FRCT%=10              '3
    2164 IF A%=52 THEN FRCT%=20              '4
    2165 IF A%=53 THEN FRCT%=50              '5
    2166 IF A%=54 THEN FRCT%=100             '6
    2167 IF A%=55 THEN FRCT%=200             '7
    2168 IF A%=56 THEN FRCT%=500             '8
    2169 IF A%=57 THEN FRCT%=1000            '9
    2170 yscale = yscale(I%)                 'restore stored YSCALE
    2172 LINE (XXX, YYY-5*M%)-(XXX, YYY+5*M%),0: PSET (XXX,YYY),pcol%  'Erase old line (not pt)
    2173 X=(X%-1)*TINC*SKIP%: Y=Y(I%,X%)+Y0
    2175 XXX= X*SCX%/XSCALE: YYY= I%*(SCY%+1)/(N%+1) - Y*SCY%/YSCALE
    2177 LINE (XXX, YYY-5*M%) - (XXX, YYY+5*M%)
    2180 LOCATE M%,1: PRINT USING "T= ###.#### ";U-XSCALE+X;: PRINT T$;": ";D$(DSPLYV%);: PRINT USING " ####.## ";Y-Y0;
    2182 LOCATE 1,40: PRINT USING "DELTA-T= ###.#### ";SKIP%*TINC*ABS(X%-XF%);: IF X%<>XF% THEN PRINT USING "1/DELTA-T= ####.##     ";1/(TINC*ABS(X%-XF%)*SKIP%);
    2184 LOCATE 2,40: PRINT USING "DELTA-Y= ####.## ";ABS(Y-YF);
    2185 GOTO 2130
    2195 RETURN
    2198 '******* Display variable retrieval, file output, and plot-call *****
    2200 IF SF% THEN PRINT #2, U;             'WRITE TIME VALUE ON DISK
    
         if zpf% then                         'plot zero line before..avoid
          for k%=1 to n%(dsplyb%)             'overwriting important stuff
           pset(XXX+1,(SCY%+1)*K%/(n%(dsplyb%)+1)),zcol%  'with a zero-line.
          next k%
         end if
    
    2210 FOR K%=1 TO N%(DSPLYB%)         'DISPLAY FOR EACH OCCURRENCE OF VRBL
    2220  GOSUB 1600                          'GET DISPLAY VARIABLE VALUE
    2230  Y(K%,X%)=Y                          'PLACE IN DISPLAY BUFFER
    2240  IF SF% THEN PRINT #2, Y;            'WRITE VARIABLE VALUE ON DISK
    2250  GOSUB 2300                          'PLOT
    2260 NEXT K%
    2270 X%=X%+1
    2290 IF SF% THEN PRINT #2, ""
    2295 RETURN
    2298 '**************** Plot subroutines ***************************
    2300 if pcol%=0 then pcol%=ncol%    'use default color if none is specified.
    2305 XXX= X*SCX%/XSCALE: YYY= K%*(SCY%+1)/(N%+1) - (Y+Y0)*SCY%/YSCALE     'NORMAL PLOT
    2310 PSET (XXX, YYY),pcol%
    2330 RETURN
         ' 2400 not used.
    2400 LINE (XXX, YYY)-(XXX, (SCY%+1)-I%*50 - (Y+Y0+SPKHT)*SCY%/YSCALE),scol%  'SPIKE PLOT
    2410 RETURN
    2991 '
    2993 '                        #######################
    2995 '#########################  NETWRK SUBROUTINE  #####
    2997 '                        #######################
    3000 TRGFLG% = 0
    3009 '##################################
    3010 '# PATCH: SUM ALL BRANCH CURRENTS #
    3011 '##################################
    3020 FOR I% = 1 TO N%: GOSUB 4010: NEXT I%   'CURRENT FROM PRINCIPAL CMPT
    3030 FOR J% = LOWBR% TO HIBR%           'STEP THROUGH ALL BRANCH CODES (>lowbr)
    3040  IF N%(J%)=0 OR TXFLG%(J%) THEN GOTO 3100    'SKIP VACANT & BLOCKED BRNCHS
    3050  FOR K% = 1 TO N%(J%)
    3060   I% = CP%(K%, J%): IF I% = 0 THEN GOTO 3100 'SET I% TO CMPT #
    3070   II(I%) = II(I%) + I(K%, J%)      'SUM COMPARTMENT CURRENTS FROM EA BRNCH
    3080   GI(I%) = GI(I%) + G(K%, J%)      'SUM CONDUCTANCES FROM EACH BRANCH
    3090   NEXT K%
    3100  NEXT J%
    3110 FOR I% = 1 TO N%                   'SUM I FROM OTHER CMPTS
    3120  IM(I%) = IM0(I%)+INJ(I%)          'I FROM STIM + POOL-INJECTED
    3125  IF TXFLG%(ELECTN%) THEN GOTO 3180
    3130  FOR J% = 1 TO N%
    3140   IF J% = I% THEN GOTO 3170
    3150   IF GC(I%, J%) = 0 AND GC(J%, I%) = 0 THEN GOTO 3170
    3160   IM(I%)=IM(I%) - (V(J%)>V(I%))*(V(J%)-V(I%))*GC(I%,J%) - (V(J%)<=V(I%))*(V(J%)-V(I%))*GC(J%,I%)
    3170   NEXT J%
    3180  NEXT I%
    3190 FOR I%=1 TO N%                   'CHARGE CAPACITANCE
    3200  DV(I%)=(IM(I%)-II(I%))*TINC/C(I%)
    3210  IF DBF% <> 0 THEN PRINT "3210: PATCH: I%="; I%; "II="; II(I%); " GI="; GI(I%); " DV="; DV(I%); "V="; V(I%)
    3220  NEXT I%
    3228 '########################
    3230 '# TRIGR BRANCH UPDATES #   TRIGGER ZONE KINETICS AND SPIKES
    3232 '########################
    3240 IF TXFLG%(TRIGR%) GOTO 3300
    3250 FOR I%=1 TO N%(TRIGR%)
    3260  VA(I%) = V(CP%(I%,TRIGR%))-VLK(CP%(I%,TRIGR%))
    3270  GOSUB 4070                'TRIGR
    3280  IF NOT SPKFLG%(I%) THEN GOTO 3295
    3290  GOSUB 4590                'SPIKE
    3295  NEXT I%
    3296 '########################
    3297 '# SPIKE BRANCH UPDATES #
    3298 '########################
    3300 IF TXFLG%(SPIKE%) THEN GOTO 3360
    3310 FOR I%=1 TO N%(SPIKE%)           'SET SPKFLG% IF V JUST CROSSED ONTHR
    3320  IF V(CP%(I%,SPIKE%))>ONTHR(I%) AND NOT REFR%(I%) THEN SPKFLG%(SPKF%(I%))=-1: REFR%(I%)=-1
    3340  IF V(CP%(I%,SPIKE%))SUMTBL% THEN SUMTB0%= 1    'STROBE SUMTB
    3950 RETURN                                     'END OF NETWRK SUBRTN
    
    
    
    
    3992 '
    3993 '               ########################################
    3994 '################  SUBROUTINES FOR BRANCH-TYPE UPDATES #####
    3995 '               ########################################
    3996 ' Subroutines to compute branch conductances, G(K%,J%), and
    3997 ' ionic currents, I(K%,J%), from state variables, then update
    3998 ' the variables with their assigned kinetics.
    3999 '
    4000 '******************** CODE CMPT: PRINCIPAL CELL CMPT *****
    4010 II(I%) = GL(I%)*(V(I%)-VLK(I%)): GI(I%) = GL(I%)
    4020 IF DBF% <> 0 THEN PRINT "4020: CODE 1: I%="; I%
    4030 RETURN
    4040 '
    4050 '******************** CODE TRIGR: TRIGGER ZONE BRANCH *******
    4060 'DESTROYS V,PMTHR,GM,DPM,DPG,DPL,DPH,XX,YY
    4070 IF TXFLG%(TRIGR%)  THEN RETURN
    4090 V = VM(I%): PMTHR = PMTHR(I%): PM = P(I%)
    4100 IF DBF% <> 0 THEN PRINT "4100: I%="; I%; "VM="; VM(I%); "THR="; THR(I%)
    4110 IF NOT TRGFLG% THEN GOTO 4130   'TRGFLG% TRUE CAUSES ANTIDROMIC RESETS
    4120 IF SPKFLG%(I%) OR V>THR(I%) THEN GOSUB 4590: SPKFLG%(I%)=0
    4130 XSS(I%) = THR(I%) - V
    4140 GM = GE(I%) + GS(I%) + 1   'GS()=COND (Spike); GE()=CONDCT (Active)
    4150 TAU = TAUM0(I%) / GM
    4160 EX(I%) = E0(I%) + (VA(I%)+EI(I%)-A1(I%)-A2(I%)-AR(I%))/GM: EX=EX(I%)
    4170 CHI=E0(I%) + (VA(I%)+EI(I%)+(NOT ADPFLG%)*(A1(I%)+A2(I%)+AR(I%)))/GM
    4180 '
    4190 '********* Perturbation calculation **********
    4200 W(I%) = W(I%) - W(I%) * TINC / TAU
    4210 '
    4220 '********* Current Contrib Calculation *******
    4230 'IF CURFLG% THEN DJ=(EI(I%)/GM-J(I%))*TINC/TAU: J(I%)=J(I%)+DJ: GOTO 
    4280 'V2.4 RELIC
    4240 DJ = EI(I%) - J(I%): W(I%) = W(I%) - DJ
    4250 J(I%) = EI(I%)
    4260 '
    4270 '********* PM Potential **********************
    4280 DPM = (EX - PMTHR) * KPM(I%)
    4290 IF DPM < 0 THEN DPM = 0
    4300 DPM = DPM - PM
    4310 IF DPM < 0 THEN TAUPM = TAU ELSE TAUPM = TAUPM(I%)
    4320 DPM = DPM * TINC / TAUPM: DPL = -P(I%) * TINC / TAU
    4330 '******* FINAL VOLTAGE & PM DET WITH COMP FOR MID-TINC PMTHR XING
    4340 IF V <= PMTHR THEN DPG = DPM: DPH = DPL ELSE DPG = DPL: DPH = DPM
    4350 P(I%) = P(I%) + DPG
    4360 VM(I%) = EX(I%) + P(I%) + W(I%) + DJ
    4370 IF TAUAR(I%) <> 0 THEN VM(I%) = VM(I%) - (KAR(I%) * CHI - AR(I%)) * TINC / TAUAR(I%)
    4380 L = VM(I%) - PMTHR
    4390 IF V = PMTHR THEN IF L <= 0 THEN GOTO 4470 ELSE GOTO 4410
    4400 IF (PMTHR - V) * L < 0 THEN GOTO 4470           'IF CROSSING, FIX VM
    4410 IF VM(I%) = V THEN GOTO 4470
    4420 XX=DPG*DPL/(VM(I%)-V): YY=DPH*DPL/(VM(I%)-V)    'FRACTIONAL POST-XING TINC
    4430 VM(I%) = VM(I%) - XX + YY
    4440 P(I%) = PM - XX + YY
    4450 '
    4460 '********* Exponential Decays ****************
    4470 IF TAUCOND(I%) <> 0 THEN GS(I%) = GS(I%) + (CHI * KCOND(I%) - GS(I%)) * TINC / TAUCOND(I%)
    4480 IF GS(I%) <= -1 THEN GS(I%) = -1
    4490 IF TAUAR(I%) <> 0 THEN AR(I%) = AR(I%) + (CHI * KAR(I%) - AR(I%)) * TINC / TAUAR(I%)
    4500 IF TAUA1(I%) <> 0 THEN A1(I%) = A1(I%) + (CHI * KA1(I%) - A1(I%)) * TINC / TAUA1(I%)
    4510 IF TAUA2(I%) <> 0 THEN A2(I%) = A2(I%) + (CHI * KA2(I%) - A2(I%)) * TINC / TAUA2(I%)
    4520 IF TAUTHR(I%) <> 0 THEN THR(I%) = THR(I%) + (CHI * KTHR(I%) - THR(I%) + THRINF(I%)) * TINC / TAUTHR(I%)
    4530 '
    4540 '********* Test for Spike Conditions *********
    4550 IF VM(I%)>THR(I%) THEN SPKFLG%(I%)=-1
    4560 RETURN
    4570 '
    4580 '****************** SPIKE ********************
    4590 'Requires I% set to cell #
    4600 GOTO 4655                         'PATCH AROUND QUANTIZATION CORRN
    4605 G = THR(I%)-VM(I%): IF G>0 THEN GOTO 4630
    4610 T = XSS(I%)-THR(I%)+VM(I%)
    4615 T = XSS(I%)-G: IF T=0 THEN GOTO 4635
    4620 T = G/T: IF T>=0 THEN GOTO 4630    'FRACTIONAL INTERVAL OVERSHOOT
    4625 IF T >=-1 THEN GOTO 4635           'T MUST BE >=-1
    4630 T = 0
    4635 T = T*TINC: TINC0=TINC: TINC=T     'SPI.2
    4640 TRGFLG% = 0                        'DISARM SPIKE FIRING
    4645 IF T = 0 THEN GOTO 4655
    4650 GOSUB 4070                         'TRIGR (Run backwards to thr xing)
    4655 P(I%) = 0
    4660 IF MAXG(I%)<>0 THEN GS(I%)=GS(I%)+DG0(I%)*(MAXG(I%)-GS(I%))/MAXG(I%) ELSE GS(I%) = GS(I%) * DG0(I%)'IF MAX=0, IS FLAG FOR % SCALING
    4665 IF MAXAR(I%)<>0 THEN DAR=DAR(I%)*(MAXAR(I%)-AR(I%))/MAXAR(I%) ELSE DAR=(DAR(I%)-1)*AR(I%)
    4670 AR(I%) = AR(I%)+DAR                '(NEED DAR LATER TOO)
    4675 IF MAXA1(I%)<>0 THEN A1(I%)=A1(I%)+DA1(I%)*(MAXA1(I%)-A1(I%))/MAXA1(I%) ELSE A1(I%)=A1(I%)*DA1(I%)
    4680 IF MAXA2(I%)<>0 THEN A2(I%)=A2(I%)+DA2(I%)*(MAXA2(I%)-A2(I%))/MAXA2(I%) ELSE A2(I%) = A2(I%)*DA2(I%)
    4685 IF MAXTHR(I%)<>0 THEN THR(I%)=THR(I%)+DTHR(I%)*(MAXTHR(I%)-THR(I%)+THRINF(I%))/MAXTHR(I%) ELSE THR(I%)=THRINF(I%)+(THR(I%)-THRINF(I%))*DTHR(I%)
    4690 IF MAXV(I%)<>0 THEN VM(I%)=VM(I%)+DV0(I%)*(MAXV(I%)-VM(I%))/MAXV(I%)-DAR ELSE VM(I%)=VM(I%)*DV0(I%)-DAR
    4695 W(I%)=VM(I%)-E0(I%)-(VA(I%)+EI(I%)-AR(I%)-A1(I%)-A2(I%))/GM
    4696 RETURN
    4698 '
    4699 'COND: ************** CODE 7: FIXED CONDUCTANCE BRANCH *****
    4700 I(K%, COND%) = G(K%, COND%)*(V(I%)-VCOND(K%))
    4710 RETURN
    4797 '
    4798 'DRIVER: ************ CODE 8: DRIVER POTENTIAL BRANCH *****
    4800 IF MUNA(K%)<>0 THEN GNA(K%)=GBARNA(K%)/(1+EXP((V0NA(K%)-V(I%))/MUNA(K%)))
    4810 IF MUK(K%)<>0 THEN ACTK=1/(1+EXP((V0K(K%)-V(I%))/MUK(K%))) ELSE ACTK=0
    4820 GK(K%)=GBARK(K%)*ACTK
    4830 IF TAUK1(K%)<>0 THEN GK1(K%)=GK1(K%)+(GBARK1(K%)*ACTK-GK1(K%))*TINC/TAUK1(K%)
    4840 IF TAUK2(K%)<>0 THEN GK2(K%)=GK2(K%)+(GBARK2(K%)*ACTK-GK2(K%))*TINC/TAUK2(K%)
    4850 GKTOT(K%)=GK(K%)+GK1(K%)+GK2(K%)
    4860 I(K%,DRIVER%)=GNA(K%)*(V(I%)-VNA(K%))+GKTOT(K%)*(V(I%)-VK(K%))
    4870 G(K%,DRIVER%)=GNA(K%)+GKTOT(K%)
    4880 IF DBF%<>0 THEN PRINT "4880: CODE 8: K%=";K%;" G=";G(K%, DRIVER%);" I="; I(K%, 8); " GK="; GK(K%); " GNA="; GNA(K%)
    4890 RETURN
    4898 '
    4899 'ICALC: ************* CODE 9: FIXED TAU HH BRANCH *****
    4900 IF QM(K%)=0 THEN M(K%)=1: GOTO 4930
    4910 MINF = 1/(1+EXP((V0M(K%)-V(I%))/MUM(K%)))
    4920 M(K%) = M(K%)+(MINF-M(K%))*TINC/TAUMA(K%)
    4930 IF QH(K%)=0 THEN H(K%)=1: GOTO 4960
    4940 HINF = 1/(1+EXP((V0H(K%)-V(I%))/MUH(K%)))
    4950 H(K%) = H(K%)+(HINF-H(K%))*TINC/TAUH(K%)
    4960 G(K%, HHFXD%) = GBAR(K%)*(M(K%)^QM(K%))*(H(K%)^QH(K%))
    4970 I(K%, HHFXD%) = G(K%, HHFXD%)*(V(I%)-VEQ(K%))
    4980 IF DBF%<>0 THEN PRINT "4980: CODE 9: K%="; K%; " G="; G(K%, HHFXD%); " I="; I(K%, 9); " M="; M(K%);" MINF=";MINF; "H="; H(K%);" HINF=";HINF
    4990 RETURN
    4998 '
    4999 'HH: **************** CODE 10: FULL HH BRANCH *****
    5000 IF QMHH(K%)=0 THEN MHH(K%)=1: GOTO 5040
    5010 IF EAM(K%)=-1 AND V(I%)=-CAM(K%) THEN ALPHAM(K%)=BAM(K%)*DAM(K%) ELSE ALPHAM(K%)=(AAM(K%)+BAM(K%)*(V(I%)+CAM(K%)))/(EXP(-(V(I%)+CAM(K%))/DAM(K%))+EAM(K%))
    5020 IF EBM(K%)=-1 AND V(I%)=-CBM(K%) THEN BETAM(K%)= BBM(K%)*DBM(K%) ELSE BETAM(K%) =(ABM(K%)+BBM(K%)*(V(I%)+CBM(K%)))/(EXP(-(V(I%)+CBM(K%))/DBM(K%))+EBM(K%))
    5030 MHH(K%)=MHH(K%)+(ALPHAM(K%)*(1-MHH(K%))-BETAM(K%)*MHH(K%))*KTEMP(K%)*TINC
    5040 IF QHHH(K%)=0 THEN HHH(K%)=1: GOTO 5080
    5050 IF EAH(K%)=-1 AND V(I%)=-CAH(K%) THEN ALPHAH(K%)=AAH(K%)*DAH(K%) ELSE ALPHAH(K%)=(AAH(K%)+BAH(K%)*(V(I%)+CAH(K%)))/(EXP(-(V(I%)+CAH(K%))/DAH(K%))+EAH(K%))
    5060 IF EBH(K%)=-1 AND V(I%)=-CBH(K%) THEN BETAH(K%)= BBH(K%)*DBH(K%) ELSE BETAH(K%) =(ABH(K%)+BBH(K%)*(V(I%)+CBH(K%)))/(EXP(-(V(I%)+CBH(K%))/DBH(K%))+EBH(K%))
    5070 HHH(K%) = HHH(K%)+(ALPHAH(K%)*(1-HHH(K%))-BETAH(K%)*HHH(K%))*KTEMP(K%)*TINC
    5080 G(K%,HH%) = GBARHH(K%)*(MHH(K%)^QMHH(K%))*(HHH(K%)^QHHH(K%))
    5085 I(K%,HH%) = G(K%,HH%)*(V(I%)-VEQHH(K%))
    5090 IF DBF% <> 0 THEN PRINT "5090: CODE 10: K%="; K%; " G="; G(K%, HH%); " I="; I(K%, 10); " AM="; ALPHAM(K%); " BM="; BETAM(K%); " AH="; ALPHAH(K%); " BH="; BETAH(K%)
    5095 RETURN
    5097 '
    5098 'SYNAPSE: *********** CODE 11: SYNAPTIC INPUT BRANCH ********************
    5189 '(destroys A; F; L%; LL%)
    5100 XMTR=SUMTB(K%,SUMTB0%): G(K%,SYNAPSE%)=GBARS(K%)*XMTR/(KDS(K%)+XMTR)'G FROM BINDING EQ
    5105 I(K%,SYNAPSE%)=G(K%,SYNAPSE%)*(V(CP%(K%,SYNAPSE%))-VREVS(K%))
    5110 IF DBF%<>0 THEN PRINT "5110: CODE 11: K%=";K%;" G=";G(K%,SYNAPSE%);"I=";I(K%,SYNAPSE%)
    5115 IF NOT SPKFLG%(CPS%(K%)) THEN RETURN
    5120 F=0                                'CLEAR FACILITATION
    5122 IF NF%(K%)=0 THEN GOTO 5135        'IF NO FACIL, GOTO PSP
    5124 FOR L%=FLOC%(K%) TO FLOC%(K%)+NF%(K%)-1
    5126  XF(L%) = 1+(XF(L%)-1)*EXP((TPREV(K%)-T)/TAUF(L%))
    5128  F = F+XF(L%)^NF(L%)-1
    5130  XF(L%) = XF(L%)+C1F(L%)-C2F(L%)*XF(L%)
    5132  NEXT L%
    5135 TPREV(K%)=U: T%=0
    5140 A = A0S(K%)*(1+F)              'TRANSMITTER RELEASE SCALED UP BY FACIL
    5145 LL% = SUMTB0%+INT(DLY(K%)/TINC)'START PSP SUMMATION AT POINTER + DELAY
    5150 IF LL%>=SUMTBL% THEN LL% = LL%-SUMTBL%
    5155 FOR L%=LL% TO SUMTBL%          'CARRY SUM TO END OF SUMTB ...
    5160  SUMTB(K%,L%) = SUMTB(K%,L%)+A*VPSP(PSPSHP%(K%),T%)
    5165  T% = T%+1: IF T%>PSPL% THEN GOTO 5195
    5170  NEXT L%
    5175 IF LL% = 0 THEN GOTO 5195
    5180 FOR L% = 0 TO LL%-1              '... THEN WRAP AROUND TO BEGINNING
    5185  SUMTB(K%, L%) = SUMTB(K%,L%)+A*VPSP(PSPSHP%(K%),T%)
    5187  T% = T%+1: IF T%>PSPL% THEN GOTO 5195
    5190  NEXT L%
    5193 IF DBF%<>0 THEN PRINT "5193: SPIKE IN UNIT";CPS%(K%);" AMPL=";A
    5195 RETURN
    5198 '
    5199 'CHEMOX: ************ CODE 12: EXPONENTIAL CHEMOTONIC INPUT BRANCH  
    5200 IF KS(K%)=0 THEN S(K%)=S0(K%)*EXP(V(CPC%(K%))/MUC(K%)): GOTO 5250
    5210 S(K%)=S(K%) + S0(K%)*EXP(V(CPC%(K%))/MUC(K%))*TINC - KS(K%)*S(K%)*TINC
    5250 G(K%,CHEMOX%) = GBARC(K%)*S(K%)/(KDC(K%)+S(K%))
    5260 I(K%,CHEMOX%) = G(K%,CHEMOX%)*(V(I%)-VREVC(K%))
    5270 IF DBF%<>0 THEN PRINT "5230: CODE CHEMOX: K%="; K%; " G="; G(K%,CHEMOX%); " I="; I(K%, CHEMOX%); " CPC%="; CPC%(K%); " V(PRE)=";V(CPC%(K%)); " XMTR="; XMTR
    5280 RETURN
    5290 '            ************************************************
    5291 '            * LINES 5300 - 5900 RESERVED FOR CODES 13 - 19 *
    5292 '            ************************************************
    5300 L%=5300: GOTO 5990    'Code 13
    5399 'CONNOR: ****** CODE 14: MODIFIED HH KINETICS (Connor et al 1977)
    5400 IF QMC(K%)=0 THEN MC(K%)=1: GOTO 5430
    5410 MCINF = (MCA(K%)*EXP((V(I%)+MCB(K%))/MCC(K%))/(1+EXP((V(I%)-V0MC(K%))/MUMC(K%))))^(1/QMC(K%))
    5415 TAUMC(K%)= TMC0(K%)+TMCA(K%)/(1+EXP((V(I%)-V0TM(K%))/MUTM(K%)))
    5420 MC(K%) = MC(K%)+(MCINF-MC(K%))*KTEMPC(K%)*TINC/TAUMC(K%)
    5430 IF QHC(K%)=0 THEN HC(K%)=1: GOTO 5460
    5440 HCINF = 1/(1+EXP((V(I%)-V0HC(K%))/MUHC(K%)))^QHC(K%)
    5445 TAUHC(K%)=THC0(K%)+THCA(K%)/(1+EXP((V(I%)-V0TH(K%))/MUTH(K%)))
    5450 HC(K%) = HC(K%)+(HCINF-HC(K%))*KTEMPC(K%)*TINC/TAUHC(K%)
    5460 G(K%, CONNOR%) = GBARCON(K%)*(MC(K%)^QMC(K%))*HC(K%)
    5470 I(K%, CONNOR%) = G(K%, CONNOR%)*(V(I%)-VEQC(K%))
    5490 RETURN
    5500 L%=5500: GOTO 5990    'Code 15
    5600 L%=5600: GOTO 5990    'Code 16
    5700 L%=5700: GOTO 5990    'Code 17
    5800 L%=5800: GOTO 5990    'Code 18
    5900 L%=5900: GOTO 5990    'Code 19
    5990 PRINT L%;": ILLEGAL BRANCH CODE CALL IN KINETICS"
    5991 RETURN
    5992 '
    5993 '              ###########################################
    5994 '###############  SUBROUTINES FOR BRANCH PARAMETER INPUT #####
    5995 '              ###########################################
    5996 ' Subroutines to read branch parameters from the Parameter File, PFILE$
    5997 ' Entries at 6000 + 10x where x=Code#
    5998 '******************* CODE CMPT (1): INPUT OF PRINCIPAL CMPT PARAMS 
    5999 '8 file entries per branch; g (in umho) = gdens (mmho/uf) * C (uf) * 1000
    6010 INPUT #1, CELL%(K%), CELL$(K%), C(K%), VLK(K%), GL(K%), GAMMA
    6011 IF GL(K%)=0 THEN GL(K%)=GAMMA*C(K%)*1000   
    6012 RETURN
    6018 '******************* CODE TRIGR (2): INPUT OF TRIGR PARAMETERS *****
    6019 '31 file entries per branch
    6020 INPUT #1, CP%(K%, TRIGR%), E0(K%), TAUM0(K%), PMTHR(K%), KPM(K%), TAUPM(K%), KCOND(K%)
    6021 INPUT #1, TAUCOND(K%), KAR(K%), TAUAR(K%), KA1(K%), TAUA1(K%)
    6022 INPUT #1, KA2(K%), TAUA2(K%), THRINF(K%), KTHR(K%), TAUTHR(K%), DV0(K%)
    6023 INPUT #1, MAXV(K%), DG0(K%), MAXG(K%), GAMMA, DAR0(K%), MAXAR(K%)
    6024 INPUT #1, DA10(K%), MAXA1(K%), DA20(K%), MAXA2(K%), DTHR0(K%), MAXTHR(K%)
    6025 THR(K%) = THRINF(K%): IF K%>NSPF% THEN NSPF%=K%      'UPDATE # SPK FLGS
    6026 IF MAXG(K%)=0 THEN MAXG(K%)=GAMMA*C(CP%(K%,TRIGR%))*1000: DG0(K%)=DG0(K%)*C(CP%(K%,TRIGR%))*1000
    6028 RETURN
    6029 '***************** CODE ELECTN (3): COMPARTMENT COUPLING CONDUCTANCES 
    6030 INPUT #1, I%, GC(K%,I%): IF K%=I% THEN PRINT "ILLEGAL COUPLING"
    6031 GC(I%,K%) = GC(K%,I%)
    6032 RETURN
    6039 '***************** CODE DIODE (4): COMPARTMENT COUPLING CONDUCTANCES 
    6040 INPUT #1, I%, GC(K%,I%): IF K%=I% THEN PRINT "ILLEGAL COUPLING"
    6042 RETURN
    6049 '***************** CODE SPIKE (5): VOLTAGE-TRIGGERED SPIKE ***
    6050 INPUT #1, CP%(K%,SPIKE%), SPKF%(K%), ONTHR(K%), OFFTHR%(K%)
    6051 IF SPKF%(K%)>NSPF% THEN NSPF%=SPKF%(K%)
    6052 RETURN
    6059 '***************** CODE UNDEFINED (6) **********
    6060 GOTO 6190    'Code 6
    6069 '***************** CODE COND (7): FIXED CONDUCTANCE AND BATTERY *****
    6070 INPUT #1, CP%(K%,COND%), VCOND(K%), G(K%, COND%), GAMMA
    6071 IF G(K%,COND%)=0 THEN G(K%,COND%)=GAMMA*C(CP%(K%,COND%))*1000
    6072 RETURN
    6079 '***************** CODE DRIVER (8): INPUT DRIVER POTENTIAL PARAMETERS 
    6080 INPUT #1, CP%(K%, DRIVER%), VNA(K%), GBARNA(K%), GAMMA, V0NA(K%), MUNA(K%)
    6081 INPUT #1, VK(K%), GBARK(K%), GAMMAK, V0K(K%), MUK(K%)
    6082 INPUT #1, GBARK1(K%), GAMMAK1, TAUK1(K%), GBARK2(K%), GAMMAK2, TAUK2(K%)
    6083 IF GBARNA(K%)=0 THEN GBARNA(K%) = GAMMA*C(CP%(K%,DRIVER%))*1000
    6084 IF GBARK(K%)=0  THEN GBARK(K%)  = GAMMAK*C(CP%(K%,DRIVER%))*1000
    6085 IF GBARK1(K%)=0 THEN GBARK1(K%) = GAMMAK1*C(CP%(K%,DRIVER%))*1000
    6086 IF GBARK2(K%)=0 THEN GBARK2(K%) = GAMMAK2*C(CP%(K%,DRIVER%))*1000
    6087 RETURN
    6089 '***************** CODE HHFXD (9): INPUT OF FIXED TAU HH PARAMETERS 
    6090 INPUT #1, CP%(K%, HHFXD%), VEQ(K%), GBAR(K%), GAMMA
    6091 INPUT #1, QM(K%), V0M(K%), MUM(K%), TAUMA(K%)
    6092 INPUT #1, QH(K%), V0H(K%), MUH(K%), TAUH(K%)
    6093 IF GBAR(K%)=0 THEN GBAR(K%)=GAMMA*C(CP%(K%,HHFXD%))*1000
    6094 RETURN
    6099 '***************** CODE HH(10): INPUT OF FULL HH BRANCH PARAMETERS 
    6100 INPUT #1, CP%(K%, HH%), VEQHH(K%), GBARHH(K%), GAMMA
    6101 INPUT #1, KTEMP(K%), QMHH(K%), QHHH(K%)
    6102 INPUT #1, AAM(K%), BAM(K%), CAM(K%), DAM(K%), EAM(K%)
    6103 INPUT #1, ABM(K%), BBM(K%), CBM(K%), DBM(K%), EBM(K%)
    6105 INPUT #1, AAH(K%), BAH(K%), CAH(K%), DAH(K%), EAH(K%)
    6106 INPUT #1, ABH(K%), BBH(K%), CBH(K%), DBH(K%), EBH(K%)
    6107 IF GBARHH(K%)=0 THEN GBARHH(K%)=GAMMA*C(CP%(K%,HH%))*1000 
    6108 RETURN
    6109 '************ CODE SYNAPSE (11): INPUT OF CONVENTIONAL PSP PARAMETERS 
    6110 INPUT #1, CP%(K%,SYNAPSE%),VREVS(K%),GBARS(K%), GAMMA, KDS(K%),CPS%(K%)
    6111 INPUT #1, PSPSHP%(K%),DLY(K%),A0S(K%)
    6112 INPUT #1, TAUF(FLOC%): IF TAUF(FLOC%) = 0 THEN GOTO 6116  'CHK FOR FACIL
    6113 FLOC%(K%) = FLOC%
    6114 INPUT #1, NF(FLOC%), C2F(FLOC%), C1F(FLOC%)
    6115 FLOC% = FLOC%+1: GOTO 6111
    6116 IF CPS%(K%)>NSPF% THEN NSPF%=CPS%(K%) 'KEEP TRACK OF HIGHEST SPIKE FLAG
    6117 IF GBARS(K%)=0 THEN GBARS(K%)=GAMMA*C(CP%(K%,SYNAPSE%))*1000
    6118 RETURN
    6119 '***************** CODE CHEMOX (12): INPUT OF CHEMOTONIC (EXP) PARAMS 
    6120 INPUT #1, CP%(K%,CHEMOX%),VREVC(K%),GBARC(K%),GAMMA,KDC(K%)
    6121 INPUT #1, CPC%(K%),S0(K%),MUC(K%),KS(K%)
    6122 IF GBARC(K%)=0 THEN GBARC(K%)=GAMMA*C(CP%(K%,CHEMOX%))*1000
    6123 RETURN
    6130 GOTO 6192        'Code 13 = dynamic chemotonic conn
    6139 '***************** CODE CONNOR (14): CONNOR-MODIFIED HH PARAMS
    6140 INPUT #1, CP%(K%, CONNOR%), VEQC(K%), GBARCON(K%), GAMMA, KTEMPC(K%)
    6141 INPUT #1, QMC(K%),  MCA(K%),  MCB(K%),  MCC(K%), V0MC(K%), MUMC(K%)
    6142 INPUT #1, TMC0(K%), TMCA(K%), V0TM(K%), MUTM(K%)
    6143 INPUT #1, QHC(K%),  V0HC(K%), MUHC(K%)
    6144 INPUT #1, THC0(K%), THCA(K%), V0TH(K%), MUTH(K%)
    6145 IF GBARCON(K%)=0 THEN GBARCON(K%)=GAMMA*C(CP%(K%,CONNOR%))*1000
    6146 RETURN
    6149 '***************** CODES not implemented:  15-19 *************************
    6150 GOTO 6192
    6160 GOTO 6192
    6170 GOTO 6192    'Code 17: Reserved for user additions
    6180 GOTO 6192    'Code 18: Reserved for user additions
    6190 GOTO 6192    'Code 19: Reserved for user additions
    6192 PRINT "6192: INPUT OF CODE "; J%; " NOT IMPLEMENTED": RETURN
    6193 '
    6194 '****************** CODE POOL (20): INPUT OF POOL PARAMETERS ****
    6195 'Pool types:
    6196 ' 1=bound transmitter-eqivalent: dpool0=sumtb(pprm1,sumtb0)*pprm3/(pprm2+sumtb(pprm1,sumtb0) - pool
    6197 ' 2=transmitter-dependent: dpool0=sumtb(pprm1,sumtb0)*tinc*pprm3/(pprm2+sumtb(pprm1,sumtb0)
    6198 ' 3=current-dependent: dpool0=I(pprm1,pprm2)*tinc*pprm3
    6199 ' 4=general 1st-order; 5=bound CHEMOX transmitter dependent
    6200 INPUT #1, CP%(K%, POOL%), XTYPE%(K%), XNAME$(K%), XVOL(K%), XPOOL0(K%)
    6201 INPUT #1, PPRM1(K%), PPRM2(K%), PPRM3(K%), PPRM4(K%)
    6202 RETURN
    6204 '***************** CODE POOLK (21): INPUT DIFFUSION RATE CONSTANTS 
    6205 INPUT #1, L%, K(K%, L%)
    6206 RETURN
    6207 '***************** CODE POOLX (22): INPUT POOL INTERACTIONS ****
    6208 'Interactions (XINTYP%): XPOOL(XSRC%) on XPOOL(XTARG%) or Branch(XTARG%)
    6209 ' 1=Constant multiplier: Xtarg=Xtarg0+Xprm1*(Xsrc+Xsrc0)
    6210 GOTO 6205
    6211 ' 2=Equilibrium receptor-binding:Xtarg=Xtarg0+Xprm1*Xsrc/(Xprm2+dXsrc)
    6212 ' 3=Pseudo first order kinetic: dXtarg=(Xprm1*Xsrc*(Xprm3-Xtarg)-Xprm2*Xtarg)*tinc
    6213 ' 4=Vrev ion dependence: Xtarg=26*ln(Xsrc/Xprm1)
    6214 ' 5=Synthesis rate modulation: dXtarg=Xprm1*Xsrc*tinc
    6215 ' 6=Coupling-conductance modulation: GC(Xtarg%,Xprm2)=Xprm1*Xsrc + Xtarg0
    6216 ' 7=Diffusion-constant modulation:    K(Xtarg%,Xprm2)=Xprm1*Xsrc + Xtarg0
    6217 '
    6220 INPUT #1, XTARG%(K%), XSRC%(K%), XINTYP%(K%)
    6221 INPUT #1, XPRM1(K%), XPRM2(K%), XPRM3(K%), XPRM4(K%)
    6222 INPUT #1, XBRN%(K%), XPRM%(K%) 'BRANCH INDX, VRBL PRM#
    6223 RETURN
    6993 '
    6994 '                  *******************************************
    6995 '******************* SUBROUTINES TO SAVE STATE VARIABLES     ******************
    6996 '                  * (lines 7000+NAME%*10; called from 1450) *
    9097 '                  *******************************************
    7010 PRINT #1, V(K%);: RETURN                            'PRINCIPAL BRANCH
    7020 PRINT #1, VM(K%), W(K%), P(K%), EI(K%), GS(K%)     'TRIGR
    7022  PRINT #1, AR(K%), A1(K%), A2(K%), THR(K%), XSS(K%);
    7024  RETURN
    7030 RETURN
    7040 RETURN
    7050 RETURN
    7060 RETURN
    7070 RETURN
    7080 PRINT #1, GK1(K%), GK2(K%);: RETURN                'TYPE DRIVER
    7090 PRINT #1, M(K%), H(K%);: RETURN                    'TYPE HHFXD
    7100 PRINT #1, MHH(K%), HHH(K%);: RETURN                'TYPE HH
    7110 PRINT #1, NF%(K%), FLOC%, TPREV(K%);               'TYPE SYNAPSE
    7112  FOR L% = FLOC% TO NF%(K%) + FLOC%: PRINT #1, XF(L%),: NEXT L%
    7120 RETURN
    7130 RETURN
    7140 PRINT #1, MC(K%), HC(K%);: RETURN                  'TYPE CONNOR
    7150 RETURN
    7160 RETURN
    7170 RETURN
    7180 RETURN
    7190 RETURN
    7200 PRINT #1, XPOOL(K%);: RETURN
    7210 RETURN
    7220 RETURN
    7493 '
    7494 '                  ******************************************
    7495 '******************* SUBROUTINES TO PRELOAD STATE VARIABLES *******************
    7496 '                  * (lines 7500+NAME%*10; called from )    *
    7497 '                  ******************************************
    7510 INPUT #1, V(K%): RETURN                            'PRINCIPAL BRANCH
    7520 INPUT #1, VM(K%), W(K%), P(K%), EI(K%), GS(K%)     'TRIGR
    7522  INPUT #1, AR(K%), A1(K%), A2(K%), THR(K%), XSS(K%)
    7524  RETURN
    7530 RETURN                                             'Code 3
    7540 RETURN                                             'Code 4
    7550 RETURN                                             'Code 5
    7560 RETURN                                             'Code 6
    7570 RETURN                                             'Code 7
    7580 INPUT #1, GK1(K%), GK2(K%): RETURN                 'TYPE DRIVER
    7590 INPUT #1, M(K%), H(K%): RETURN                     'TYPE HHFXD
    7600 INPUT #1, MHH(K%), HHH(K%): RETURN                 'TYPE HH
    7610 INPUT #1, NF%(K%), FLOC%, TPREV(K%)                'TYPE SYNAPSE
    7612  FOR L% = FLOC% TO NF%(K%) + FLOC%: INPUT #1, XF(L%): NEXT L%
    7614  RETURN
    7620 RETURN
    7630 RETURN
    7640 INPUT #1, MC(K%), HC(K%): RETURN                   'TYPE CONNOR
    7650 RETURN
    7660 RETURN
    7670 RETURN
    7680 RETURN
    7690 RETURN
    7700 INPUT #1, XPOOL(K%): RETURN                        'TYPE POOL
    7710 RETURN
    7720 RETURN
    10991 '
    10992 '                   ###############################
    10993 '####################           POOLS             ##########################
    10994 '                   ###############################
    10995 '
    10996 ' Routines handling filling, diffusion, and modulation in pools
    10997 '
    10998 '**************** INTER-POOL DIFFUSION  *******
    11000 FOR K% = 1 TO N%(POOL%)
    11140  IF CP%(K%, POOL%) = 0 THEN GOTO 11270            'SKIP EMPTY SLOTS
    11150  ON XTYPE%(K%) GOSUB 11310, 11320, 11330, 11340, 11350'INPUT SPRING INPUT OF DPOOL
    11160  IF TXFLG%(POOLK%) THEN K = K(0, K%): GOTO 11260  'FLG BLOCKS DIFFUSION
    11170  FOR L% = 0 TO N%(POOL%)                     'INFLOW FROM OTHER POOLS
    11180   IF L% = K% OR CP%(L%,POOL%) = 0 THEN GOTO 11200
    11190   DPOOL = DPOOL + K(K%,L%)*XPOOL(L%)*TINC/XVOL(L%)
    11200   NEXT L%
    11210  K = 0
    11220  FOR L% = 0 TO N%(POOL%)         'OUTFLOW TO OTHER POOLS & DESTROYED
    11230   IF L% = K% OR CP%(L%,POOL%) = 0 THEN GOTO 11250
    11240   K = K + K(L%,K%)               '[K(0,K%) IS BASE DECAY RATE]
    11250   NEXT L%
    11260  DPOOL(K%) = DPOOL - K * XPOOL(K%) * TINC / XVOL(K%)'NET POOL CHANGE
    11265  IF DBF%<>0 THEN PRINT "11265: CODE POOL: POOL#";K%;"SPRING=";DPOOL;"DIFFUSED=";DPOOL-DPOOL(K%)
    11270  NEXT K%
    11290 RETURN
    11299 '**************** CODE POOL: POOL SPRING SUBROUTINES ******
    11310 DPOOL = SUMTB(PPRM1(K%), SUMTB0%) * PPRM3(K%) / (PPRM2(K%) + SUMTB(PPRM1(K%), SUMTB0%)) - XPOOL(K%): RETURN
    11320 DPOOL = (SUMTB(PPRM1(K%), SUMTB0%) * PPRM3(K%) / (PPRM2(K%) + SUMTB(PPRM1(K%), SUMTB0%)) - PPRM4(K%)*XPOOL(K%)) * TINC: RETURN
    11330 DPOOL = (I(PPRM1(K%), PPRM2(K%)) * PPRM3(K%) - PPRM4(K%)*XPOOL(K%)) *TINC: RETURN
    11340 DPOOL = (PPRM1(K%) - PPRM2(K%) * XPOOL(K%)) * TINC: RETURN
    11350 DPOOL = S(PPRM1%) * PPRM3(K%) / (PPRM2(K%) + S(PPRM1%) - XPOOL(K%)):RETURN
    11991 '
    11992 '**************** CODE POOLX: GENERATION OF POOL INTERACTIONS  *****
    12000 FOR K% = 1 TO N%(POOLX%)
    12050 L% = XSRC%(K%)                                'SOURCE POOL
    12055 XTARG% = XTARG%(K%)                           'TARGET POOL
    12060 IF XTARG%<0 THEN I%=-XTARG%: XBRN% = XBRN%(K%): XPRM% = XPRM%(K%):GOSUB 13000: GOTO 12080 'FETCH K (Current value of target parameter)
    12070 K = XPOOL(XTARG%)                         'FETCH TARGET POOL VALUE
    12080 ON XINTYP%(K%) GOSUB 12150, 12200, 12300, 12400, 12500,12600,12700
    12085 TARG(K%)=K
    12090 IF XTARG% < 0 THEN GOSUB 16000: GOTO 12105    'IF BRANCH, SAVE RESULT
    12095 IF XINTYP%(K%)=6 OR XINTYP%(K%)=7 THEN GOTO 12105 'Types 6 & 7 different
    12100 XPOOL(XTARG%) = K
    12105 IF DBF%<>0 THEN PRINT "12105: CODE 22: K%=";K%;" SRC POOL=";L%; "XINTYP=";XINTYP%(K%);" XTARG=";XTARG%;"K=";K;: IF XTARG%<0 THEN PRINT" XBRN=";XBRN%;" XPRM=";XPRM%: ELSE PRINT
    12110 NEXT K%
    12120 RETURN
    12148 '
    12149 '      Type 1: Constant multiplier
    12150 K = XPRM1(K%) * (XPOOL(L%) + XPOOL0(L%)) + XTARG0(K%)
    12160 RETURN
    12198 '
    12199 '      Type 2: Equilibrium binding
    12200 K = XPRM1(K%) * (XPOOL(L%)+XPOOL0(L%)) / (XPRM2(K%) + XPOOL(L%) + XPOOL0(L%)) + XTARG0(K%)
    12210 RETURN
    12298 '
    12299 '      Type 3: Pseudo first-order kinetics
    12300 DXTARG = (XPRM1(K%)*(XPOOL(L%)+XPOOL0(L%))*(XPRM3(K%) - K) - XPRM2(K%)*K )*TINC
    12310 K = K + DXTARG '(IMPROPERLY DONE INCREMENT)
    12320 RETURN
    12398 '
    12399 '      Type 4: Vrev ion dependence
    12400 K = 26 * LOG((XPOOL(L%)+XPOOL0(L%)) / XPRM1(K%))
    12410 RETURN
    12498 '
    12499 '      Type 5: Synthesis rate modulation
    12500 K = K + XPRM1(K%) * (XPOOL(L%)+XPOOL0(L%)) * TINC
    12510 RETURN
    12598 '
    12599 '      Type 6: Coupling-conductance modulation
    12600 K = XPRM1(K%)*(XPOOL(L%)+XPOOL0(L%)) + XTARG0(K%)
    12610 GC(XTARG%,XPRM2(K%)) = K
    12620 RETURN
    12698 '
    12699 '      Type 7: Diffusion/Reaction constant modulation
    12700 K = XPRM1(K%)*(XPOOL(L%)+XPOOL0(L%)) + XTARG0(K%)
    12710 K(XTARG%,XPRM2(K%)) = K
    12720 RETURN
    12995 '
    12996 '**************** FETCH BRANCH PARAMETER VIA K *******************      
    13000 ON I% GOTO 13100, 13200, 13300, 13400, 13500, 13600, 13700, 13800, 
    13900, 14000, 14100, 14200, 14300, 14400, 14500, 14600, 14700, 14800, 
    14900, 15000, 15100, 15200
    13099 '----> CODE 1:
    13100 ON XPRM% GOTO 13110, 13120, 13130, 13140
    13105 GOTO 19100
    13110 K = C(XBRN%):  RETURN     '1
    13120 K = VLK(XBRN%): RETURN     '2
    13130 K = GL(XBRN%): RETURN     '3
    13140 K = INJ(XBRN%): RETURN    '4 (= code for pool-injection current)
    13190 '----> CODE 2
    13200 ON XPRM% GOTO 13210, 13215,13220,13225,13230,13235
    13205 GOTO 19100
    13210 K = E0(XBRN%):    RETURN  '1
    13215 K = TAUM0(XBRN%): RETURN  '2
    13220 K = PMTHR(XBRN%): RETURN  '3
    13225 K = KPM(XBRN%):   RETURN  '4
    13230 K = TAUPM(XBRN%): RETURN  '5
    13235 K = KCOND(XBRN%): RETURN  '6
    13287 'TAUCOND(K%),KAR(K%),TAUAR(K%),KA1(K%),TAUA1(K%) 'For future exp
    13288 'KA2(K%),TAUA2(K%),THRINF(K%),KTHR(K%),TAUTHR(K%)
    13289 'DV0(K%),MAXV(K%),DG0(K%),MAXG(K%),DAR0(K%),MAXAR(K%)
    13290 'DA10(K%),MAXA1(K%),DA20(K%),MAXA2(K%),DTHR0(K%),MAXTHR(K%)
    13299 '---> (Code 3 modulation by Type 6 interaction needs special treat)
    13300 GOTO 19000 'CODE 3
    13400 GOTO 19000 'CODE 4
    13500 GOTO 19000 'CODE 5
    13600 GOTO 19000 'CODE 6
    13699 '----> CODE 7
    13700 ON XPRM% GOTO 13710, 13720
    13705 GOTO 19100
    13710 K=VCOND(XBRN%): RETURN
    13720 K=G(XBRN%, COND%): RETURN
    13790 '----> CODE 8
    13800 ON XPRM% GOTO 13805, 13810, 13815, 13820, 13825, 13830, 13835, 13840, 
    13845, 13850, 13855, 13860
    13803 GOTO 19100
    13805 K = VNA(XBRN%):    RETURN  '1
    13810 K = GBARNA(XBRN%): RETURN  '2
    13815 K = V0NA(XBRN%):   RETURN  '3
    13820 K = MUNA(XBRN%):   RETURN  '4
    13825 K = VK(XBRN%):     RETURN  '5
    13830 K = GBARK(XBRN%):  RETURN  '6
    13835 K = V0K(XBRN%):    RETURN  '7
    13840 K = MUK(XBRN%):    RETURN  '8
    13845 K = GBARK1(XBRN%): RETURN  '9
    13850 K = TAUK1(XBRN%):  RETURN  '10
    13855 K = GBARK2(XBRN%): RETURN  '11
    13860 K = TAUK2(XBRN%):  RETURN  '12
    13899 '----> CODE 9
    13900 ON XPRM% GOTO 13910, 13920, 13930, 13940, 13950, 13960, 13970, 13980, 
    13990, 13995
    13905 GOTO 19100
    13910 K = VEQ(XBRN%):  RETURN    '1
    13920 K = GBAR(XBRN%): RETURN    '2
    13930 K = QM(XBRN%):   RETURN    '3
    13940 K = V0M(XBRN%):  RETURN    '4
    13950 K = MUM(XBRN%):  RETURN    '5
    13960 K = TAUMA(XBRN%):RETURN    '6
    13970 K = QH(XBRN%):   RETURN    '7
    13980 K = V0H(XBRN%):  RETURN    '8
    13990 K = MUH(XBRN%):  RETURN    '9
    13995 K = TAUH(XBRN%): RETURN    '10
    13999 '----> CODE 10
    14000 ON XPRM% GOTO 14010,14020
    14005 GOTO 19100
    14010 K = VEQHH(XBRN%):  RETURN  '1
    14020 K = GBARHH(XBRN%): RETURN  '2
    14090 'KTEMP(XBRN%),QMHH(XBRN%),QHHH(XBRN%)
    14091 'AAM(XBRN%),BAM(XBRN%),CAM(XBRN%),DAM(XBRN%),EAM(XBRN%)
    14092 'ABM(XBRN%),BBM(XBRN%),CBM(XBRN%),DBM(XBRN%),EBM(XBRN%)
    14093 'AAH(XBRN%),BAH(XBRN%),CAH(XBRN%),DAH(XBRN%),EAH(XBRN%)
    14094 'ABH(XBRN%),BBH(XBRN%),CBH(XBRN%),DBH(XBRN%),EBH(XBRN%)
    14099 '----> CODE 11
    14100 ON XPRM% GOTO 14110, 14120, 14130, 14140
    14105 GOTO 19100
    14110 K = VREVS(XBRN%): RETURN   '1
    14120 K = GBARS(XBRN%): RETURN   '2
    14125 K = KDS(XBRN%):   RETURN   '3
    14130 K = DLY(XBRN%):   RETURN   '4
    14140 K = A0S(XBRN%):   RETURN   '5
    14199 '----> CODE 12
    14200 ON XPRM% GOTO 14210, 14220, 14230, 14240, 14250, 14260
    14205 GOTO 19100
    14210 K = VREVC(XBRN%): RETURN   '1
    14220 K = GBARC(XBRN%): RETURN   '2
    14230 K = KDC(XBRN%):   RETURN   '3
    14240 K = S0(XBRN%):    RETURN   '4
    14250 K = MUC(XBRN%):   RETURN   '5
    14260 K = KS(XBRN%):    RETURN   '6
    14299 '----> CODES 13-19 FOR FUTURE EXPANSION
    14300 GOTO 19000        'TO IMPLEMENT, FOLLOW ABOVE FORMAT
    14399 '----> CODE 14 (Connor HH)
    14400 ON XPRM% GOTO 14410, 14420
    14405 GOTO 19100
    14410 K = VEQC(XBRN%)    : RETURN
    14420 K = GBARCON(XBRN%) : RETURN
    14500 GOTO 19000
    14600 GOTO 19000
    14700 GOTO 19000
    14800 GOTO 19000
    14900 GOTO 19000
    14999 '---> CODE 20
    15000 ON XPRM% GOTO 15010,15020,15030,15040,15050,15060
    15005 GOTO 19100
    15010 K=XVOL(XBRN%)  : RETURN    '1
    15020 K=XPOOL0(XBRN%): RETURN    '2
    15030 K=PPRM1(XBRN%) : RETURN    '3
    15040 K=PPRM2(XBRN%) : RETURN    '4
    15050 K=PPRM3(XBRN%) : RETURN    '5
    15060 K=PPRM4(XBRN%) : RETURN    '6
    15099 '---> CODE 21 (Diffusion modulation is via Type 7)
    15100 GOTO 19000
    15199 '---> CODE 22
    15200 ON XPRM% GOTO 15210,15220,15230,15240
    15205 GOTO 19100
    15210 K=XPRM1(XBRN%) : RETURN    '1
    15220 K=XPRM2(XBRN%) : RETURN    '2
    15230 K=XPRM3(XBRN%) : RETURN    '3
    15240 K=XPRM4(XBRN%) : RETURN    '4
    15998 '
    15999 '********** SET BRANCH PARAMETER FROM K **********
    16000 ON I% GOTO 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 
    16900, 17000, 17100, 17200, 17300, 17400, 17500, 17600, 17700, 17800, 
    17900, 18000, 18100, 18200
    16009 '----> CODE 1
    16100 ON XPRM% GOTO 16110, 16120, 16130, 16140
    16105 GOTO 19300
    16110 C(XBRN%)  = K: RETURN
    16120 VLK(XBRN%)= K: RETURN
    16130 GL(XBRN%) = K: RETURN
    16140 INJ(XBRN%)= K: RETURN
    16190 '----> CODE 2
    16200 ON XPRM% GOTO 16210, 16215,16220,16225,16230,16235
    16205 GOTO 19300
    16210 E0(XBRN%) = K:    RETURN
    16215 TAUM0(XBRN%) = K: RETURN
    16220 PMTHR(XBRN%) = K: RETURN
    16225 KPM(XBRN%) = K:   RETURN
    16230 TAUPM(XBRN%) = K: RETURN
    16235 KCOND(XBRN%) = K: RETURN
    16287 'TAUCOND(K%),KAR(K%),TAUAR(K%),KA1(K%),TAUA1(K%) 'For future exp
    16288 'KA2(K%),TAUA2(K%),THRINF(K%),KTHR(K%),TAUTHR(K%)
    16289 'DV0(K%),MAXV(K%),DG0(K%),MAXG(K%),DAR0(K%),MAXAR(K%)
    16290 'DA10(K%),MAXA1(K%),DA20(K%),MAXA2(K%),DTHR0(K%),MAXTHR(K%),ESF(K%)
    16299 '----> CODE 3 ILLEGAL; CODES 4-7 FOR FUTURE EXP
    16300 GOTO 19200 'CODE 3
    16400 GOTO 19200 'CODE 4
    16500 GOTO 19200 'CODE 5
    16600 GOTO 19200 'CODE 6
    16699 '----> CODE 7
    16700 ON XPRM% GOTO 16710, 16720
    16705 GOTO 19300
    16710 VCOND(XBRN%)=K: RETURN
    16720 G(XBRN%, COND%)=K: RETURN
    16790 '----> CODE 8
    16800 ON XPRM% GOTO 16805, 16810, 16815, 16820, 16825, 16830, 16835, 16840, 
    16845, 16850, 16855, 16860
    16803 GOTO 19300
    16805 VNA(XBRN%) = K: RETURN
    16810 GBARNA(XBRN%) = K: RETURN
    16815 V0NA(XBRN%) = K: RETURN
    16820 MUNA(XBRN%) = K: RETURN
    16825 VK(XBRN%) = K: RETURN
    16830 GBARK(XBRN%) = K: RETURN
    16835 V0K(XBRN%) = K: RETURN
    16840 MUK(XBRN%) = K: RETURN
    16845 GBARK1(XBRN%) = K: RETURN
    16850 TAUK1(XBRN%) = K: RETURN
    16855 GBARK2(XBRN%) = K: RETURN
    16860 TAUK2(XBRN%) = K: RETURN
    16899 '----> CODE 9
    16900 ON XPRM% GOTO 16910, 16920, 16930, 16940, 16950, 16960, 16970, 16980, 
    16990, 16995
    16905 GOTO 19300
    16910 VEQ(XBRN%) = K: RETURN
    16920 GBAR(XBRN%) = K: RETURN
    16930 QM(XBRN%) = K: RETURN
    16940 V0M(XBRN%) = K: RETURN
    16950 MUM(XBRN%) = K: RETURN
    16960 TAUMA(XBRN%) = K: RETURN
    16970 QH(XBRN%) = K: RETURN
    16980 V0H(XBRN%) = K: RETURN
    16990 MUH(XBRN%) = K: RETURN
    16995 TAUH(XBRN%) = K: RETURN
    16999 '----> CODE 10
    17000 ON XPRM% GOTO 17010, 17015
    17005 GOTO 19300
    17010 VEQHH(XBRN%) = K:  RETURN
    17015 GBARHH(XBRN%)= K:  RETURN
    17090 'KTEMP(XBRN%)=K,QMHH(XBRN%)=K,QHHH(XBRN%)=K
    17091 'AAM(XBRN%)=K,BAM(XBRN%)=K,CAM(XBRN%)=K,DAM(XBRN%)=K,EAM(XBRN%)=K
    17092 'ABM(XBRN%)=K,BBM(XBRN%)=K,CBM(XBRN%)=K,DBM(XBRN%)=K,EBM(XBRN%)=K
    17093 'AAH(XBRN%)=K,BAH(XBRN%)=K,CAH(XBRN%)=K,DAH(XBRN%)=K,EAH(XBRN%)=K
    17094 'ABH(XBRN%)=K,BBH(XBRN%)=K,CBH(XBRN%)=K,DBH(XBRN%)=K,EBH(XBRN%)=K
    17099 '----> CODE 11
    17100 ON XPRM% GOTO 17110, 17120, 17130, 17140
    17105 GOTO 19300
    17110 VREVS(XBRN%) = K: RETURN
    17120 GBARS(XBRN%) = K: RETURN
    17125 KDS(XBRN%)   = K: RETURN
    17130 DLY(XBRN%)   = K: RETURN
    17140 A0S(XBRN%)   = K: RETURN
    17199 '----> CODE 12
    17200 ON XPRM% GOTO 17210, 17220, 17230, 17240, 17250, 17260
    17205 GOTO 19300
    17210 VREVC(XBRN%) = K: RETURN
    17220 GBARC(XBRN%) = K: RETURN
    17230 KDC(XBRN%)   = K: RETURN
    17240 S0(XBRN%)    = K: RETURN
    17250 MUC(XBRN%)   = K: RETURN
    17260 KS(XBRN%)    = K: RETURN
    17299 '----> CODES 13-19 FOR FUTURE EXPANSION
    17300 GOTO 19200   'CODE 13
    17400 ON XPRM% GOTO 17410, 17420
    17405 GOTO 19300
    17410 VEQC(XBRN%)  = K: RETURN
    17420 GBARCON(XBRN%)=K: RETURN
    17500 GOTO 19200   'CODE 15
    17600 GOTO 19200   'CODE 16
    17700 GOTO 19200   'CODE 17
    17800 GOTO 19200   'CODE 18
    17900 GOTO 19200   'CODE 19
    17999 '---> CODE 20
    18000 ON XPRM% GOTO 18010,18020,18030,18040,18050,18060
    18005 GOTO 19300
    18010 XVOL(XBRN%) = K: RETURN
    18020 XPOOL0(XBRN%)=K: RETURN
    18030 PPRM1(XBRN%) =K: RETURN
    18040 PPRM2(XBRN%) =K: RETURN
    18050 PPRM3(XBRN%) =K: RETURN
    18060 PPRM4(XBRN%) =K: RETURN
    18099 '---> CODE 21
    18100 GOTO 19200    '(Modulation achieved by Type 7 interaction)
    18199 '---> CODE 22
    18200 ON XPRM% GOTO 18210,18220,18230,18240
    18205 GOTO 19300
    18210 XPRM1(XBRN%)=K: RETURN
    18220 XPRM2(XBRN%)=K: RETURN
    18230 XPRM3(XBRN%)=K: RETURN
    18240 XPRM4(XBRN%)=K: RETURN
    19000 PRINT "19000: TARGET-FETCH ";
    19050 PRINT "CALLED ILLEGAL BRANCH CODE ";I%: ER%=-1: RETURN
    19100 PRINT "19100: TARGET-FETCH ";
    19150 PRINT "INVALID TARGET PARAMETER ";XPRM%(K%);"OF BRANCH ";I%;"FOR INTERACTION ";K%: ER%=-1: RETURN
    19200 PRINT "19200: TARGET-SAVE ";: GOTO 19050
    19300 PRINT "19300: TARGET-SAVE ";: GOTO 19150
    
    

    For another excellent modeling program, see Michael Hines' NEURON
    Return to Hartline Home Page. Return to PBRC Home Page.