/*

Script to add STN synaps es (AMPA synapses from subthalamic nucleus) to GP model.

The compartments that re ceive the inputs must be listed in an ascii text file.

*/

 

str STNfilename = “stn_syns.asc”

randseed 78923456

str stncompartment

 

//create input element t ree outside of the cell path

if (!{exists /inputs})

      create neutral /inputs

end

create neutral /inputs/STN

num_STN = 0

 

// Open the file with th e list of compartment names

// File MUST NOT have an y blank lines at the end, or function will fail.

openfile {STNfilename} r

stncompartment = {readfile {STNfilename}}

//cycle through STN inpu t compartments

while (! {eof {STNfilename}})

      num_STN = {num_STN} + 1

      //Add AMPA synapse from library

      copy /library/AMPA {cellpath}/{stncompartment}/AMPA

      addmsg  {cellpath}/{stncompartment}/AMPA \

             {cellpath}/{stncompartment} CHANNEL Gk Ek

      addmsg  {cellpath}/{stncompartment} \

             {cellpath}/{stncompartment}/AMPA VOLTAGE Vm

 

      //set up timetable

      create neutral /inputs/STN/{stncompartment}

      create timetable /inputs/STN/{stncompartment}/timetable

 

      if ({STN_rate} > 0)

             setfield /inputs/STN/{stncompartment}/timetable        \

                   maxtime {rundur} act_val 1.0 method 2            \

                   meth_desc1 {1/{STN_rate}} meth_desc2 0.005 meth_desc3 3    

             call /inputs/STN/{stncompartment}/timetable TABFILL

      end

 

      //set up spikegen

      create spikegen /inputs/STN/{stncompartment}/spikegen

         setfield /inputs/STN/{stncompartment}/spikegen                   \

             output_amp 1 thresh 0.5

 

      //connect timetables to AMPA synapses

      if ({STN_rate} > 0)

             addmsg /inputs/STN/{stncompartme nt}/timetable \

                   /inputs/STN/{s tncompartment}/spikegen INPUT activation

             addmsg /inputs/STN/{stncompartme nt}/spikegen \

                   {cellpath}/{st ncompartment}/AMPA SPIKE

      end

     

      // get next compartment name

      stncompartment = {readfile {STNfilename}}

end

closefile {STNfilename}