Custom reaction rates

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
Tuoma
Posts: 21
Joined: Mon Apr 23, 2018 6:59 am

Custom reaction rates

Post by Tuoma »

How can I customize the reaction rates? (Do you have a tutorial on it somewhere?)

To be more concrete, I thought I could replace

reaction = rxd.Reaction(2 * hydrogen + oxygen > water, 1.0)

by

reac_speed = 1.0*hydrogen**2*oxygen
reaction = rxd.Reaction(2 * hydrogen + oxygen > water, reac_speed)

It runs without errors but it ends up with different time courses of the species. Eventually I would like to make the rate of a reaction proportional to the concentration of the reactant (not its square) even though the reactant has a factor 2 like in the reaction above.
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Custom reaction rates

Post by ramcdougal »

If you want to customize the dynamics to be (potentially) not-mass-action, use the custom_dynamics=True keyword argument:

Code: Select all

reaction = rxd.Reaction(2 * hydrogen + oxygen > water, reac_speed, custom_dynamics=True)
(What you were getting was mass action where the "constant" part of the mass action was reac_speed... i.e. oxygen was changing by -1.0*hydrogen**4 * oxygen**2.)
Post Reply