# Attempt at a test program.  This has one column with three layers, each
# with excitatory and inhibitory cells. Layer A is connected to B, and B to C.
# Sine stimulus is applied to A, and output of C is recorded.

############################## Define Brain ################################

BRAIN
        TYPE                    Brain
        JOB                     c2
        FSV                     10000
        DISTRIBUTE              EqualSynapse
        DURATION                1.5000
        SEED                    999999
        STIMULUS_INJECT         StInject1
        COLUMN_TYPE             AI_1
        COLUMN_TYPE             AI_2
        CONNECT
                                AI_1 layer_A    Excitatory      s1
                                AI_2 layer_B    Excitatory      s1
                                ExcitSyn1       0.1             3
        REPORT                  ReportIn
        REPORT                  ReportOut
END_BRAIN

############################### Define Column Shells #########################

COLUMN_SHELL
        TYPE                    AI_shell_1
        WIDTH                   300
        HEIGHT                  800
        LOCATION                100             50
END_COLUMN_SHELL

COLUMN_SHELL
        TYPE                    AI_shell_2
        WIDTH                   300
        HEIGHT                  800
        LOCATION                0               0
END_COLUMN_SHELL

############################### Fill Columns #################################

COLUMN
        TYPE                    AI_1
        COLUMN_SHELL            AI_shell_1
        LAYER_TYPE              layer_A
        LAYER_TYPE              layer_B
        CONNECT
                                layer_A    Excitatory      s1
                                layer_B    Excitatory      s1
                                ExcitSyn1       0.1             3
END_COLUMN

COLUMN
        TYPE                    AI_2
        COLUMN_SHELL            AI_shell_2
        LAYER_TYPE              layer_A
        LAYER_TYPE              layer_B
        CONNECT
                                layer_A    Excitatory      s1
                                layer_B    Excitatory      s1
                                ExcitSyn1       0.1             3
END_COLUMN

############################### Define Layer Shells #########################

LAYER_SHELL
        TYPE                    layer_shell_A
        LOWER                   0
        UPPER                   35
END_LAYER_SHELL

LAYER_SHELL
        TYPE                    layer_shell_B
        LOWER                   35
        UPPER                   65
END_LAYER_SHELL

############################### Fill Layers ##################################

LAYER
        TYPE                    layer_A
        LAYER_SHELL             layer_shell_A
        CELL_TYPE               Excitatory      500
        CELL_TYPE               Inhibitory      100
        CONNECT
                                Excitatory      s1
                                Inhibitory      s1
                                ExcitSyn1       0.1             3
END_LAYER

LAYER
        TYPE                    layer_B
        LAYER_SHELL             layer_shell_B
        CELL_TYPE               Excitatory      500
        CELL_TYPE               Inhibitory      100
        CONNECT
                                Excitatory      s1
                                Inhibitory      s1
                                ExcitSyn1       0.1             3
END_LAYER

############################### Define Cells ################################

CELL
        TYPE                    Excitatory
        COMPARTMENT             soma_e1         s1      0       0
END_CELL

CELL
        TYPE                    Inhibitory
        COMPARTMENT             soma_i1         s1      0       0
END_CELL

############################### Define Compartments ##########################

COMPARTMENT
        TYPE                    soma_e1
        SPIKESHAPE              AP_Hoff
        SPIKE_HALFWIDTH         10              0
        TAU_MEMBRANE            0.015           0.0
        R_MEMBRANE              200             0
        THRESHOLD               -40             0
        LEAK_REVERSAL           0               0
        LEAK_CONDUCTANCE        0               0
        VMREST                  -65             0
        CA_INTERNAL             100              0
        CA_EXTERNAL             0               0
        CA_SPIKE_INCREMENT      300             0
        CA_TAU                  0.07            0.0
        CHANNEL                 ahp-2
        CHANNEL                 m-1
        CHANNEL                 a-1
        CHANNEL                 a-2
END_COMPARTMENT

COMPARTMENT
        TYPE                    soma_i1
        SPIKESHAPE              AP_Hoff
        SPIKE_HALFWIDTH         10              0
        TAU_MEMBRANE            0.015           0.001
        R_MEMBRANE              200             3
        THRESHOLD               -40             1
        LEAK_REVERSAL           0               0
        LEAK_CONDUCTANCE        0               0
        VMREST                  -60             1
        CA_INTERNAL             20              0
        CA_EXTERNAL             0               0
        CA_SPIKE_INCREMENT      100             5
        CA_TAU                  0.1            0.001
        CHANNEL                 ahp-2
        CHANNEL                 m-1
        CHANNEL                 a-1
END_COMPARTMENT

############################### Define Channels #############################

CHANNEL Kahp
        TYPE                            ahp-2
        REVERSAL_POTENTIAL              -80             0
        M_INITIAL                       0.0             0.0
        M_POWER                         2
        CA_SCALE_FACTOR                 0.000125        0
        CA_EXP_FACTOR                   2               0
        CA_HALF_MIN                     2.5             0
        CA_TAU_SCALE_FACTOR             0.003            0.0000
        UNITARY_G                       0.054           0
        STRENGTH                        0.1            0.0
END_CHANNEL

CHANNEL Km
        TYPE                            m-1
        REVERSAL_POTENTIAL              -80             0
        M_INITIAL                       0.1             0.0
        M_POWER                         1
        E_HALF_MIN_M                    -44             0
        SLOPE_FACTOR_M                  40              20              8.8
        SLOPE_FACTOR_M_STDEV            0
        TAU_SCALE_FACTOR_M              0.303
        UNITARY_G                       0.084           0
        STRENGTH                        0.03           0
END_CHANNEL

CHANNEL Ka
        TYPE                            a-1
        REVERSAL_POTENTIAL              -80             0
        M_INITIAL                       0.3             0.0
        M_POWER                         2
        E_HALF_MIN_M                    -21.3              0
        SLOPE_FACTOR_M                  35
        SLOPE_FACTOR_M_STDEV            0.0
        V_TAU_VOLTAGE_M                 100.000000
        V_TAU_VOLTAGE_M_STDEV           0.000000
        V_TAU_VALUE_M                   0.000200        9999.000000
        V_TAU_VALUE_M_STDEV             0.00000
        H_INITIAL                       0.7             0.0
        H_POWER                         1
        E_HALF_MIN_H                    -58             0
        SLOPE_FACTOR_H                  8.2
        SLOPE_FACTOR_H_STDEV            0.0
        V_TAU_VOLTAGE_H                 -21.000000      -1.000000       10.000000       21.000000
        V_TAU_VOLTAGE_H_STDEV           0.0
        V_TAU_VALUE_H                   0.05000        0.01000        0.15000        0.20000        2.5000
        V_TAU_VALUE_H_STDEV             0.0000
        UNITARY_G                       0.120           0
        STRENGTH                        0.05            0
END_CHANNEL

CHANNEL Ka
        TYPE                            a-2
        REVERSAL_POTENTIAL              -80             0
        M_INITIAL                       0.3             0.0
        M_POWER                         2
        E_HALF_MIN_M                    -21.3              0
        SLOPE_FACTOR_M                  35
        SLOPE_FACTOR_M_STDEV            0.0
        V_TAU_VOLTAGE_M                 100.000000
        V_TAU_VOLTAGE_M_STDEV           0.000000
        V_TAU_VALUE_M                   0.0002        9999.000000
        V_TAU_VALUE_M_STDEV             0.00000
        H_INITIAL                       0.7             0.0
        H_POWER                         1
        E_HALF_MIN_H                    -58             0
        SLOPE_FACTOR_H                  8.2
        SLOPE_FACTOR_H_STDEV            0.0
        V_TAU_VOLTAGE_H                 -21.000000      -1.000000       10.000000       21.000000
        V_TAU_VOLTAGE_H_STDEV           0.0
        V_TAU_VALUE_H                   0.005000        0.001000        0.015000        0.020000        0.250000
        V_TAU_VALUE_H_STDEV             0.0000
        UNITARY_G                       0.120           0
        STRENGTH                        0.05            0
END_CHANNEL

############################### Define Synapse ##############################

SYNAPSE
        TYPE                    ExcitSyn1
        SFD_LABEL               F2
        SYN_PSG                 PSGexcit
        LEARN_LABEL             0HEBB
        MAX_CONDUCT             0.01
        DELAY                   0.0008          0.0012
        SYN_REVERSAL            0               0                           
        ABSOLUTE_USE            0.250           0.0
        RSE_INIT                0.5             0.5
        PREV_SPIKE_RANGE        0.1             0.1
END_SYNAPSE

SYNAPSE
        TYPE                    InhibSyn1
        SFD_LABEL               F0
        SYN_PSG                 PSGinhib
        LEARN_LABEL             0HEBB
        MAX_CONDUCT             0.05
        DELAY                   0.0008          0.0012
        SYN_REVERSAL            0               0                           
        ABSOLUTE_USE            0.32            0.0
END_SYNAPSE

############################### Short-term Synaptic Dynamics ###############

SYN_FACIL_DEPRESS
        TYPE                    F0
        SFD                     NONE
        FACIL_TAU               0.0           0.0
        DEPR_TAU                0.0           0.0
END_SYN_FACIL_DEPRESS

SYN_FACIL_DEPRESS
        TYPE                    F1
        SFD                     FACIL
        FACIL_TAU               0.376           0.0
        DEPR_TAU                0.045           0.0
END_SYN_FACIL_DEPRESS

SYN_FACIL_DEPRESS
        TYPE                    F2
        SFD                     DEPR
        FACIL_TAU               0.021           0.0
        DEPR_TAU                0.706           0.0
END_SYN_FACIL_DEPRESS

SYN_FACIL_DEPRESS
        TYPE                    F3
        SFD                     BOTH
        FACIL_TAU               0.062           0.031
        DEPR_TAU                0.144           0.08
END_SYN_FACIL_DEPRESS

############################### Synaptic waveform #########################

SYN_PSG
        TYPE                    PSGexcit
        PSG_FILE                /home/jbm/EPSC.txt
END_SYN_PSG

SYN_PSG
        TYPE                    PSGinhib
        PSG_FILE                /home/jbm/IPSC.txt
END_SYN_PSG

############################### Long-term Synaptic Dynamics ###############

SYN_LEARNING
        TYPE                    0HEBB
        LEARNING                NONE
        NEG_HEB_WINDOW          0.04            0.0
        POS_HEB_WINDOW          0.04            0.0
        POS_HEB_PEAK_DELTA_USE  0.01            0.0
        NEG_HEB_PEAK_DELTA_USE  0.005           0.0
        POS_HEB_PEAK_TIME       0.01            0.0
        NEG_HEB_PEAK_TIME       0.01            0.0
END_SYN_LEARNING

SYN_LEARNING
        TYPE                    +-HEBB
        LEARNING                BOTH
        NEG_HEB_WINDOW          0.04            0.0
        POS_HEB_WINDOW          0.04            0.0
        POS_HEB_PEAK_DELTA_USE  0.01            0.0
        NEG_HEB_PEAK_DELTA_USE  0.005           0.0
        POS_HEB_PEAK_TIME       0.01            0.0
        NEG_HEB_PEAK_TIME       0.01            0.0
END_SYN_LEARNING

############################### Define spikeshapes #######################

SPIKESHAPE
  TYPE     AP_Hoff
  VOLTAGES -38 -35 -30 -20 -7 15 30 20 7 -8 -16 -22 -28 -33 -37 -40 -43 -45 -47 -49 -50
END_SPIKESHAPE

############################### Define Stimulus ##########################


STIMULUS
        TYPE                    Stim1
        MODE                    CURRENT
        PATTERN                 SINE
        TIMING                  EXACT
        SAMESEED                NO
        AMP_START               0.5
        VERT_TRANS              0.0
        TIME_START              0.0
        TIME_END                3.4025
        FREQ_START              10
END_STIMULUS

STIMULUS_INJECT
        TYPE                    StInject1
        STIM_TYPE               Stim1
        INJECT                  AI_1 layer_A Excitatory s1 1.0
END_STIMULUS_INJECT

############################### Define Reports ###########################

REPORT
        TYPE                    ReportIn
        ASCII
        CELLS                   AI_1 layer_A Excitatory s1
        PROB                    1.0
        REPORT_ON               VOLTAGE
        FILENAME                in.out
        FREQUENCY               1
        TIME_START              0.0
        TIME_END                3.4025
END_REPORT

REPORT
        TYPE                    ReportOut
        ASCII
        CELLS                   AI_1 layer_B Excitatory s1
        PROB                    1.0
        REPORT_ON               VOLTAGE
        FILENAME                out.out
        FREQUENCY               1
        TIME_START              0.0
        TIME_END                3.4025
END_REPORT

