maximum length for the name of a species?

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
Tuoma
Posts: 9
Joined: Mon Apr 23, 2018 6:59 am

maximum length for the name of a species?

Post by Tuoma » Wed Nov 14, 2018 10:59 am

I get a weird "Abort trap: 6" error that seems to depend on the length of the names of my species. MWE:

Code: Select all

from neuron import h, rxd
from pylab import *

h.load_file('stdrun.hoc')

dend = h.Section(name='dend')
cyt = rxd.Region([dend], name='cyt', nrn_region='i')

specNameLen=21
specs = []
vecs = []
vec_t = h.Vector()
vec_t.record(h._ref_t)
for i in range(0,2):
  specs.append(rxd.Species(cyt, name='X'*(specNameLen-5)+'spec'+str(i), charge=0, initial=rand(1)))
  vecs.append(h.Vector())
  vecs[i].record(specs[i].nodes(dend)(0.5)[0]._ref_concentration)

cvode = h.CVode()
cvode.active(1)
cvode.atol(1e-3)

h.continuerun(100)
print "Simulation done"
When I set specNameLen=21 or smaller, the code runs fine (Python 2.7.15, NEURON 7.6.2), but aborts for specNameLen=22 or larger.

ramcdougal
Posts: 207
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: maximum length for the name of a species?

Post by ramcdougal » Wed Nov 14, 2018 5:05 pm

What's happening is that NEURON currently assumes a limit on ion name lengths. You can see this without rxd in that the following two lines will crash NEURON:

Code: Select all

from neuron import h
h.ion_register('x'*50, 0)
If, as in your example code, you have a pure reaction-diffusion model (no ion channels) you can avoid this limitation by removing the "nrn_region='i'" from the definition of your rxd.Region.

I talked to Michael, and he thinks it would be fairly easy to remove the assumption or extend the length, but any such fix will be in a future version of NEURON. For now, unfortunately the best thing you can do (assuming you do have ion-channel activity) is to try to shorten your variable names.

Tuoma
Posts: 9
Joined: Mon Apr 23, 2018 6:59 am

Re: maximum length for the name of a species?

Post by Tuoma » Fri Nov 16, 2018 6:07 am

Thanks for the reply. However, the problem persists even if I remove "nrn_region='i'", or change it to None or 'o'.

Post Reply