Reactions only when concentration above a certain limit?

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
Posts: 43
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Reactions only when concentration above a certain limit?

Post by bremen »


Is there a way to know the concentration of a species, during the simulation, so that it can be used to automatically start specific reactions?

I have found this command in the help: ... esOnRegion

Code: Select all

class neuron.rxd.species.SpeciesOnRegion(species, region) 
 " concentration - An iterable of the current concentrations"
Tried some combination but with no luck. Is it possible to have an example of how to correctly use it?
Thank you.

Posts: 43
Joined: Tue Apr 18, 2017 10:05 am

Re: Reactions only when concentration above a certain limit?

Post by adamjhn »

The formulas for rxd.Rate, etc need to be continuous, but you can approximate a threshold function using a sigmoidal shaped curve. For example, you can use rxdmath.tanh to remove calcium at a constant rate when it exceeds a threshold with a narrow transition period:

Code: Select all

from neuron import h, rxd
from neuron.rxd import rxdmath
from matplotlib import pyplot

# NEURON model
dend = h.Section('dend')

# Where -- define the regions
cyt = rxd.Region(h.allsec(), name = 'cyt', nrn_region = 'i')

# Who -- define the species
ca = rxd.Species(cyt, name = 'ca', charge = 2, initial = 1.0)

# What -- define the reactions
# remove calcium at 0.01mM/ms when it is above 0.1mM using a sigmoid function
threshold = 0.1
steepness = 100
ca_removal = rxd.Rate(ca, -0.01 * (1+rxdmath.tanh(steepness*(ca-threshold)))/2)

# record & run the simulation
t_vec = h.Vector()

ca_vec = h.Vector()


# plot the result
pyplot.plot(t_vec, ca_vec)
pyplot.xlabel('t (ms)')
pyplot.ylabel('Ca$^{2+}$ (mM)')
You may also find the rxd tutorial useful; ... index.html
Post Reply