/*--------------------------------------------------------------
	TEMPLATE FILE FOR DEFINING PALLIDIAL NEURONS - Parallel version
	--------------------------------------------------

	One compartment model and currents derived from:

 	Cooper and Nambu papers

	Dongchul C. Lee, Cleveland Clinic, 2005

	May 2006 parallel code - PJ Hahn

--------------------------------------------------------------*/

begintemplate pGPe		// create a new template object

public soma, synlist, connect2target, is_art

objref synlist

create soma

proc init() {

  soma {
	diam = 60		// geometry 
	L = 60			// so that area is about 10000 um2
	nseg = 1
	Ra = 200
	cm = 1

	insert myions //dummy mechanism used to set initial ion concentrations

	insert GPeA

		gnabar_GPeA = 0.04     //Fast Na
		gkdrbar_GPeA = 0.0042  // Delayed rectifier
		gkcabar_GPeA = 0.1e-3  //[S/cm2]
		gcatbar_GPeA = 6.7E-5  // T current
		kca_GPeA = 2           //Ca removal rate [1/ms] 	
		gl_GPeA = 4E-5         //Leakage current	

	synlist = new List()
  
	synapses($1,$2,$3) // $1 numStrGpe, $2 numSTNGPe, $3 numGPeGPe
  }


  cai0_ca_ion = 5e-6 //mM 
  cao0_ca_ion = 2 
  ki0_k_ion = 105 //calculated so that Nernst potential is same as in paper
  ko0_k_ion = 3
  nao0_na_ion = 108
  nai0_na_ion = 10

}



proc connect2target() { //$o1 target object, $o2 returned NetCon
	soma $o2 = new NetCon(&v(1), $o1)
}



objref syn_
proc synapses() { // $1 numStrGpe, $2 numSTNGPe, $3 numGPeGPe

// GABAergic striatal inputs
//	numStrGPe = 	

	for i=0,$1 - 1 {
		soma syn_ = new GABAa_S(.5)
		syn_.Cmax = 1
		synlist.append(syn_)
	}


// glutamatergic STN inputs
// set in pBGconst	numSTNGPe = 	

	for i=0,$2 - 1 {
		soma syn_ = new AMPA_S(.5)
		syn_.Cmax = 1
		synlist.append(syn_)
	}


// GABAergic GPe inputs
// set in pBGconst	numGPeGPe = 	

	for i=0,$3 - 1 {
		soma syn_ = new GABAa_S(.5)
		syn_.Cmax = 1
		synlist.append(syn_)
	}


}



proc is_art() {
	return 0
}


endtemplate pGPe