Using include_flux() properly

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

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

Using include_flux() properly

Post by amerg » Tue Aug 20, 2019 8:42 pm

I have been attempting to use Node.include_flux() similarly to https://senselab.med.yale.edu/ModelDB/S ... .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):
	nd.include_flux(1000.0)
the ip3 concentration value doesn't seem at all affected. I've looked at the example code in the project and at node.py, 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()?

adamjhn
Posts: 24
Joined: Tue Apr 18, 2017 10:05 am

Re: Using include_flux() properly

Post by adamjhn » Wed Aug 21, 2019 4:43 pm

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

h.load_file("stdrun.hoc")    

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(
    cyt,
    name="sources",
    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)

h.finitialize(-70)
h.continuerun(10)
print(ip3.nodes.concentration)
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