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.
Custom reaction rates
Moderators: hines, wwlytton, ramcdougal
-
- Posts: 267
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: Custom reaction rates
If you want to customize the dynamics to be (potentially) not-mass-action, use the custom_dynamics=True keyword argument:
(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.)
Code: Select all
reaction = rxd.Reaction(2 * hydrogen + oxygen > water, reac_speed, custom_dynamics=True)