callbacks.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. .. _api-callbacks:
  2. *********
  3. Callbacks
  4. *********
  5. MolWallHitInfo
  6. ==============
  7. Data structure passed to a callback function registered through
  8. Model.register_mol_wall_hit_callback.
  9. Example: `1300_wall_hit_callback/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1300_wall_hit_callback/model.py>`_
  10. Attributes:
  11. ***********
  12. .. _MolWallHitInfo__molecule_id:
  13. molecule_id: int
  14. ----------------
  15. | Id of molecule that hit the wall.
  16. .. _MolWallHitInfo__geometry_object:
  17. geometry_object: GeometryObject
  18. -------------------------------
  19. | Object that was hit.
  20. .. _MolWallHitInfo__wall_index:
  21. wall_index: int
  22. ---------------
  23. | Index of the wall belonging to the geometry_object.
  24. .. _MolWallHitInfo__time:
  25. time: float
  26. -----------
  27. | Time of the hit.
  28. .. _MolWallHitInfo__pos3d:
  29. pos3d: List[float]
  30. ------------------
  31. | Position of the hit.
  32. .. _MolWallHitInfo__time_before_hit:
  33. time_before_hit: float
  34. ----------------------
  35. | The time when the molecule started to diffuse towards the hit wall.
  36. | It is either the start of the molecule's diffusion or
  37. | when the molecule reflected from another wall.
  38. .. _MolWallHitInfo__pos3d_before_hit:
  39. pos3d_before_hit: List[float]
  40. -----------------------------
  41. | Position of the molecule at time_before_hit.
  42. ReactionInfo
  43. ============
  44. Data structure passed to a reaction callback registered with
  45. Model.register_reaction_callback.
  46. Example: `1800_vol_rxn_callback/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1800_vol_rxn_callback/model.py>`_
  47. Attributes:
  48. ***********
  49. .. _ReactionInfo__type:
  50. type: ReactionType
  51. ------------------
  52. | Specifies whether the reaction is unimolecular or bimolecular and
  53. | also provides information on reactant types.
  54. .. _ReactionInfo__reactant_ids:
  55. reactant_ids: List[int]
  56. -----------------------
  57. | IDs of the reacting molecules, contains 1 ID for a unimolecular or a molecule+surface class reaction,
  58. | 2 IDs for a bimolecular reaction.
  59. | For a bimolecular reaction, the first ID is always the molecule that diffused and the second one
  60. | is the molecule that was hit.
  61. | IDs can be used to obtain the location of the molecules. The position of the first molecule obtained through
  62. | model.get_molecule() is the position of the diffusing molecule before the collision.
  63. | All the reactants are removed after return from this callback, unless they are kept by the reaction such as A in A + B -> A + C.
  64. .. _ReactionInfo__product_ids:
  65. product_ids: List[int]
  66. ----------------------
  67. | IDs of reaction product molecules. They already exist in the simulated system together with reactants; however reactants
  68. | will be removed after return from this callback.
  69. .. _ReactionInfo__reaction_rule:
  70. reaction_rule: ReactionRule
  71. ---------------------------
  72. | Reaction rule of the reaction that occured.
  73. .. _ReactionInfo__time:
  74. time: float
  75. -----------
  76. | Time of the reaction.
  77. .. _ReactionInfo__pos3d:
  78. pos3d: List[float]
  79. ------------------
  80. | Specifies where reaction occurred in the 3d space, the specific meaning depends on the reaction type\:
  81. | - unimolecular reaction - position of the reacting molecule,
  82. | - volume-volume or surface-surface reaction - position of the first reactant,
  83. | - volume-surface reaction - position where the volume molecule hit the wall with the surface molecule.
  84. .. _ReactionInfo__geometry_object:
  85. geometry_object: GeometryObject
  86. -------------------------------
  87. | The object on whose surface where the reaction occurred.
  88. | Set only for surface reactions or reactions with surface classes.
  89. | - default argument value in constructor: None
  90. .. _ReactionInfo__wall_index:
  91. wall_index: int
  92. ---------------
  93. | Set only for surface reactions or reactions with surface classes.
  94. | Index of wall belonging to the geometry_object where the reaction occured,
  95. | i.e. wall where a volume molecule hit the surface molecule or
  96. | wall where the diffusing surface reactant reacted.
  97. | - default argument value in constructor: -1
  98. .. _ReactionInfo__pos2d:
  99. pos2d: List[float]
  100. ------------------
  101. | Set only for surface reactions or reactions with surface classes.
  102. | Specifies where reaction occurred in the 2d UV coordinates defined by the wall where the reaction occured,
  103. | the rspecific meaning depends on the reaction type\:
  104. | - unimolecular reaction - position of the reacting molecule,
  105. | - volume-surface and surface-surface reaction - position of the second reactant.
  106. | - default argument value in constructor: None