//run simulation with normal inhibition

// Create graphs for visualisation.
objref voltAP5,voltCont

voltCont = new Graph()
voltCont.addvar("soma.sec.v(0.5)",2,1)
voltCont.addvar("dend2Ref.sec.v(0.5)",4,1) 
voltCont.label("Control")
voltCont.exec_menu("Keep Lines")
voltCont.size(stimStart-20,tstop,-75,-15)

voltAP5 = new Graph()
voltAP5.addvar("soma.sec.v(0.5)",2,1)
//voltAP5.addvar("dend1Ref.sec.v(0.5)",3,1) 
voltAP5.addvar("dend2Ref.sec.v(0.5)",4,1)  
voltAP5.label("Control, no NMDA")
voltAP5.exec_menu("Keep Lines")
voltAP5.size(stimStart-20,tstop,-75,-15)
    
for(jj=1; jj<simul_iter+1; jj=jj+1){
    print jj
	// Clear excitation and then turn on select synapses.
	activateExcitation(cellList,-1,1) // clear excitation
	curExc_SR = activateExcitation(radiatumList,jj*nExcAct_SR,randShift) // activate excitatory synapses
	curExc_SLM = activateExcitation(tuftList,jj*nExcAct_SLM,randShift) // activate excitatory synapses
	
    shape_no=(jj/2)-1
    if (jj%2==1){shape_no=(jj-1)/2}
	ActSyn = set_gluSyn(curExc_SR, randShift, 0.1, norm_Pr_exc, shapeExc[shape_no])
	print "In SR, the number of activated synapses at each pulse are: ",ActSyn.x[0], ", " , ActSyn.x[1], ", " , ActSyn.x[2], ", " , ActSyn.x[3], ", " , ActSyn.x[4]
	 
	ActSyn = set_gluSyn(curExc_SLM, randShift/2, 0.1, norm_Pr_exc, shapeExc[shape_no])
	print "In SLM, the number of activated synapses at each pulse are: ",ActSyn.x[0], ", " , ActSyn.x[1], ", " , ActSyn.x[2], ", " , ActSyn.x[3], ", " , ActSyn.x[4]
	
    if (jj%2==1){curGr = graphList[0].append(voltCont) }
        init() 
        run()
        if (jj%2==1){graphList[0].remove(curGr-1)    }
        storeM_control.setcol(jj-1,recv_soma)
        storeM_control.setcol(jj-1+simul_iter,recv_tuft1) 
        storeM_control.setcol(jj-1+2*simul_iter,recv_tuft2) 
        storeM_control.setcol(jj-1+3*simul_iter,recv_tuft3)
        storeM_control.setcol(jj-1+4*simul_iter,recv_obl1) 
        storeM_control.setcol(jj-1+5*simul_iter,recv_obl2) 
        storeM_control.setcol(jj-1+6*simul_iter,recv_obl3)
        

    // Wash-in AP5, block NMDA conductance
    reset_NMDASyn()
    
    if (jj%2==1){curGr = graphList[0].append(voltAP5)   }
        init() 
        run()
        if (jj%2==1){graphList[0].remove(curGr-1)    }
        storeM_control.setcol(jj-1+7*simul_iter,recv_soma) 
        storeM_control.setcol(jj-1+8*simul_iter,recv_tuft1) 
        storeM_control.setcol(jj-1+9*simul_iter,recv_tuft2) 
        storeM_control.setcol(jj-1+10*simul_iter,recv_tuft3)
        storeM_control.setcol(jj-1+11*simul_iter,recv_obl1) 
        storeM_control.setcol(jj-1+12*simul_iter,recv_obl2) 
        storeM_control.setcol(jj-1+13*simul_iter,recv_obl3)
    
        
    reset_AMPASyn()    
}
// SAVE OUTPUT
//print2file(storeM_control,file_name2,ColLabel)