/* ===========================================================

        Author: Daniel Keller
	e-mail: daniel.keller@epfl.ch
	Institution: Ecole Polytechnique Federale de Lausanne
	Reference: Keller D, Babai N, Kochubey O, Han Y, Markram H, Schürmann F, et al. (2015) An Exclusion Zone for Ca2+ Channels around Docked Vesicles Explains Release Control by Multiple Channels at a CNS Synapse. PLoS Comput Biol 11(5): e1004253. doi:10.1371/journal.pcbi.1004253

============================================================= */

NOTIFICATIONS
{
  VARYING_PROBABILITY_REPORT=FALSE
}

//for AP titration, select as needed
/*sprintf(data_header_str,"../data_files/linearap0.1/")
sprintf(data_header_str,"../data_files/linearap0.2/")
sprintf(data_header_str,"../data_files/linearap0.4/")
sprintf(data_header_str,"../data_files/linearap0.6/")
sprintf(data_header_str,"../data_files/linearap0.8/")*/
sprintf(data_header_str,"../data_files/linearap1.0/")
/*sprintf(data_header_str,"../data_files/linearap20/")
sprintf(data_header_str,"../data_files/linearap40/")
sprintf(data_header_str,"../data_files/linearap80/")*/

sprintf(seed_str,"%04g",SEED)
INCLUDE_FILE="../../rates/rates.mdl"
INCLUDE_FILE="variables.mdl"

TIME_STEP = dt

ITERATIONS = it
EFFECTOR_GRID_DENSITY = grid_density

ACCURATE_3D_REACTIONS = TRUE
MICROSCOPIC_REVERSIBILITY=TRUE

INCLUDE_FILE="../../parameters/geometry_parameters.mdl"
INCLUDE_FILE="../../parameters/epspstart.mdl"

SPACE_STEP= 0.001
ITERATIONS = it
EFFECTOR_GRID_DENSITY = grid_density
INTERACTION_RADIUS=0.002

PARTITION_X=[[-dendrite_length/2-0.05 TO dendrite_length/2+0.05 STEP 0.03]]
PARTITION_Y=[[-dendrite_width/2-0.05 TO dendrite_width/2+0.05 STEP 0.03]]
PARTITION_Z=[[-2.0001 TO 2.0001 STEP 0.03]]

/* --------- Mechanisms ------------- */

INCLUDE_FILE="../../molecules/molecules.mdl"
INCLUDE_FILE="../../mechanisms/mechanisms.mdl"

/* ----- Define Physical Objects ------- */

INCLUDE_FILE="../../geometry_files/bbp_sphere2.mdl"

INCLUDE_FILE="../../geometry_files/sampling_boxes.mdl"

INCLUDE_FILE="../../geometry_files/cbp_sheets.mdl"

INCLUDE_FILE="../../release_events_files/glutamate_release.mdl"

INCLUDE_FILE="../../geometry_files/bouton2.mdl"
INCLUDE_FILE="../../geometry_files/bouton_sensor.mdl"


INSTANTIATE tissue OBJECT {
sphere1 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[   -0.0992 ,  0.0267 ,  0.0435+0.5*gap_size]
  }
sphere2 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[   -0.0992 ,  0.0965  , 0.0834+0.5*gap_size]
  }
sphere3 OBJECT sphere1 {
  SCALE=[2.0,2.0,2.0]
  TRANSLATE=[   -0.0496 ,  0.0447 ,  0.0223+0.5*gap_size]
  }
sphere4 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[   -0.0496 , -0.0079  , 0.0304+0.5*gap_size]
  }
sphere5 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[   -0.0496 ,  0.0154  , 0.0700+0.5*gap_size]
  }
sphere6 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[   -0.0496 ,  0.0811 ,  0.0723+0.5*gap_size]
  }
sphere7 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0 ,  0.0528 ,  0.0328+0.5*gap_size]
  }
sphere8 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0 , -0.0003 ,  0.0324+0.5*gap_size]
  }
sphere9 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0  , 0.1101 ,  0.0669+0.5*gap_size]
  }
sphere10 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0 ,  0.0600 ,  0.0706+0.5*gap_size]
  }
sphere11 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0 , -0.0818 ,  0.0802+0.5*gap_size]
  }
sphere12 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0 ,  -0.0475 ,   0.0639+0.5*gap_size]
  }
sphere13 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[         0  , 0.1101 ,  0.0797+0.5*gap_size]
  }
sphere14 OBJECT sphere1 {
  SCALE=[2.0,2.0,2.0]
  TRANSLATE=[    0.0496 ,  0.0151  , 0.0227+0.5*gap_size]
  }
sphere15 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0496 , -0.0299 ,  0.0289+0.5*gap_size]
  }
sphere16 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0496 ,  0.0140 ,  0.0791+0.5*gap_size]
  }
sphere17 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0496 , -0.0329  , 0.0714+0.5*gap_size]
  }
sphere18 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0992 ,  0.0140 ,  0.0864+0.5*gap_size]
  }
sphere19 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0992 ,  0.0537 ,  0.0361+0.5*gap_size]
  }
sphere20 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0992 , -0.0908 ,  0.0529+0.5*gap_size]
  }
sphere21 OBJECT sphere1 {
  SCALE=[2.5,2.5,2.5]
  TRANSLATE=[    0.0992 ,  0.1107 ,  0.0793+0.5*gap_size]
  }

  bouton OBJECT bouton {}
  bouton_box OBJECT bouton_box {}
  bouton_box_top OBJECT bouton_box_top {}

  boutonactivezone OBJECT boutonactivezone {}


  Glu_release_site_1 OBJECT Glu_release_site_1 {}

  RELEASE_active  RELEASE_SITE
  {
    SHAPE=LIST
    MOLECULE_POSITIONS {
      Ca_HH.C0' [   -0.1329 ,  0.0281,0.5*gap_size]
      Ca_HH.C0' [    0.0934 , -0.2786,0.5*gap_size]
      Ca_HH.C0' [    0.1459 , -0.0647,0.5*gap_size]
      Ca_HH.C0' [   -0.0326 ,  0.0878,0.5*gap_size]
      Ca_HH.C0' [    0.0413 , -0.0184,0.5*gap_size]
      Ca_HH.C0' [   -0.1133 ,  0.0171,0.5*gap_size]
      Ca_HH.C0' [   -0.0297 , -0.2497,0.5*gap_size]
      Ca_HH.C0' [   -0.0055 , -0.0064,0.5*gap_size]
      Ca_HH.C0' [    0.0886 , -0.0294,0.5*gap_size]
      Ca_HH.C0' [    0.0051 ,  0.0065,0.5*gap_size]
      Ca_HH.C0' [   -0.0419 , -0.1891,0.5*gap_size]
      Ca_HH.C0' [   -0.0367 , -0.2333,0.5*gap_size]
      Ca_HH.C0' [   -0.1452 , -0.0548,0.5*gap_size]
      Ca_HH.C0' [   -0.0455 ,  0.0047,0.5*gap_size]
      Ca_HH.C0' [   -0.0068 ,  0.0471,0.5*gap_size]
      Ca_HH.C0' [   -0.0067 ,  0.0744,0.5*gap_size]
      Ca_HH.C0' [    0.0000 , -0.0120,0.5*gap_size]
      Ca_HH.C0' [   -0.0061 , -0.1992,0.5*gap_size]
      Ca_HH.C0' [    0.0003 , -0.0173,0.5*gap_size]
      Ca_HH.C0' [    0.0130 , -0.2420,0.5*gap_size]
      Ca_HH.C0' [   -0.1248 , -0.0410,0.5*gap_size]
      Ca_HH.C0' [   -0.0766 , -0.1811,0.5*gap_size]
      Ca_HH.C0' [   -0.1385 , -0.0463,0.5*gap_size]
      Ca_HH.C0' [   -0.0108 , -0.2276,0.5*gap_size]
      Ca_HH.C0' [    0.0566 , -0.2865,0.5*gap_size]
    }
    SITE_DIAMETER = 0.005
  }


RELEASE_boutonsensoraz0 CUBIC_RELEASE_SITE {
  LOCATION = [-0.1240 ,  -0.1047  ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor0.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz1 CUBIC_RELEASE_SITE {
  LOCATION = [ -0.1240 ,   0.1075 ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor1.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz2 CUBIC_RELEASE_SITE {
  LOCATION = [ -0.0744 ,  -0.1264   ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor2.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz3 CUBIC_RELEASE_SITE {
  LOCATION = [ -0.0248 ,  -0.1334 ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor3.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz4 CUBIC_RELEASE_SITE {
  LOCATION = [ -0.0744 ,  -0.0477 ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor4.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz5 CUBIC_RELEASE_SITE {
  LOCATION = [  -0.0744 ,   0.0522 ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor5.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz6 CUBIC_RELEASE_SITE {
  LOCATION = [0.0248 ,  -0.1237  ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor6.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz7 CUBIC_RELEASE_SITE {
  LOCATION = [ 0.0248,   -0.0681 ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor7.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz8 CUBIC_RELEASE_SITE {
  LOCATION = [ 0.0744 ,  -0.0860  ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor8.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz9 CUBIC_RELEASE_SITE {
  LOCATION = [0.0744,   -0.2310  ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor9.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}
RELEASE_boutonsensoraz10 CUBIC_RELEASE_SITE {
  LOCATION = [ 0.1240,   -0.1338  ,0.5*gap_size+1.5 *fuzz+0.002]
  LIGAND =  release_sensor10.a.x0
  NUMBER_TO_RELEASE = 1
  SITE_DIAMETER = [0.001,0.001,0.001]
}


  RELEASE_pumps  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[topandbottom]
    MOLECULE = generic_pump.U'
    NUMBER_TO_RELEASE=0
  }

  RELEASE_ATP.CaB  RELEASE_SITE
  {
    SHAPE = tissue.bouton_box_top[ALL]
    MOLECULE = ATP.CaB
    CONCENTRATION=atp_concentration * bound_atp_fraction
  }
  RELEASE_ATP.MgB  RELEASE_SITE
  {
    SHAPE = tissue.bouton_box_top[ALL]
    MOLECULE = ATP.MgB
    CONCENTRATION=atp_concentration * mgbound_atp_fraction
  }
  RELEASE_ATP.U  RELEASE_SITE
  {
    SHAPE = tissue.bouton_box_top[ALL]
    MOLECULE = ATP.U
    CONCENTRATION=atp_concentration * unbound_atp_fraction
  }

  RELEASE_EGTA.B  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = EGTA.B
    CONCENTRATION=EGTA_concentration * EGTA_bound_fraction
  }
  RELEASE_EGTA.U  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = EGTA.U
    CONCENTRATION=EGTA_concentration * EGTA_unbound_fraction
  }

  RELEASE_BAPTA.B  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = BAPTA.B
    CONCENTRATION=BAPTA_concentration * BAPTA_bound_fraction
  }
  RELEASE_BAPTA.U  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = BAPTA.U
    CONCENTRATION=BAPTA_concentration * BAPTA_unbound_fraction
  }


  RELEASE_bouton_slowB  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = slow_sp.B
    CONCENTRATION=slow_cbp_concentration * bound_cbp_fraction
  }

  RELEASE_bouton_slowU  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = slow_sp.U
    CONCENTRATION=slow_cbp_concentration * unbound_cbp_fraction
  }

  RELEASE_bouton_parvalbuminB  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = parvalbumin.B
    CONCENTRATION=parvalbumin_concentration * bound_parvalbumin_fraction
  }
  RELEASE_bouton_parvalbuminU  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = parvalbumin.U
    CONCENTRATION=parvalbumin_concentration * unbound_parvalbumin_fraction
  }
  RELEASE_bouton_parvalbuminM  RELEASE_SITE
  {
    SHAPE = tissue.bouton.bouton0[ALL]
    MOLECULE = parvalbumin.M
    CONCENTRATION=parvalbumin_concentration * mgbound_parvalbumin_fraction
  }


}


REACTION_DATA_OUTPUT {
  OUTPUT_BUFFER_SIZE=10
  STEP = freq
  { COUNT[ Ca_HH.O,WORLD] } => "Cachan.O." & seed_str

  { COUNT[ release_sensor0.a.x6, WORLD]+ COUNT[ release_sensor0.b.x6, WORLD]+ COUNT[ release_sensor0.c.x6, WORLD]+ COUNT[ release_sensor0.d, WORLD] } => "x0." & seed_str
  { COUNT[ release_sensor1.a.x6, WORLD]+ COUNT[ release_sensor1.b.x6, WORLD]+ COUNT[ release_sensor1.c.x6, WORLD]+ COUNT[ release_sensor1.d, WORLD] } => "x1." & seed_str
  { COUNT[ release_sensor2.a.x6, WORLD]+ COUNT[ release_sensor2.b.x6, WORLD]+ COUNT[ release_sensor2.c.x6, WORLD]+ COUNT[ release_sensor2.d, WORLD] } => "x2." & seed_str
  { COUNT[ release_sensor3.a.x6, WORLD]+ COUNT[ release_sensor3.b.x6, WORLD]+ COUNT[ release_sensor3.c.x6, WORLD]+ COUNT[ release_sensor3.d, WORLD] } => "x3." & seed_str
  { COUNT[ release_sensor4.a.x6, WORLD]+ COUNT[ release_sensor4.b.x6, WORLD]+ COUNT[ release_sensor4.c.x6, WORLD]+ COUNT[ release_sensor4.d, WORLD] } => "x4." & seed_str
  { COUNT[ release_sensor5.a.x6, WORLD]+ COUNT[ release_sensor5.b.x6, WORLD]+ COUNT[ release_sensor5.c.x6, WORLD]+ COUNT[ release_sensor5.d, WORLD] } => "x5." & seed_str
  { COUNT[ release_sensor6.a.x6, WORLD]+ COUNT[ release_sensor6.b.x6, WORLD]+ COUNT[ release_sensor6.c.x6, WORLD]+ COUNT[ release_sensor6.d, WORLD] } => "x6." & seed_str
  { COUNT[ release_sensor7.a.x6, WORLD]+ COUNT[ release_sensor7.b.x6, WORLD]+ COUNT[ release_sensor7.c.x6, WORLD]+ COUNT[ release_sensor7.d, WORLD] } => "x7." & seed_str
  { COUNT[ release_sensor8.a.x6, WORLD]+ COUNT[ release_sensor8.b.x6, WORLD]+ COUNT[ release_sensor8.c.x6, WORLD]+ COUNT[ release_sensor8.d, WORLD] } => "x8." & seed_str
  { COUNT[ release_sensor9.a.x6, WORLD]+ COUNT[ release_sensor9.b.x6, WORLD]+ COUNT[ release_sensor9.c.x6, WORLD]+ COUNT[ release_sensor9.d, WORLD] } => "x9." & seed_str
  { COUNT[ release_sensor10.a.x6, WORLD]+ COUNT[ release_sensor10.b.x6, WORLD]+ COUNT[ release_sensor10.c.x6, WORLD]+ COUNT[ release_sensor10.d, WORLD] } => "x10." & seed_str
  { COUNT[ io_hh,WORLD] } => "ica." & seed_str
}