Page 1 of 1

Modeling extracellular space and a plasma membrane

Posted: Tue Apr 04, 2017 5:34 pm
by bschneiders
I have several questions regarding extracellular space and the plasma membrane using RxD. First of all, I've seen reference to extracellular space as a possible RxD conceptual region in the RxD documentation, but haven't seen an example of it actually defined. Is the best way to define it simply the following?

Code: Select all

ext = rxd.Region(h.allsec(), nrn_region='o')
Secondly, the reason I want to define "ext" above is so that I can set up a calcium pump in the plasma membrane (using a MultiCompartmentReaction). This pump also requires the plasma membrane to be defined as a region:

Code: Select all

plasma_membrane = rxd.Region(h.allsec(), geometry=rxd.DistributedBoundary(??))
My second question is with regards to the DistributedBoundary inputs, "area_per_vol" and "perim_per_area" (or similarly "scale" for ScalableBorder). Must these values be constant, or can they be variable? or reflect multiple constants? For example, in my code "h.allsec()" includes a dendrite, spine neck and spine head, each of which has a different diameter. I'd like for area_per_vol to depend on the diameter for each section (A = 2*V/r) = 4*V/diam for each compartment). I've been trying to iterate through the sections to call each diameter within the geometry definition but haven't gotten it to work. The clunky way to do this is to define three different membrane regions (i.e. membrane_dend, membrane_neck, membrane_head) and then the Distributed Boundary parameters can be entered as constants for each given membrane region. This would in turn require three separate pump definitions. Is there a smoother way to do this?

Lastly, the paper introducing RxD (McDougal, Hines, Lytton 2013) mentioned that there was limited support for extracellular diffusion at the time, but that this would hopefully be addressed in the future (pg. 4). Are there any updates on support for extracellular diffusion within RxD?


Re: Modeling extracellular space and a plasma membrane

Posted: Mon Apr 17, 2017 3:04 pm
by ramcdougal
In order to think about extracellular space, we have to decide what volume we're interested in. NEURON traditionally has a concept of, e.g. "nao" which is the sodium concentration "just outside" the plasma membrane (whatever that means; think of it as the Frankenhauser-Hodgkin space). The thing about the F-H space, is that diffusion there is constrained to follow the shape of the dendrites; that is, nothing diffuses from one cell to another or between physically nearby dendrites that are only connected far apart on the dendritic tree.

If you want the F-H space, then yes, use nrn_region='o', but also specify a geometry argument to define the shape.

I'm guessing you're probably more interested in allowing diffusion into the extracellular space away from the dendrites. We have an experimental package for that, which I'm happy to share with individual modelers (i.e. just email me: robert dot mcdougal at yale dot edu) but it's not quite ready for widespread release.

Honestly, I would write the calcium pump as a MOD file, mostly because you're likely to find that what you want (or something very close) already exists on ModelDB and because it avoids the messiness of specifying the geometry. That said: as currently distributed, an rxd.DistributedBoundary does not have an easy way to vary by location. However, it wouldn't be that hard to change: The code for all the geometry types is defined in All that would need changed is the calculation of self.neighbor_areas1d and self.volumes1d in DistributedBoundary.__init__.

Re: Modeling extracellular space and a plasma membrane

Posted: Tue Apr 18, 2017 10:32 am
by bschneiders
Thank you, this is very helpful. I will just use a MOD file for the pump instead. I will follow up if we decide to look into your experimental package for diffusion in extracellular space. Thanks!

Re: Modeling extracellular space and a plasma membrane

Posted: Wed Apr 26, 2017 3:10 pm
by ramcdougal
I pushed a version that supports extracellular diffusion to the development branch at

To try it, clone from there, compile, and run the code below. You should get two windows, one that shows a red square on a blue background (the initial condition), and one where diffusion over time has turned the square into a circle. (It's actually a 3D simulation, but the square and circle are the cross-sections.)

Code: Select all

from neuron import h, rxd
from matplotlib import pyplot
import time

# extracellular disabled by default until fully tested, so must override
rxd.options.enable.extracellular = True

# Need to have at least one Section or CVode.statistics will crash
s = h.Section()

extracellular = rxd.Extracellular(-100, -100, -50, 100, 100, 50, dx=4)

ca = rxd.Species(extracellular, name='ca', charge=2, d=1, initial=0)

ca_ext = ca[extracellular]
ca_ext.states3d[5:15, 5:15, :] = 1

# NEURON fact-of-life: always have to call this when manually changing values in a CVode simulation

pyplot.imshow(ca_ext.states3d[:, :, 0].copy(), interpolation='nearest', vmin=0, vmax=1, extent=ca_ext.extent('xy'), origin='lower')
pyplot.title('Initial, plane 0')
print 'initial sum: %g' % ca_ext.states3d.sum()
print 'advancing...'
start = time.time()
print '... advance took %gs' % (time.time() - start)
print 'final sum: %g' % ca_ext.states3d.sum()
print 'final max: %g' % ca_ext.states3d.max()

pyplot.imshow(ca_ext.states3d[:, :, 0], interpolation='nearest', vmin=0, vmax=1, extent=ca_ext.extent('xy'), origin='lower')
pyplot.title('t = %g, plane 0' % h.t)

The test assumes that the extracellular space occupies a volume_fraction=1 (i.e. 100% of the space; that there is nothing else out there) and that the tortuosity=1 (again, basically, that there's nothing else out there), but you can change this by sending in the appropriate options (scalars or arrays) to rxd.Extracellular.

At the beginning, there's a line that specifically enables extracellular support. Why? Because it's an experimental, incomplete version and that's there to remind you of that... in particular note that reactions on the extracellular space are not yet implemented in this version, and that non-unity volume fractions and tortuosity currently are only respected in fixed step simulations. (That's coming in a future commit though.)