simulation_setup.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. .. _api-simulation_setup:
  2. ****************
  3. Simulation setup
  4. ****************
  5. Config
  6. ======
  7. Class holds simulation configuration.
  8. Attributes:
  9. ***********
  10. .. _Config__seed:
  11. seed: int
  12. ---------
  13. | Random generator seed value.
  14. | - default argument value in constructor: 1
  15. .. _Config__time_step:
  16. time_step: float
  17. ----------------
  18. | Set the simulation time step to time_step seconds. 1e-6 (1us) is a common value.
  19. | One can set the time steps taken by individual molecules, but this
  20. | time step is still used as a default.
  21. | - default argument value in constructor: 1e-6
  22. .. _Config__use_bng_units:
  23. use_bng_units: bool
  24. -------------------
  25. | When False (default), MCell uses traditional MCell units for bimolecular reaction rates are:
  26. | \* [M^-1\*s^-1] for bimolecular reactions between either two volume molecules, a volume molecule
  27. | and a surface (molecule),
  28. | \* [um^2\*N^-1\*s^-1] bimolecular reactions between two surface molecules on the same surface.
  29. | When True, BioNetGen units for bimolecular reaction rates are:
  30. | \* [um^3\*N^-1\*s^-1] for any bimolecular reactions. Surface-surface reaction rate conversion assumes 10nm membrane thickness
  31. | BioNetGen units are compatible with BioNetGen's ODE, SSA, and PLA solvers given that seed species
  32. | is copy number (N), these units are not compatible with NFSim.
  33. | No other units are affected by this setting.
  34. | - default argument value in constructor: False
  35. .. _Config__surface_grid_density:
  36. surface_grid_density: float
  37. ---------------------------
  38. | Tile all surfaces so that they can hold molecules at N different positions per square micron.
  39. | - default argument value in constructor: 10000
  40. .. _Config__interaction_radius:
  41. interaction_radius: float
  42. -------------------------
  43. | Diffusing volume molecules will interact with each other when
  44. | they get within N microns of each other. The default is
  45. | 1/sqrt(PI \* Sigma_s) where Sigma_s is the surface grid density
  46. | (default or user-specified).
  47. | - default argument value in constructor: None
  48. .. _Config__intermembrane_interaction_radius:
  49. intermembrane_interaction_radius: float
  50. ---------------------------------------
  51. | Diffusing surface molecules will interact with surface molecules on other
  52. | walls when they get within N microns of each other. The default is
  53. | 1/sqrt(PI \* Sigma_s) where Sigma_s is the surface grid density
  54. | (default or user-specified).
  55. | When unset, the default value is computed as:
  56. | 1.0 / sqrt_f(MY_PI \* surface_grid_density).
  57. | - default argument value in constructor: None
  58. | Example: `3000_intermembrane_rxns/customization.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/3000_intermembrane_rxns/customization.py>`_
  59. .. _Config__vacancy_search_distance:
  60. vacancy_search_distance: float
  61. ------------------------------
  62. | Rather internal, there is usually no need to change this value.
  63. | Used in dynamic geometry (see Model.apply_vertex_moves()).
  64. | When a wall moves or its dimensions change, this is the maximum search distance
  65. | use when looking onto which tiles place the molecules on this wall.
  66. | If no empty tile is found within this distance, simulation fails.
  67. | - default argument value in constructor: 10
  68. | Example: `1200_dyn_vert_tetrahedron_vol_mol_multiple_changes/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/1200_dyn_vert_tetrahedron_vol_mol_multiple_changes/model.py>`_
  69. .. _Config__center_molecules_on_grid:
  70. center_molecules_on_grid: bool
  71. ------------------------------
  72. | If set to True, then all molecules on a surface will be
  73. | located exactly at the center of their grid element. If False, the
  74. | molecules will be randomly located when placed, and reactions
  75. | will take place at the location of the target (or the site of impact
  76. | in the case of 3D molecule/surface reactions).
  77. | - default argument value in constructor: False
  78. | Example: `1210_dyn_vert_tetrahedron_surf_mol_multiple_changes/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/1210_dyn_vert_tetrahedron_surf_mol_multiple_changes/model.py>`_
  79. .. _Config__partition_dimension:
  80. partition_dimension: float
  81. --------------------------
  82. | All the simulated 3d space is placed in a partition. The partition is a cube and
  83. | this partition_dimension specifies the length of its edge in um.
  84. | - default argument value in constructor: 10
  85. | Example: `1100_point_release/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/1100_point_release/model.py>`_
  86. .. _Config__initial_partition_origin:
  87. initial_partition_origin: List[float]
  88. -------------------------------------
  89. | Optional placement of the initial partition in um, specifies the left, lower front
  90. | point. If not set, value -partition_dimension/2 is used for each of the dimensions
  91. | placing the center of the partition to (0, 0, 0).
  92. | - default argument value in constructor: None
  93. .. _Config__subpartition_dimension:
  94. subpartition_dimension: float
  95. -----------------------------
  96. | Subpartition are spatial division of 3D space used to accelerate collision checking.
  97. | In general, partitions should be chosen to avoid having too many surfaces and molecules
  98. | in one subpartition.
  99. | If there are few surfaces and/or molecules in a subvolume, it is advantageous to have the
  100. | subvolume as large as possible. Crossing partition boundaries takes a small amount of time,
  101. | so it is rarely useful to have partitions more finely spaced than the average diffusion distance
  102. | of the faster-moving molecules in the simulation.
  103. | - default argument value in constructor: 0.5
  104. | Example: `2000_bngl_a_plus_b_to_c_partitioning/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2000_bngl_a_plus_b_to_c_partitioning/model.py>`_
  105. .. _Config__total_iterations:
  106. total_iterations: float
  107. -----------------------
  108. | Required for checkpointing so that the checkpointed model has information on
  109. | the intended total number of iterations.
  110. | Also used when generating visualization data files and also for other reporting uses.
  111. | Value is truncated to an integer.
  112. | - default argument value in constructor: 1000000
  113. .. _Config__check_overlapped_walls:
  114. check_overlapped_walls: bool
  115. ----------------------------
  116. | Enables check for overlapped walls. Overlapping walls can cause issues during
  117. | simulation such as a molecule escaping closed geometry when it hits two walls
  118. | that overlap.
  119. | - default argument value in constructor: True
  120. .. _Config__reaction_class_cleanup_periodicity:
  121. reaction_class_cleanup_periodicity: int
  122. ---------------------------------------
  123. | Reaction class cleanup removes computed reaction classes for inactive species from memory.
  124. | This provides faster reaction lookup faster but when the same reaction class is
  125. | needed again, it must be recomputed.
  126. | - default argument value in constructor: 500
  127. | Example: `2701_concentration_based_rxn_rate_cleanup_check/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2701_concentration_based_rxn_rate_cleanup_check/model.py>`_
  128. .. _Config__species_cleanup_periodicity:
  129. species_cleanup_periodicity: int
  130. --------------------------------
  131. | Species cleanup removes inactive species from memory. It removes also all reaction classes
  132. | that reference it.
  133. | This provides faster addition of new species lookup faster but when the species is
  134. | needed again, it must be recomputed.
  135. | - default argument value in constructor: 10000
  136. | Example: `2701_concentration_based_rxn_rate_cleanup_check/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2701_concentration_based_rxn_rate_cleanup_check/model.py>`_
  137. .. _Config__molecules_order_random_shuffle_periodicity:
  138. molecules_order_random_shuffle_periodicity: int
  139. -----------------------------------------------
  140. | Randomly shuffle the order in which molecules are simulated.
  141. | This helps to overcome potential biases that may occur when
  142. | molecules are ordered e.g. by their species when simulation starts.
  143. | The first shuffling occurs at this iteration, i.e. no shuffle is done at iteration 0.
  144. | Setting this parameter to 0 disables the shuffling.
  145. | - default argument value in constructor: 10000
  146. .. _Config__sort_molecules:
  147. sort_molecules: bool
  148. --------------------
  149. | Enables sorting of molecules for diffusion, this may improve cache locality and provide
  150. | slightly better performance.
  151. | Produces different results for the same seed when enabled because molecules are simulated
  152. | in a different order.
  153. | - default argument value in constructor: False
  154. .. _Config__memory_limit_gb:
  155. memory_limit_gb: int
  156. --------------------
  157. | Sets memory limit in GB for simulation run.
  158. | When this limit is hit, all buffers are flushed and simulation is terminated with an error.
  159. | - default argument value in constructor: -1
  160. | Example: `0200_memory_limit/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/nutmeg4_pymcell4/0200_memory_limit/model.py>`_
  161. .. _Config__initial_iteration:
  162. initial_iteration: int
  163. ----------------------
  164. | Initial iteration, used when resuming a checkpoint.
  165. | - default argument value in constructor: 0
  166. .. _Config__initial_time:
  167. initial_time: float
  168. -------------------
  169. | Initial time in us, used when resuming a checkpoint.
  170. | Will be truncated to be a multiple of time step.
  171. | - default argument value in constructor: 0
  172. .. _Config__initial_rng_state:
  173. initial_rng_state: RngState
  174. ---------------------------
  175. | Used for checkpointing, may contain state of the random number generator to be set
  176. | after initialization right before the first event is started.
  177. | When not set, the set 'seed' value is used to initialize the random number generator.
  178. | - default argument value in constructor: None
  179. .. _Config__append_to_count_output_data:
  180. append_to_count_output_data: bool
  181. ---------------------------------
  182. | Used for checkpointing, instead of creating new files for Count observables data,
  183. | new values are appended to the existing files. If such files do not exist, new files are
  184. | created.
  185. | - default argument value in constructor: False
  186. .. _Config__continue_after_sigalrm:
  187. continue_after_sigalrm: bool
  188. ----------------------------
  189. | MCell registers a SIGALRM signal handler. When SIGALRM signal is received and
  190. | continue_after_sigalrm is False, checkpoint is stored and simulation is terminated.
  191. | When continue_after_sigalrm is True, checkpoint is stored and simulation continues.
  192. | SIGALRM is not supported on Windows.
  193. | - default argument value in constructor: False
  194. | Example: `2785_schedule_checkpoint_async_w_sigalrm_continue/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/nutmeg4_pymcell4/2785_schedule_checkpoint_async_w_sigalrm_continue/model.py>`_
  195. Notifications
  196. =============
  197. Attributes:
  198. ***********
  199. .. _Notifications__bng_verbosity_level:
  200. bng_verbosity_level: int
  201. ------------------------
  202. | Sets verbosity level that enables printouts of extra information on BioNetGen
  203. | species and rules created and used during simulation.
  204. | - default argument value in constructor: 0
  205. .. _Notifications__rxn_and_species_report:
  206. rxn_and_species_report: bool
  207. ----------------------------
  208. | When set to True, simulation generates files rxn_report_SEED.txt, and
  209. | species_report_SEED.txt that contain details on reaction classes and species
  210. | that were created based on reaction rules.
  211. | - default argument value in constructor: False
  212. .. _Notifications__simulation_stats_every_n_iterations:
  213. simulation_stats_every_n_iterations: int
  214. ----------------------------------------
  215. | When set to a value other than 0, internal simulation stats will be printed.
  216. | - default argument value in constructor: 0
  217. .. _Notifications__rxn_probability_changed:
  218. rxn_probability_changed: bool
  219. -----------------------------
  220. | When True, information that a reaction's probability has changed is printed during simulation.
  221. | - default argument value in constructor: True
  222. .. _Notifications__iteration_report:
  223. iteration_report: bool
  224. ----------------------
  225. | When True, a running report of how many iterations have completed, chosen based
  226. | on the total number of iterations, will be printed during simulation.
  227. | - default argument value in constructor: True
  228. .. _Notifications__wall_overlap_report:
  229. wall_overlap_report: bool
  230. -------------------------
  231. | When True, information on wall overlaps will be printed.
  232. | - default argument value in constructor: False
  233. Warnings
  234. ========
  235. This class contains warnings settings. For now it contains only one configurable
  236. warning.
  237. Attributes:
  238. ***********
  239. .. _Warnings__high_reaction_probability:
  240. high_reaction_probability: WarningLevel
  241. ---------------------------------------
  242. | Print a warning when a bimolecular reaction probability is over 0.5 but less or equal than 1.
  243. | Warning when probability is greater than 1 is always printed.
  244. | Cannot be set to WarningLevel.ERROR.
  245. | - default argument value in constructor: WarningLevel.IGNORE
  246. | Example: `0615_bimol_rxn_prob_over_05_less_1_warning_disabled/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/nutmeg4_pymcell4/0615_bimol_rxn_prob_over_05_less_1_warning_disabled/model.py>`_
  247. .. _Warnings__molecule_placement_failure:
  248. molecule_placement_failure: WarningLevel
  249. ----------------------------------------
  250. | Print a warning or end with an error when a release of a molecule fails.
  251. | - default argument value in constructor: WarningLevel.ERROR