NEURON: The total number of cells, 1, is different than the number of user partition cells, 0
Posted: Thu Dec 15, 2022 8:46 am
Hi all, I'm using python neuron for an optimization task and to speed up the process I'm implementing this bit of code for the parallelization:
then I'm defining a section and a voltage clamp protocol:
Now the code made this way works fine, but the clamped section is the same, and based on my experience i saw that it's best to clamp a new cell everytime (later in the code i will do this clamp for many voltage steps). Thus what I do is calling the Section() object directly in the clamp function.
Without the code for the multisplit it works, but with that bit implemented I get the neuron message that's the title of this post, followed by an error message:
RuntimeError: hocobj_call error: hoc_execerror
pointing at h.finitialize()
Code: Select all
h.load_file("parcom.hoc")
p = h.ParallelComputeTool()
p.change_nthread(16,1)
p.multisplit(1)
Code: Select all
class Section():
def __init__(self):
self.soma = h.Section("name=soma")
self.soma.nseg = 1
self.soma.diam = 4
self.soma.L = 10
self.soma.Ra = 120
self.soma.cm = 1
self.soma.insert("na18a")
self.soma.gbar_na18a = 0.1
self.soma.ena = 60
def initialize():
h.finitialize()
h.run()
cell = Section()
def voltage_clamp_activation(voltage):
h.dt = 0.025
h.celsius = 32
h.tstop = 210
h.v_init = -70
ina = h.Vector()
ina.record(cell.soma(0.5)._ref_ina_na18a)
v = h.Vector()
v.record(cell.soma(0.5)._ref_v)
time = h.Vector()
time.record(h._ref_t)
clamp = h.SEClamp(cell.soma(0.5))
clamp.rs /= 100
clamp.dur1 = 100
clamp.amp1 = -70
clamp.dur2 = 100
clamp.amp2 = voltage
clamp.dur3 = 10
clamp.amp3 = -70
initialize()
return list(ina), v, time
a, b, c = voltage_clamp_activation(10)
Without the code for the multisplit it works, but with that bit implemented I get the neuron message that's the title of this post, followed by an error message:
RuntimeError: hocobj_call error: hoc_execerror
pointing at h.finitialize()