/*
    coba.sli

    Copyright (C) 2004 The NEST Initiative
    This file is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This file is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

/*
   Benchmark 1 of the simulator review

   The SLI code in this file creates a sparsely coupled network of
   excitatory and inhibitory neurons which exhibits self-sustained
   activity after an initial stimulus.  Connections within and across
   both populations are created at random.  Both neuron populations
   receive Poissonian background input.  The spike output of 500
   neurons from each population are recorded.  Neurons are modeled
   as leaky integrate-and-fire neurons with conductance based synapses
   (exponential functions).  The model is based on

      T.P. Vogels & L.F. Abbott
      Signal Propagation and Logic Gating in Networks of
      Integrate-and-Fire Neurons
      Journal of Neuroscience, 2005, vol 25, pp 10786-10795.

    Marc-Oliver Gewaltig, Abigail Morrison, Tobias Potjans
*/

%%% PARAMETER SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% define all relevant parameters: changes should be made here
% all data is place in the userdict dictionary

% A dictionary is a list of name value pairs, enclosed in << and >>
% Here we use dictionaries to encapsulate the parameters for the different
% benchmarks

/coba_params
<<
  /model  /iaf_cond_exp  % the neuron model to use

  /model_params
   <<
     /E_L     -60.0 mV  % resting potential [mV]
     /V_th    -50.  mV  % threshold [mV]
     /V_reset -60.  mV  % resetpotential [mV]
     /t_ref     5.0 ms  % refractory period [ms]
     /E_ex      0.0 mV  % excitatory reversal potential [mV]
     /E_in    -80.  mV  % inhibitory reversal potential [mV]
     /C_m     200.0     % capacity [pF]
     /g_L      10.0 nS  % leak conductance [nS]
     /tau_syn_ex  5.0 ms % excitatory synaptic time constant [ms]
     /tau_syn_in 10.0 ms % inhibitory synapse time constant [ms]
   >>

  /delay  0.1 ms          % synaptic delay, all connections [ms]

  % synaptic strengths, here peak conductance
  /E_synapse_params
  <<
     /weight 6.0  nS     % [nS], excitatory
  >>

  /I_synapse_params
  <<
     /weight -67.0 nS     % [nS], inhibitory
  >>

  /stimulus /poisson_generator
  /stimulus_params
  <<
    /rate 300.0 Hz   % rate of inital poisson stimulus
    /start  1.0 ms   % start of Poisson_generator [ms]
    /stop  51.0 ms   % stop of Poisson_generator [ms]
    /origin 0.0 ms   % origin of time, to calculate start_time [ms]
  >>

  /detector /spike_detector
  /detector_params
  <<
   /withtime true
   /withgid true
   /to_file true
   /label (coba)
  >>

  % number of neurons per population to record from
  /Nrec 500

  %number of neurons to stimulate
  /Nstim 50
  /simtime 1000.0 ms % simulated time
  /dt         0.1 ms % simulation step

  /NE 3200       % number of excitatory neurons
  /NI  800       % number of inhibitory neurons
  /epsilon 0.02  % Connection probability

  /virtual_processes 1  % number of virtual processes to use

>> def

coba_params using % here we activate the definitions in the dictionary

/parameters_set true def
statusdict/argv :: size 1 gt { 1 get dirname (/) join } { () } ifelse
(benchmark.sli) join run