update_reactions
Short description
@author: Moritz F P Becker
- pyrid.reactions.update_reactions.convert_molecule_type(System, product_id, product_name, RBs, Particles, i)[source]
Converts a molecule to a different type.
- Parameters
- Systemobject
Instance of System class
- product_idint64
Id of the product molecule type.
- product_namestring
Name of the product molecule type.
- RBsobject
Instance of RBs class
- Particlesobject
Instance of Particles class
- iint64
Index of the molecule whose type to convert
- pyrid.reactions.update_reactions.convert_particle_type(System, product_id, Particles, i)[source]
Converts a particle to a different type.
- Parameters
- Systemobject
Instance of System class
- product_idint64
Id of the product particle type.
- Particlesobject
Instance of Particles class
- iint64
Index of the particle whose type to convert
- pyrid.reactions.update_reactions.delete_molecule(System, RBs, Particles, i)[source]
Removes a molecule and its reactions from the simulation.
- Parameters
- Systemobject
Instance of System class
- RBsobject
Instance of RBs class
- Particlesobject
Instance of Particles class
- iint64
Index of the molecule which to delete
- pyrid.reactions.update_reactions.delete_particles(System, RBs, Particles, i)[source]
Removes all particle belonging to a molecule and its reactions and bonds from the simulation.
- Parameters
- Systemobject
Instance of System class
- RBsobject
Instance of RBs class
- Particlesobject
Instance of Particles class
- iint64
Index of the molecule whose particles to delete
- pyrid.reactions.update_reactions.delete_reactions(System, i, type_id, educt_is_particle)[source]
Removes all reactions of an educt i scheduled for this time step.
- Parameters
- Systemobject
Instance of System class
- iint64
Index of the particle for which to delete all reactions
- pyrid.reactions.update_reactions.update_reactions(System, Particles, RBs)[source]
Evaluates the bimolecular and unimolecular reactions.
- Parameters
- Systemobj
Instance of System class.
- Particlesobj
Instance of Particle class.
- RBsobj
Instance of RBs (Rigid Bodies) class.
Notes
Reaction handler
We use a Gillespie reaction handler scheme, similar to the one used in ReaDDy:
All reactions events occuring within a time step are gathered in lists (a seperate list for each reaction that has been defined).
A reaction type is picked randomly, weighted by the its total reaction rate times the total number of reactions that are in the list of that type (the total reaction rate is the sum of the individual reaction path rates. Different reaction paths allow for the same educts to undergo, e.g., different fusion reactions or for a single molecule to convert to different products).
A random reaction event is picked from the list.
- If the reaction is bimolecular, the reaction probability Eq. (28) is tested against a random number between 0 and 1.
If the reaction was successfull, we pick a random reaction path, weighted by the path’s reaction rates. After the execution of the reaction, it is deleted from the list together with all the other reactions the educts participated in.
If the reaction was not successful, the reaction is deleted from the list.
If the reaction is unimolecular, it is always successful, since, for unimolecular reactions, we draw the time point of the next reaction event from the corresponding distribution (Gillespie SSA). As such, we pick a random reaction path, weighted by the individual path’s reaction rates. After the execution of the reaction, it is deleted from the list together with all the other reactions the educt participated in.
Go back to 2. until no reactions are left.
(28)\[p = 1-exp\Big(-\sum_{i \in paths} \lambda_i \cdot \Delta t \Big)\]Doi bimolecular reaction scheme
There exist different methods of how to model bimolecular reactions. PyRID, just as ReaDDy [23], uses the Doi scheme [24]. In this scheme, two molecules can react to a single product moelcule if their distance is less than some reaction radius R. In this case the reaction may occur with a microscopic reaction rate \(\lambda\).