1) You can reduce the number of nodes by changing dx. Also nthreads is only currently implemented for crxd extracellular reaction-diffusion.
Would a radial diffusion model be sufficient?
Radial diffusion can be implemented in rxd using multicompartment reactions, for example;
Code: Select all
from neuron import h, crxd as rxd
from matplotlib import pyplot
import numpy
h.load_file('stdrun.hoc')
dend = h.Section('dend')
dend.L = 100
dend.diam = 5
dend.nseg = 101
N = 5 # number of shells -- must be >= 2
dr = dend.diam/(2.0*N) # the thickness of the shells
# scale factor so the flux (Dca/dr)*Ca has units molecules/um^2/ms
mM_to_mol_per_um = 6.0221409e+23 * 1e-18
# Where -- shells and border between them
shells = []
border = []
for i in range(N-1):
shells.append(rxd.Region(h.allsec(), name='shell%i' % i,
geometry=rxd.Shell(float(i)/N, (1.0+i)/N)))
border.append(rxd.Region(h.allsec(), name='border%i' % i,
geometry=rxd.FixedPerimeter(2.0*h.PI*(1.0+i))))
# the outer shell corresponds NEURON section concentration e.g. dend(0.5).cai
shells.append(rxd.Region(h.allsec(), nrn_region='i', name='shell%i' % N,
geometry=rxd.Shell((N-1.0)/N, 1.0)))
# Who -- calcium with an inhomogeneous initial condition
Dca = 1.0 #um^2/ms
ca = rxd.Species(shells, d=Dca, name='ca', charge=2, initial=lambda nd:
1.0 if 49.5 < nd.x3d < 50.5 and nd.region == shells[0] else 60e-6)
# What -- use reactions to setup diffusion between the shells
cas = [] # calcium on the shells
for reg in shells:
cas.append(ca[reg])
# create the multi-compartment reactions between the pairs of shells
diffusions = []
for i in range(N-1):
diffusions.append(rxd.MultiCompartmentReaction(cas[i], cas[i+1],
mM_to_mol_per_um*Dca,
mM_to_mol_per_um*Dca,
border=border[i]))
# run for 5ms and plot the results
h.finitialize(-65)
h.continuerun(5)
pyplot.imshow(numpy.array(ca.nodes.concentration).reshape(N,dend.nseg),
origin='lower', extent=(0, dend.L, 0, dend.diam/2.0),
aspect='auto')
pyplot.colorbar()
pyplot.xlabel('x ($\mu$m)')
pyplot.ylabel('r ($\mu$m)')
pyplot.show()
2) Thanks for letting us know, this is not a bug per se as currently crxd supports 1D intracellular and 3D extracellular reaction-diffusion. We are actively developing a C/C++ version of intracellular 3D reaction-diffusion to add to crxd.
As crxd is faster but also less stable than rxd, I’d recommend trying your models in crxd first, if you run into difficulties, let us know and try rxd.