//genesis (R.M. 4/9/2007)
// copied from Golgi cell in granular network

include defaults 

str Purkinje_dir = "../Purkinje_cell"


   float dt = 2.0e-5

// setting the clocks, this must de done BEFORE creating the hines solver !!!

   int i
   echo dt = {dt}
   for (i=0; i<=7; i=i+1)
        setclock {i} {dt}
   end
//   setclock 1 0.0005
   setclock 8 4.0e-5



include ../Purkinje_cell/Purk_const
include ../Purkinje_cell/Purk_chanload   // chansave // chanload
include ../Purkinje_cell/Purk_cicomp
//include ../Purkinje_cell/Purk_syn37dC
include ../Purkinje_cell/Purk_syn



   if (! {exists /library})
      create neutral /library
   end
   ce /library

// Make the prototypes of channels and compartments that can be invoked in .p files
   make_Purkinje_chans
 include ../Purkinje_cell/Purk_chanloadNaFshift
   make_Purkinje_syns
   make_Purkinje_comps
   make_Purkinje_spines

   if (!{exists /Purkinje_layer})
          create neutral /Purkinje_layer
   end

   str cellpath = "/Purkinje_cell"

// read cell data from .p file
   readcell ../Purkinje_cell/psmall.p {cellpath}

// rotate the cell so that PF-axis becomes x-axis
//   rotcoord   {cellpath}  {-3.1415927/2} -z
// There is a bug in rotcoord: compartments and their children are rotated,
// spines are rotated too, but spike heads and par channels are NOT,
// so let us do it brute force (each element separately).

 rotcoord /Purkinje_cell/##[CLASS=segment] {-3.1415927/2} -z  -fixkids

// add a spikegen object
   create spikegen {cellpath}/soma/spike
   setfield {cellpath}/soma/spike thresh -0.02 \
                                  abs_refract 0.001 \
                                  output_amp 1
   addmsg {cellpath}/soma {cellpath}/soma/spike INPUT Vm



       echo making hsolve of Purkinje cells
       create hsolve {cellpath}/solve
       ce {cellpath}/solve
       setfield . path "../##[][TYPE=compartment]" comptmode 1 chanmode 4 // {chanmode}
       setfield . computeIm 1
       call .  SETUP

setmethod 11

reset