{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[2]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List()  scene_list_ = new List()}
{pwman_place(0,0,0)}

//Begin SingleCompartment
{
load_file("single.hoc")
}
ocbox_ = new SingleCompartment(0)
ocbox_.inserter = new Inserter(0)
{object_push(ocbox_.inserter)}
{
mt.select("pas") i = mt.selected()
ms[i] = new MechanismStandard("pas")
ms[i].set("g_pas", 3.294e-05, 0)
ms[i].set("e_pas", -60, 0)
mstate[i]= 1
maction(i)
}
{object_pop() doNotify()}
{object_push(ocbox_)}
{inserter.v1.map()}
{endbox()}
{object_pop() doNotify()}
{
ocbox_ = ocbox_.vbox
ocbox_.map("SingleCompartment", 358, 137, 91.2, 96)
}
objref ocbox_
//End SingleCompartment

// calculate the real capacitance and g_pas values
access soma

cm = 1 
diam = 200 // Cm = 20 pF

// gLm=0.85 nS
g_pas = 0.85e-9/(PI*diam*L*1e-8)
e_pas = -85

//Begin LinearCircuit[0]
{
load_file("lincir.hoc", "LinearCircuit")
}
{
ocbox_ = new LinearCircuit(1)
}
{object_push(ocbox_)}
{version(2)}
{mkelm(1, 210, 140, 4, 0)}
38
{mklabel(0, "Re", 4.625, 30.374)}
{mklabel(1, "Vc", 16.162, 25.631)}
{restore_ic(1, -60)}
{mklabel(2, "Vm", 15, 15)}
{mkelm(6, 170, 70, 2, 0)}
{mkelm(1, 170, 115, 2.5, -1.5708)}
2000
{mklabel(0, "Rs", 20.906, 2.01)}
{mkelm(8, 250, 90, 2, 0)}
{mklabel(0, "soma(0.5)", 8.0724, -12.2756)}
{sel.extra_info.set("soma", 0.5) sel.extra_info.name(sel)}
{mkelm(4, 15, 160, 1.5, 3.14159)}
{mklabel(0, "VC", -4.3585, 24.605)}
{sel.extra_info.restore()}
3
10 -60
50 -90
10 -60
{mkelm(6, 0, 140, 2, 0)}
{mkelm(0, 250, 125, 1.5, -1.5708)}
{mkelm(7, 130, 140, 2, 0)}
100000
0
{mklabel(0, "Control", 0.423, 4.285)}
{mkelm(1, 130, 200, 4, 0)}
100000
{mklabel(0, "R2", 1.609, 22.553)}
{mkelm(1, 60, 160, 3, 0)}
100000
{mklabel(0, "R1", 1.6374, 22.233)}
{mkelm(6, 90, 100, 2, 0)}
{mkelm(0, 90, 180, 2, 1.5708)}
{mkelm(0, 170, 170, 3, -1.5708)}
{parasitic_ = 0  noconsist_ = 0}
{graphlist.append(new LincirGraph(this, 1))}
1
Control I (nA)
1 1 0.8 0.9 2
18.2747 23.0513 -0.720308 0.0326084 // graph size
25 137 308.16 261.12 // box size
// end info
{graphlist.append(new LincirGraph(this, 1))}
2
Vc (mV)
1 1 0.8 0.9 2
Vm (mV)
1 1 0.8 0.9 2
0 40 -90 0 // graph size
15 879 308.16 261.12 // box size
// end info
{g.exec_menu("Simulate")  tool(2)}
{sel = nil}
{object_pop()}
{
{
save_window_=ocbox_.g
save_window_.size(0,300,0,200)
scene_vector_[1] = save_window_
ocbox_.g = save_window_
save_window_.save_name("ocbox_.g")
save_window_.label(214.625, 170.374, "Re", 1, 1, 0.5, 0.5, 1)
save_window_.label(186.162, 165.631, "Vc", 1, 1, 0.5, 0.5, 1)
save_window_.label(265, 155, "Vm", 1, 1, 0.5, 0.5, 1)
save_window_.label(190.906, 117.01, "Rs", 1, 1, 0.5, 0.5, 1)
save_window_.label(258.072, 77.7244, "soma[1](0.5)", 1, 1, 0.5, 0.5, 1)
save_window_.label(10.6415, 184.605, "VC", 1, 1, 0.5, 0.5, 1)
save_window_.label(130.423, 144.285, "Control", 1, 1, 0.5, 0.5, 1)
save_window_.label(131.609, 222.553, "R2", 1, 1, 0.5, 0.5, 1)
save_window_.label(61.6374, 182.233, "R1", 1, 1, 0.5, 0.5, 1)
}
ocbox_.map("LinearCircuit[0]", 18, 374, 927.36, 496.32)
}
objref ocbox_
//End LinearCircuit[0]

// set lincir values

// Re
ElementBase[1].val.x[0] = 38

// Rs
ElementBase[3].val.x[0] = 1090

// R1, R2, gain
ElementBase[8].val.x[0] = 1e5
ElementBase[9].val.x[0] = 1e5
ElementBase[10].val.x[0] = 1e5

v_init = -60

{
xpanel("RunControl", 0)
v_init = -60
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 0
xvalue("t","t", 2 )
tstop = 50
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.025
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
screen_update_invl = 0.05
xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 )
realtime = 0
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(894,778)
}
objectvar scene_vector_[1]
{doNotify()}

// int & run, and then pick vector Control I and save to file