load_file("nrngui.hoc")
load_file("morphology_mechanisms.hoc")
load_file("default.ses")

simlength = 2000

access soma

//**********************************************************************
proc simulate() { 
    
tstop = simlength
run()

}


//*************User-Interface*******************************************
dt = 0.001
nrnsecmenu(0.5, 1)

objref tlog
tlog = new Vector(simlength/dt)
tlog.record(&t)
objref vlog
vlog = new Vector(simlength/dt)
vlog.record(&soma.v(0.5))

simulate()

objref logfile
logfile = new File()
logfile.wopen ("v.dat")

for i=0,vlog.size()-1 {
    logfile.printf("%g %g\n", tlog.x[i], vlog.x[i])
}

logfile.close()

quit()