Using include_flux() properly

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
Posts: 5
Joined: Wed Jul 31, 2019 5:14 pm

Using include_flux() properly

Post by amerg »

I have been attempting to use Node.include_flux() similarly to ... .py#tabs-2 My problem is that after setting up a simple test flux value using these lines

Code: Select all

for nd in self.ip3.nodes(sec):
the ip3 concentration value doesn't seem at all affected. I've looked at the example code in the project and at, but it's not clear if there are any steps I'm missing. Are there any additional steps I need to take to properly set up include_flux()?
Posts: 47
Joined: Tue Apr 18, 2017 10:05 am

Re: Using include_flux() properly

Post by adamjhn »

Thanks for bringing this oversight to our attention; support for node.include_flux was accidentally broken with the release of NEURON 7.7. (It works in 7.6.x). This will be remedied in 7.7.3.

In the meantime it is possible to achieve the outcome of include flux using a Parameter and a Rate. For example;

Code: Select all

from neuron import h, rxd


sec = h.Section(name="sec")
sec.L = 10 
sec.nseg = 11
sec.diam = 5

cyt = rxd.Region(h.allsec(), name="cyt", nrn_region="i")
ip3 = rxd.Species(cyt, name="ip3", initial=0)

# Used to rescale rate from mM/ms to molecules/ms used in include_flux
scale = 602214.129 

# Specify the parameter values based using an anonymous function of the nodes
source_param  = rxd.Parameter(
    value=lambda nd: 1.0/scale/nd.volume if nd.segment == sec(0.5) else 0)

# flux of 1000 molecules/ms restricted to sec(0.5)
my_include_flux = rxd.Rate(ip3, source_param * 1000)

The two key parts of the above solution are the “if” in the source_param definition and multiplying source_param by the molecules/ms in the call to Rate.
Post Reply