subsystem.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. .. _api-subsystem:
  2. *********
  3. Subsystem
  4. *********
  5. Complex
  6. =======
  7. This class represents a complex molecule composed of molecule instances.
  8. It is either defined using a BNGL string or using a list of elementary molecule instances.
  9. On top of that, orientation may be defined.
  10. This class is most often by calling its constructor as m.Complex(bngl_string) in cases where a
  11. fully qualified instance (such as for molecule releases) or a pattern (in observable counts) is needed.
  12. Comparison operator __eq__ first converts complexes to their canonical representation and
  13. then does comparison so for instance m.Complex('A(b!1).B(a!1)') == m.Complex('B(a!2).A(b!2)').
  14. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  15. Attributes:
  16. ***********
  17. .. _Complex__name:
  18. name: str
  19. ---------
  20. | When set, this complex instance is initialized from a BNGL string passed as this argument,
  21. | the string is parsed and elementary_molecules and compartment are initialized.
  22. | Only one of name or elementary_molecules can be set.
  23. | - default argument value in constructor: None
  24. .. _Complex__elementary_molecules:
  25. elementary_molecules: List[ElementaryMolecule]
  26. ----------------------------------------------
  27. | Individual molecule instances contained in the complex.
  28. | Only one of name or elementary_molecules can be set.
  29. | - default argument value in constructor: None
  30. .. _Complex__orientation:
  31. orientation: Orientation
  32. ------------------------
  33. | Specifies orientation of a molecule.
  34. | When Orientation.DEFAULT if kept then during model initialization is
  35. | 'orientation' set to Orientation.NONE for volume complexes and to
  36. | Orientation.UP for surface complexes.
  37. | Ignored by derived class Species.
  38. | - default argument value in constructor: Orientation.DEFAULT
  39. .. _Complex__compartment_name:
  40. compartment_name: str
  41. ---------------------
  42. | Specifies compartment name of this Complex.
  43. | Only one of 'orientation' and 'compartment_name' can be set.
  44. | Corresponds to BNGL specification of a compartment for the whole complex '\@COMP\:'.
  45. | If a 2D/surface compartment is specified, the complex must be a surface complex and
  46. | orientation is set to Orientation.UP.
  47. | If a 3D/volume compartment is specified, the complex must be a volume complex and
  48. | orientation is set to Orientation.NONE.
  49. | Sets compartment to all elementary molecules whose compartment is unset. Does not override
  50. | specific compartments of elementary molecules that were already set.
  51. | If this is a volume complex (all elementary molecules have their diffusion_constant_3d set),
  52. | all compartments of elementary molecules must be the same volume compartment.
  53. | If this is a surface complex (at least one elementary molecule has its their diffusion_constant_2d
  54. | set), all compartments of surface elementary molecules must be the same, and
  55. | all compartments of volume elementary molecules must be from the two neighboring
  56. | volume compartments.
  57. | - default argument value in constructor: None
  58. Methods:
  59. *********
  60. .. _Complex__to_bngl_str:
  61. to_bngl_str () -> str
  62. ---------------------
  63. | Creates a string that corresponds to its BNGL representation including compartments.
  64. .. _Complex__as_species:
  65. as_species () -> Species
  66. ------------------------
  67. | Returns a Species object based on this Complex. All species-specific
  68. | attributes are set to their default values and 'name' is set to value returned by
  69. | 'to_bngl_str()'.
  70. Component
  71. =========
  72. Instance of a component type belonging to a molecule instance.
  73. A component instance must have its state set if there is at least one allowed state.
  74. It is also used to connect molecule instance in a complex instance through bonds.
  75. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  76. Attributes:
  77. ***********
  78. .. _Component__component_type:
  79. component_type: ComponentType
  80. -----------------------------
  81. | Reference to a component type.
  82. .. _Component__state:
  83. state: str
  84. ----------
  85. | Specific state value of this component instance.
  86. | - default argument value in constructor: STATE_UNSET
  87. .. _Component__bond:
  88. bond: int
  89. ---------
  90. | Specific bond for this component instance.
  91. | It is either a numberical value such as in A(c!1),
  92. | or one of special values BOND_UNBOUND in A(c),
  93. | BOND_BOUND in A(c!+) or BOND_ANY in A(c!?).
  94. | - default argument value in constructor: BOND_UNBOUND
  95. Methods:
  96. *********
  97. .. _Component__to_bngl_str:
  98. to_bngl_str () -> str
  99. ---------------------
  100. | Creates a string that corresponds to this component's BNGL representation.
  101. ComponentType
  102. =============
  103. Multiple functional attributes for each molecule type are described using components. And this class defines a type of a component. For example, proteins have multiple functional substructures such as domains, motifs, and binding sites. These components can be unchanging (called stateless) or exist in one of many different internal states For example, certain binding motifs may have different behaviors depending on whether they are unphosphorylated or phosphorylated.
  104. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  105. Attributes:
  106. ***********
  107. .. _ComponentType__name:
  108. name: str
  109. ---------
  110. | Name of this component type.
  111. .. _ComponentType__states:
  112. states: List[str]
  113. -----------------
  114. | List of states allowed by this component.
  115. | - default argument value in constructor: None
  116. Methods:
  117. *********
  118. .. _ComponentType__inst:
  119. inst (state: str=STATE_UNSET, bond: int=BOND_UNBOUND) -> Component
  120. ------------------------------------------------------------------
  121. | Instantiate a component from this component type.
  122. * | state: str = STATE_UNSET
  123. | Selected state, must be from the list of the allowed states.
  124. * | bond: int = BOND_UNBOUND
  125. | Bond information for the created component instance.
  126. .. _ComponentType__inst:
  127. inst (state: int=STATE_UNSET_INT, bond: int=BOND_UNBOUND) -> Component
  128. ----------------------------------------------------------------------
  129. | Instantiate a component from this component type.
  130. * | state: int = STATE_UNSET_INT
  131. | Selected state, must be from the list of the allowed, converted to string.
  132. * | bond: int = BOND_UNBOUND
  133. | Bond information for the created component instance.
  134. .. _ComponentType__to_bngl_str:
  135. to_bngl_str () -> str
  136. ---------------------
  137. | Creates a string that corresponds to its BNGL representation.
  138. ElementaryMolecule
  139. ==================
  140. Instance of an elementary molecule type. A BNGL complex is composed of elementary molecules.
  141. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  142. Attributes:
  143. ***********
  144. .. _ElementaryMolecule__elementary_molecule_type:
  145. elementary_molecule_type: ElementaryMoleculeType
  146. ------------------------------------------------
  147. | Reference to the type of this elementary molecule.
  148. .. _ElementaryMolecule__components:
  149. components: List[Component]
  150. ---------------------------
  151. | List of component instances. Not all components need to be specified
  152. | in case when this elementary molecule is used in a pattern.
  153. | - default argument value in constructor: None
  154. .. _ElementaryMolecule__compartment_name:
  155. compartment_name: str
  156. ---------------------
  157. | Optional BNGL compartment name for this elemenrary molecule. If a 2D/surface compartment is specified, the elementary moelcule must be of surface type. If a 3D/volume compartment is specified, the elementary moelcule must be of volume type.
  158. | - default argument value in constructor: None
  159. Methods:
  160. *********
  161. .. _ElementaryMolecule__to_bngl_str:
  162. to_bngl_str (with_compartment: bool=True) -> str
  163. ------------------------------------------------
  164. | Creates a string that corresponds to its BNGL representation
  165. * | with_compartment: bool = True
  166. | Include compartment name in the returned BNGL string.
  167. ElementaryMoleculeType
  168. ======================
  169. An elementary molecule type is a base indivisible entity. It is the same as
  170. a molecule type in BNGL entered in section molecule types.
  171. The 'elementary' prefix was added to distinguish it clearly from molecules in
  172. simulation.
  173. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  174. Attributes:
  175. ***********
  176. .. _ElementaryMoleculeType__name:
  177. name: str
  178. ---------
  179. | Name of this elementary molecule type.
  180. .. _ElementaryMoleculeType__components:
  181. components: List[ComponentType]
  182. -------------------------------
  183. | List of components used by this elementary molecule type.
  184. | - default argument value in constructor: None
  185. .. _ElementaryMoleculeType__diffusion_constant_2d:
  186. diffusion_constant_2d: float
  187. ----------------------------
  188. | Elementary molecule based on this type is constrained to a surface
  189. | and diffuses with the specified diffusion constant.
  190. | D can be zero, in which case the molecule doesn’t move.
  191. | The units of D are cm^2 /s.
  192. | - default argument value in constructor: None
  193. .. _ElementaryMoleculeType__diffusion_constant_3d:
  194. diffusion_constant_3d: float
  195. ----------------------------
  196. | Elementary molecule based on this type diffuses in space with the
  197. | specified diffusion constant D.
  198. | D can be zero, in which case the molecule doesn’t move.
  199. | The units of D are cm^2 /s.
  200. | - default argument value in constructor: None
  201. .. _ElementaryMoleculeType__custom_time_step:
  202. custom_time_step: float
  203. -----------------------
  204. | This molecule should take timesteps of length custom_time_step (in seconds).
  205. | Use either this or custom_time_step, not both.
  206. | - default argument value in constructor: None
  207. .. _ElementaryMoleculeType__custom_space_step:
  208. custom_space_step: float
  209. ------------------------
  210. | This molecule should take steps of average length given by the custom_space_step value (in microns).
  211. | Use either this or custom_time_step, not both.
  212. | - default argument value in constructor: None
  213. .. _ElementaryMoleculeType__target_only:
  214. target_only: bool
  215. -----------------
  216. | This molecule will not initiate reactions when it runs into other molecules. This
  217. | setting can speed up simulations when applied to a molecule at high concentrations
  218. | that reacts with a molecule at low concentrations (it is more efficient for
  219. | the low-concentration molecule to trigger the reactions). This directive does
  220. | not affect unimolecular reactions.
  221. | - default argument value in constructor: False
  222. Methods:
  223. *********
  224. .. _ElementaryMoleculeType__inst:
  225. inst (components: List[Component]=None, compartment_name: str=None) -> ElementaryMolecule
  226. -----------------------------------------------------------------------------------------
  227. | Create an elementary molecule based on this elementary molecule type.
  228. * | components: List[Component] = None
  229. | Instances of components for the the created elementary molecule.
  230. | Not all components need to be specified in case when the elementary
  231. | molecule is used in a pattern.
  232. * | compartment_name: str = None
  233. | Optional specification of compartment name for the created elementary molecule.
  234. .. _ElementaryMoleculeType__to_bngl_str:
  235. to_bngl_str () -> str
  236. ---------------------
  237. | Creates a string that corresponds to its BNGL representation.
  238. ReactionRule
  239. ============
  240. Represents a BioNetGen Language (BNGL) reaction rule.
  241. In BNGL, a reaction is simply one or more transformations
  242. applied simultaneously to one or more species. The following
  243. transformations (and their combinations) are allowed\:
  244. * Forming a bond, e.g. A(b) + B(a) -> A(b!0).B(a!0)
  245. * Breaking a bond, e.g. A(b!0).B(a!0)-> A(b)+ B(a)
  246. * Changing of component state, e.g. X(y~0) -> X(y~p)
  247. * Creating a molecule, e.g. A(b) -> A(b) + C(d)
  248. * Destroying a molecule, e.g. A(b) + B(a) -> A(b) or A -> Null
  249. (Null here means that there is no product)
  250. * Changing species of a bound molecule when the molecule type has the
  251. same components, e.g. A(b!0).B(a!0)-> A(b!0).C(a!0)
  252. Also compartments may be specified in reactants (patterns) and for products.
  253. Special compartment classes supported by MCell4 are @IN and @OUT.
  254. They can be used in surface reactions to constrain a reaction with a volume molecule
  255. hitting a surface molecule from the inside or outside of the compartment,
  256. e.g. A(s)@IN + S(a) -> S(a!1).A(s!1) and/or to define the location of the
  257. product, e.g. S(a!1).A(s!1) -> S(a) + A(s)@OUT.
  258. Examples: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_ `1840_vol_plus_surf_class_rxn_callback/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1840_vol_plus_surf_class_rxn_callback/model.py>`_
  259. Attributes:
  260. ***********
  261. .. _ReactionRule__name:
  262. name: str
  263. ---------
  264. | Name of the reaction. If this is a reversible reaction, then it is the name of the
  265. | reaction in forward direction.
  266. | - default argument value in constructor: None
  267. .. _ReactionRule__reactants:
  268. reactants: List[Complex]
  269. ------------------------
  270. | List of reactant patterns. Must contain one or two patterns.
  271. | - default argument value in constructor: None
  272. .. _ReactionRule__products:
  273. products: List[Complex]
  274. -----------------------
  275. | List of reactant patterns. May be empty.
  276. | - default argument value in constructor: None
  277. .. _ReactionRule__fwd_rate:
  278. fwd_rate: float
  279. ---------------
  280. | The units of the reaction rate for uni- and bimolecular reactions are\:
  281. | \* [s^-1] for unimolecular reactions,
  282. | \* [N^-1\*s^-1] bimolecular reactions between two surface molecules on different objects
  283. | (this is a highly experimental feature and the unit will likely change in the future,
  284. | not sure if probability is computed correctly, it works the way that the surface molecule
  285. | is first diffused and then a potential collisions within the distance of Config.intermembrane_interaction_radius
  286. | are evaluated).
  287. | Other bimolecular reaction units depend on Model.config.use_bng_units settings.
  288. | When use_bng_units is False (default), traditional MCell units are used:
  289. | \* [M^-1\*s^-1] for bimolecular reactions between either two volume molecules, a volume molecule
  290. | and a surface (molecule),
  291. | \* [um^2\*N^-1\*s^-1] bimolecular reactions between two surface molecules on the same surface, and
  292. | When use_bng_units is True, units compatible with BioNetGen's ODE, SSA, and PLA solvers are used:
  293. | \* [um^3\*N^-1\*s^-1] for any bimolecular reactions, surface-surface reaction rate conversion assumes 10nm membrane thickness.
  294. | M is the molarity of the solution and N the number of reactants.
  295. | May be changed after model initialization.
  296. | Setting of value is ignored if the rate does not change.
  297. | If the new value differs from previous, updates all information related
  298. | to the new rate including recomputation of reaction times for molecules if this is a
  299. | unimolecular reaction.
  300. | - default argument value in constructor: None
  301. | Examples: `2500_rxn_rate_change_bimol_box_it_100/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2500_rxn_rate_change_bimol_box_it_100/model.py>`_ `2700_concentration_based_rxn_rate/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2700_concentration_based_rxn_rate/model.py>`_
  302. .. _ReactionRule__rev_name:
  303. rev_name: str
  304. -------------
  305. | Name of the reaction in reverse direction.
  306. | - default argument value in constructor: None
  307. .. _ReactionRule__rev_rate:
  308. rev_rate: float
  309. ---------------
  310. | Reverse reactions rate, reaction is unidirectional when not specified.
  311. | May be changed after model initialization, in the case behaves the same was as for
  312. | changing the 'fwd_rate'.
  313. | Uses the same units as 'fwd_rate'.
  314. | - default argument value in constructor: None
  315. .. _ReactionRule__variable_rate:
  316. variable_rate: List[List[float]]
  317. --------------------------------
  318. | The array passed as this argument must have as its items a pair of floats (time in s, rate).
  319. | Must be sorted by time (this is not checked).
  320. | Variable rate is applicable only for irreversible reactions.
  321. | When simulation starts and the table does not contain value for time 0, the initial fwd_rate is set to 0.
  322. | When time advances after the last time in this table, the last rate is used for all subsequent iterations.
  323. | Members fwd_rate and rev_rate must not be set when setting this attribute through a constructor.
  324. | When this attribute is set outside of the class constructor, fwd_rate is automatically reset to an 'unset' value.
  325. | Cannot be set after model initialization.
  326. | - default argument value in constructor: None
  327. .. _ReactionRule__is_intermembrane_surface_reaction:
  328. is_intermembrane_surface_reaction: bool
  329. ---------------------------------------
  330. | Experimental, see addintinal explanation in 'fwd' rate.
  331. | Then set to true, this is a special type of surface-surface reaction that
  332. | allows for two surface molecules to react when they are on different geometrical objects.
  333. | Note\: This support is limited for now, the reaction rule must be in the form of A + B -> C + D
  334. | where all reactants and products must be surface molecules and their orientation must be 'any' (default).
  335. | - default argument value in constructor: False
  336. | Example: `3000_intermembrane_rxns/customization.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/3000_intermembrane_rxns/customization.py>`_
  337. Methods:
  338. *********
  339. .. _ReactionRule__to_bngl_str:
  340. to_bngl_str () -> str
  341. ---------------------
  342. | Creates a string that corresponds to the reaction rule's BNGL representation, does not contain rates.
  343. Species
  344. =======
  345. There are three ways how to use this class\:
  346. 1) definition of simple species - in this case 'name' is
  347. a single identifier and at least 'diffusion_constant_2d' or
  348. 'diffusion_constant_3d' must be provided.
  349. Example\: m.Species('A', diffusion_constant_3d=1e-6).
  350. Such a definition must be added to subsystem or model so that
  351. during model initialization this species is transformed to MCell
  352. representation and an ElementaryMoleculeType 'A' with a given
  353. diffusion constant is created as well.
  354. 2) full definition of complex species - in this case the
  355. inherited attribute 'elementary_molecules' from Complex
  356. is used as a definition of the complex and this gives information
  357. on diffusion constants of the used elementary molecules.
  358. Example\: m.Species(elementary_molecules=[ei1, ei2]).
  359. Such a definition must be added to subsystem or model.
  360. 3) declaration of species - in this case only 'name' in the form of
  361. an BNGL string is provided. The complex instance specified by the name
  362. must be fully qualified (i.e. all components are present and those
  363. components that have a state have their state set).
  364. No information on diffusion constants and other properties of
  365. used elementary molecules is provided, it must be provided elsewhere.
  366. Example\: m.Species('A(b!1).B(a!1)').
  367. This is a common form of usage when reaction rules are provided in a BNGL file.
  368. Such declaration does no need to be added to subsystem or model.
  369. This form is used as argument in cases where a fully qualified instance
  370. must be provided such as in molecule releases.
  371. Example: `0040_to_bngl_str/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/0040_to_bngl_str/model.py>`_
  372. Attributes:
  373. ***********
  374. .. _Species__name:
  375. name: str
  376. ---------
  377. | Name of the species in the BNGL format.
  378. | One must either specify name or elementary_molecules (inherited from Complex).
  379. | This argument name is parsed during model initialization.
  380. | - default argument value in constructor: None
  381. .. _Species__diffusion_constant_2d:
  382. diffusion_constant_2d: float
  383. ----------------------------
  384. | This molecule is constrained to surface with diffusion constant D.
  385. | D can be zero, in which case the molecule doesn’t move.
  386. | The units of D are cm^2/s.
  387. | - default argument value in constructor: None
  388. .. _Species__diffusion_constant_3d:
  389. diffusion_constant_3d: float
  390. ----------------------------
  391. | This molecule diffuses in space with diffusion constant D.
  392. | D can be zero, in which case the molecule doesn’t move.
  393. | The units of D are cm^2/s.
  394. | - default argument value in constructor: None
  395. .. _Species__custom_time_step:
  396. custom_time_step: float
  397. -----------------------
  398. | Optional setting of a custom time step for this specific species.
  399. | A molecule of this species should take timesteps of length custom_time_step (in seconds).
  400. | Use either this or custom_time_step.
  401. | - default argument value in constructor: None
  402. .. _Species__custom_space_step:
  403. custom_space_step: float
  404. ------------------------
  405. | Optional setting of a custom space step for this specific species.
  406. | A molecule of this species should take steps of average length custom_space_step (in microns).
  407. | Use either this or custom_time_step.
  408. | - default argument value in constructor: None
  409. .. _Species__target_only:
  410. target_only: bool
  411. -----------------
  412. | A molecule of this species will not initiate reactions when it runs into other molecules. This
  413. | setting can speed up simulations when applied to a molecule at high concentrations
  414. | that reacts with a molecule at low concentrations (it is more efficient for
  415. | the low-concentration molecule to trigger the reactions). This directive does
  416. | not affect unimolecular reactions.
  417. | - default argument value in constructor: False
  418. .. _Species__name:
  419. name: str
  420. ---------
  421. | When set, this complex instance is initialized from a BNGL string passed as this argument,
  422. | the string is parsed and elementary_molecules and compartment are initialized.
  423. | Only one of name or elementary_molecules can be set.
  424. | - default argument value in constructor: None
  425. .. _Species__elementary_molecules:
  426. elementary_molecules: List[ElementaryMolecule]
  427. ----------------------------------------------
  428. | Individual molecule instances contained in the complex.
  429. | Only one of name or elementary_molecules can be set.
  430. | - default argument value in constructor: None
  431. .. _Species__orientation:
  432. orientation: Orientation
  433. ------------------------
  434. | Specifies orientation of a molecule.
  435. | When Orientation.DEFAULT if kept then during model initialization is
  436. | 'orientation' set to Orientation.NONE for volume complexes and to
  437. | Orientation.UP for surface complexes.
  438. | Ignored by derived class Species.
  439. | - default argument value in constructor: Orientation.DEFAULT
  440. .. _Species__compartment_name:
  441. compartment_name: str
  442. ---------------------
  443. | Specifies compartment name of this Complex.
  444. | Only one of 'orientation' and 'compartment_name' can be set.
  445. | Corresponds to BNGL specification of a compartment for the whole complex '\@COMP\:'.
  446. | If a 2D/surface compartment is specified, the complex must be a surface complex and
  447. | orientation is set to Orientation.UP.
  448. | If a 3D/volume compartment is specified, the complex must be a volume complex and
  449. | orientation is set to Orientation.NONE.
  450. | Sets compartment to all elementary molecules whose compartment is unset. Does not override
  451. | specific compartments of elementary molecules that were already set.
  452. | If this is a volume complex (all elementary molecules have their diffusion_constant_3d set),
  453. | all compartments of elementary molecules must be the same volume compartment.
  454. | If this is a surface complex (at least one elementary molecule has its their diffusion_constant_2d
  455. | set), all compartments of surface elementary molecules must be the same, and
  456. | all compartments of volume elementary molecules must be from the two neighboring
  457. | volume compartments.
  458. | - default argument value in constructor: None
  459. Methods:
  460. *********
  461. .. _Species__inst:
  462. inst (orientation: Orientation=Orientation.DEFAULT, compartment_name: str=None) -> Complex
  463. ------------------------------------------------------------------------------------------
  464. | Creates a copy of a Complex from this Species with specified orientation and compartment name.
  465. * | orientation: Orientation = Orientation.DEFAULT
  466. | Maximum one of orientation or compartment_name can be set, not both.
  467. * | compartment_name: str = None
  468. | Maximum one of orientation or compartment_name can be set, not both.
  469. .. _Species__to_bngl_str:
  470. to_bngl_str () -> str
  471. ---------------------
  472. | Creates a string that corresponds to its BNGL representation including compartments.
  473. .. _Species__as_species:
  474. as_species () -> Species
  475. ------------------------
  476. | Returns a Species object based on this Complex. All species-specific
  477. | attributes are set to their default values and 'name' is set to value returned by
  478. | 'to_bngl_str()'.
  479. Subsystem
  480. =========
  481. Subsystem usually defines a reaction network. It is a collection of
  482. species and reaction rules that use these species.
  483. The main motivation for introducing such an object to MCell4 is to have
  484. a class independent on that particular initial model state and observables that
  485. only contains reactions. This way, one can define independent reusable subsystems
  486. and possibly merge them together when creating a model that includes multiple reaction
  487. networks.
  488. Example: `2550_variable_rate_unimol_w_rxn_class_cleanup/sybsystem.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2550_variable_rate_unimol_w_rxn_class_cleanup/sybsystem.py>`_
  489. Attributes:
  490. ***********
  491. .. _Subsystem__species:
  492. species: List[Species]
  493. ----------------------
  494. | List of species to be included in the model for initialization.
  495. | Used usually only for simple species (species that are defined using a
  496. | single molecule type without components such as 'A').
  497. | Other species may be created inside simulation
  498. | - default argument value in constructor: None
  499. .. _Subsystem__reaction_rules:
  500. reaction_rules: List[ReactionRule]
  501. ----------------------------------
  502. | - default argument value in constructor: None
  503. .. _Subsystem__surface_classes:
  504. surface_classes: List[SurfaceClass]
  505. -----------------------------------
  506. | - default argument value in constructor: None
  507. .. _Subsystem__elementary_molecule_types:
  508. elementary_molecule_types: List[ElementaryMoleculeType]
  509. -------------------------------------------------------
  510. | Contains list of elementary molecule types with their diffusion constants and other information.
  511. | Populated when a BNGL file is loaded and also on initialization from Species objects present in
  512. | the species list.
  513. | - default argument value in constructor: None
  514. Methods:
  515. *********
  516. .. _Subsystem__add_species:
  517. add_species (s: Species)
  518. ------------------------
  519. | Add a reference to a Species object to the species list.
  520. * | s: Species
  521. .. _Subsystem__find_species:
  522. find_species (name: str) -> Species
  523. -----------------------------------
  524. | Find a Species object using name in the species list.
  525. | Returns None if no such species is found.
  526. * | name: str
  527. .. _Subsystem__add_reaction_rule:
  528. add_reaction_rule (r: ReactionRule)
  529. -----------------------------------
  530. | Add a reference to a ReactionRule object to the reaction_rules list.
  531. * | r: ReactionRule
  532. .. _Subsystem__find_reaction_rule:
  533. find_reaction_rule (name: str) -> ReactionRule
  534. ----------------------------------------------
  535. | Find a ReactionRule object using name in the reaction_rules list.
  536. | Returns None if no such reaction rule is found.
  537. * | name: str
  538. .. _Subsystem__add_surface_class:
  539. add_surface_class (sc: SurfaceClass)
  540. ------------------------------------
  541. | Add a reference to a SurfaceClass object to the surface_classes list.
  542. * | sc: SurfaceClass
  543. .. _Subsystem__find_surface_class:
  544. find_surface_class (name: str) -> SurfaceClass
  545. ----------------------------------------------
  546. | Find a SurfaceClass object using name in the surface_classes list.
  547. | Returns None if no such surface class is found.
  548. * | name: str
  549. .. _Subsystem__add_elementary_molecule_type:
  550. add_elementary_molecule_type (mt: ElementaryMoleculeType)
  551. ---------------------------------------------------------
  552. | Add a reference to an ElementaryMoleculeType object to the elementary_molecule_types list.
  553. * | mt: ElementaryMoleculeType
  554. .. _Subsystem__find_elementary_molecule_type:
  555. find_elementary_molecule_type (name: str) -> ElementaryMoleculeType
  556. -------------------------------------------------------------------
  557. | Find an ElementaryMoleculeType object using name in the elementary_molecule_types list.
  558. | Returns None if no such elementary molecule type is found.
  559. * | name: str
  560. .. _Subsystem__load_bngl_molecule_types_and_reaction_rules:
  561. load_bngl_molecule_types_and_reaction_rules (file_name: str, parameter_overrides: Dict[str, float]=None)
  562. --------------------------------------------------------------------------------------------------------
  563. | Parses a BNGL file, only reads molecule types and reaction rules sections,
  564. | i.e. ignores observables and seed species.
  565. | Parameter values are evaluated and the result value is directly used.
  566. | Compartments names are stored in rxn rules as strings because compartments belong
  567. | to geometry objects and the subsystem is independent on specific geometry.
  568. | However, the compartments and their objects must be defined before initialization.
  569. * | file_name: str
  570. | Path to the BNGL file to be loaded.
  571. * | parameter_overrides: Dict[str, float] = None
  572. | For each key k in the parameter_overrides, if it is defined in the BNGL's parameters section,
  573. | its value is ignored and instead value parameter_overrides[k] is used.
  574. | Example: `2100_gradual_bngl_load/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/2100_gradual_bngl_load/model.py>`_
  575. SurfaceClass
  576. ============
  577. Defining a surface class allows surfaces to behave like species. For instance, one may wish
  578. to specify that a surface does not block the diffusion of molecules. Each type of surface is defined
  579. by name, and each surface name must be unique in the simulation and should not match any molecule names.
  580. To define a reaction with a surface class, use constructor call m.Complex(name) as one of the reactants.
  581. Examples: `1600_crossing_transparent_compartment_wall/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4/1600_crossing_transparent_compartment_wall/model.py>`_ `1840_vol_plus_surf_class_rxn_callback/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1840_vol_plus_surf_class_rxn_callback/model.py>`_
  582. Attributes:
  583. ***********
  584. .. _SurfaceClass__name:
  585. name: str
  586. ---------
  587. | Name of the surface class.
  588. .. _SurfaceClass__properties:
  589. properties: List[SurfaceProperty]
  590. ---------------------------------
  591. | A surface class can either have a list of properties or just one property.
  592. | In the usual case of having one property, one can set the attributes
  593. | type, affected_species, etc. inherited from SurfaceProperty directly.
  594. | - default argument value in constructor: None
  595. .. _SurfaceClass__type:
  596. type: SurfacePropertyType
  597. -------------------------
  598. | Must be set. See SurfacePropertyType for options.
  599. | - default argument value in constructor: SurfacePropertyType.UNSET
  600. .. _SurfaceClass__affected_complex_pattern:
  601. affected_complex_pattern: Complex
  602. ---------------------------------
  603. | A complex pattern with optional orientation must be set.
  604. | Default orientation means that the pattern matches any orientation.
  605. | For concentration or flux clamp the orientation specifies on which side
  606. | will be the concentration held (UP is front or outside, DOWN is back or
  607. | inside, and DEFAULT, ANY or NONE is on both sides).
  608. | The complex pattern must not use compartments.
  609. | - default argument value in constructor: None
  610. .. _SurfaceClass__concentration:
  611. concentration: float
  612. --------------------
  613. | Specifies concentration when type is SurfacePropertyType.CLAMP_CONCENTRATION or
  614. | SurfacePropertyType.CLAMP_FLUX. Represents concentration of the imagined opposide side
  615. | of the wall that has this concentration or flux clamped.
  616. | - default argument value in constructor: None
  617. SurfaceProperty
  618. ===============
  619. Single property for a SurfaceClass.
  620. Attributes:
  621. ***********
  622. .. _SurfaceProperty__type:
  623. type: SurfacePropertyType
  624. -------------------------
  625. | Must be set. See SurfacePropertyType for options.
  626. | - default argument value in constructor: SurfacePropertyType.UNSET
  627. .. _SurfaceProperty__affected_complex_pattern:
  628. affected_complex_pattern: Complex
  629. ---------------------------------
  630. | A complex pattern with optional orientation must be set.
  631. | Default orientation means that the pattern matches any orientation.
  632. | For concentration or flux clamp the orientation specifies on which side
  633. | will be the concentration held (UP is front or outside, DOWN is back or
  634. | inside, and DEFAULT, ANY or NONE is on both sides).
  635. | The complex pattern must not use compartments.
  636. | - default argument value in constructor: None
  637. .. _SurfaceProperty__concentration:
  638. concentration: float
  639. --------------------
  640. | Specifies concentration when type is SurfacePropertyType.CLAMP_CONCENTRATION or
  641. | SurfacePropertyType.CLAMP_FLUX. Represents concentration of the imagined opposide side
  642. | of the wall that has this concentration or flux clamped.
  643. | - default argument value in constructor: None