I was trying to run simulations involving to successively locate a set of post-synaptic sites (clustered in space, i.e. within a single section) systematically across the entire dendritic tree in a detailed 3D reconstuction of a neuron, activate them near synchronously, and record the voltage trace at the soma.
For this I originally used code that looked like this in pseudocode:
Code: Select all
load_file("nrngui.hoc")
SecList = new SectionList()
populate SecList
forsec SecList {
set all parameters of the simulation, e.g. site location, site conductance level, etc.
run()
collect somatic voltage trace measures
}
I have worked out a simple example of this:
Code: Select all
objref SecList, syn, nc, ns
celsius = 28
v_init = -75
create soma, dend
access soma
connect soma(1), dend(0)
SecList = new SectionList()
dend SecList.append()
soma {
L = 5
diam = 5
cm = 1
}
dend{
L = 50
diam = 1.5
nseg = 99
cm = 2
}
forall Ra = 150
forall insert pas
forall g_pas = 1/6200
forall e_pas = v_init
dend ns = new NetStim( 0.5 )
ns.interval = 1
ns.number = 1
ns.start = 100
ns.noise = 0
dend syn = new Exp2Syn( 0.5 )
syn.tau1 = 0.5
syn.tau2 = 5
syn.e = 0
nc = new NetCon( ns, syn )
nc.weight = 0.0005
load_file("Session.ses")
Graph[0].family(1)
Graph[0].color(1)
Graph[0].brush(4)
run()
Graph[0].color(2)
Graph[0].brush(1)
forsec SecList { run() }
Code: Select all
{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List() scene_list_ = new List()}
{pwman_place(0,0,0)}
{
xpanel("RunControl", 0)
v_init = -75
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 = 300
xvalue("t","t", 2 )
tstop = 300
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.17
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(63,120)
}
{
save_window_ = new Graph(0)
save_window_.size(0,300,-80,40)
scene_vector_[2] = save_window_
{save_window_.view(0, -80, 300, 120, 363, 122, 300.6, 200.8)}
graphList[0].append(save_window_)
save_window_.save_name("graphList[0].")
save_window_.addexpr("v(.5)", 1, 1, 0.8, 0.9, 2)
}
objectvar scene_vector_[1]
{doNotify()}
Red trace results from a run() call inside of a section access loop.
So, now I know the workaround in my case: use section access (forall{}, forsec{}, ifsec{}, etc.) to set simulation parameters, then perform simulation always outside of such loops.
however I would like to understand the reason why the architecture my code was originally based on does not seem to be safe, but have been unable to pinpoint it in the documentation so far...
Thank you for your help.