//=============================================
//            Granule Cells with Spines
//=============================================

load_file("nrngui.hoc")
xopen("$(NEURONHOME)/lib/hoc/noload.hoc") // standard run tools
load_file("GC_def.hoc")

v_init  = -70 
tstop   = 2500
celsius = 35

MUSCAR = 0  // 1: Muscarinic effect on; 0: OFF

objref Gran
Gran = new Granule(MUSCAR)

load_file("GC_save.hoc")

objref stim1, stim2, stim3, stim4
Gran.soma stim1 = new IClamp(0.5)
Gran.soma stim2 = new IClamp(0.5)
Gran.soma stim3 = new IClamp(0.5)
Gran.soma stim4 = new IClamp(0.5)

stim1.del = 0       // 500
stim1.dur = tstop
stim1.amp = 0.0     //  0.0102/0.01 for ADP; 0.0105 for AHP  | 0.0106/0.116 for CCH

stim2.del = 500
stim2.dur = 50     // 
stim2.amp = 0.0    //  

stim3.del = 1000
stim3.dur = 600    // 500 for ADP
stim3.amp = 0.03   // 0.103/0.115 for ADP; 0.118 for AHP; 0.1 for CCH

stim4.del = 1800
stim4.dur = 50
stim4.amp = -0.0    // 


objref g1,g2,g3,g4,g5,g6,g7

proc fig1()  {

g1 = new Graph(0)
addplot(g1, 0)
g1.size(0,tstop,-80,50)
g1.view(0,-80,tstop,130, 0,150,500,160)
g1.addvar("Soma.V", "Gran.soma.v(0.5)", 3, 1, 0.8, 0.9, 2)  //1: black; 2: red; 3: blue

g6 = new Graph(0)
addplot(g6, 0)
g6.size(0,tstop,-80,50)
g6.view(0,-80,tstop,130, 0,500,500,160)
g6.addvar("Dend.V", "Gran.dend.v(0.5)", 2, 1, 0.8, 0.9, 2)  


g2 = new Graph(0)
addplot(g2, 0)
g2.size(0,tstop,0,0.5)
g2.view(0,0,tstop,0.5, 0,700,500,130)
g2.addvar("Dend.Ca", "Gran.dend.cai", 2, 2, 0.8, 0.9, 2)  

g7 = new Graph(0)
addplot(g7, 0)
g7.size(0,tstop,0,1)
g7.view(0,0,tstop,1, 0,900,500,150)
g7.addvar("IA.m", "Gran.dend.m_kamt", 5, 2, 0.8, 0.9, 2) 
g7.addvar("IA.h", "Gran.dend.h_kamt", 1, 2, 0.8, 0.9, 2)  

g3 = new Graph(0)
addplot(g3, 0)
g3.size(0,tstop,-0.05,0.05)
g3.view(0,-0.05,tstop,0.1, 0,900,500,130)
g3.addvar("IA", "Gran.dend.ik_kamt", 3, 2, 0.8, 0.9, 2)  


/*

g4 = new Graph(0)
addplot(g4, 0)
g4.size(0,tstop,0,1)
g4.view(0,0,tstop,1, 0,900,500,150)
g4.addvar("Ican.m", "Gran.dend.m_Ican", 5, 2, 0.8, 0.9, 2)  //1: black; 2: red; 3: blue

g5 = new Graph(0)
addplot(g5, 0)
g5.size(0,tstop,0,2)
g5.view(0,0,tstop,2, 0,450,500,130)
g5.addvar("Soma.Ca", "Gran.soma.cai", 2, 2, 0.8, 0.9, 2)
*/

}

fig1()
run()
save_data()