/********************************************************************
initialization routines                        
*************************************************/
initchannels()

proc init() {

     /* add initchannels() to init(), so parameter changes show up */
     initchannels()       
     finitialize(v_init)
     fcurrent()
}


/********************************************************************
set simulation parameters for the simulation                           
*************************************************/
dt=0.1
tstop=300
steps_per_ms=10


/********************************************************************
main control window                            
*************************************************/
objref contrl
contrl = new VBox()
contrl.intercept(1)
nrncontrolmenu()
contrl.intercept(0)
contrl.map("Control",1,500,-1,-1)


/********************************************************************
start point of AMPA and NMDA                   
*************************************************/
objref synAmpa  
spine_head synAmpa = new ampa(0.5)  
 
objref nc1, nil  
nc1 = new NetCon(nil, synAmpa)  
nc1.weight = 240
nc1.delay = 0 

objref synNmda  
spine_head synNmda = new nmda (0.5)  
 
objref nc2, nil  
nc2 = new NetCon(nil, synNmda)  
nc2.weight = 110
nc2.delay = 0 

spine_neck.diam=0.0394

objref syntimes  
syntimes = new Vector(1)  
syntimes.x[0] = 20   
 
objref fih  
fih = new FInitializeHandler("loadqueue()")  
proc loadqueue() { local ii  
  for ii=0,syntimes.size()-1 {
	nc1.event(syntimes.x[ii]) 
	nc2.event(syntimes.x[ii]) 
	} 
}


/********************************************************************
output graphs                                  
*************************************************/
objref g1
g1 = new Graph()
g1.addvar("somaA.v(0.5)",1,0)
g1.size(0,tstop,-75,50)
graphList[0].append(g1)

objref g2
g2 = new Graph()
g2.addvar("spine_head.v(0.5)",1,0)    
g2.size(0,tstop,-75,50)
graphList[0].append(g2)

objref g3
g3 = new Graph()
g3.addvar("spine_head.cai(0.5)",1,0)    
g3.size(0,tstop,-75,50)
graphList[0].append(g3)

objref g4
g4= new Graph()
g4.addvar("spine_head.iampa_canmda(0.5)",1,0)
g4.addvar("spine_head.inmda_canmda(0.5)",1,0)
g4.addvar("spine_head.irtype_canmda(0.5)",1,0)       
g4.size(0,tstop,-75,50)
graphList[0].append(g4)

finitialize(v_init)
fcurrent()
run()