Page 1 of 1

Custom reaction rates

Posted: Mon Jun 11, 2018 11:25 am
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.

Re: Custom reaction rates

Posted: Mon Jun 11, 2018 11:28 am
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.)