musica 0.11.1.1__cp312-cp312-win_amd64.whl → 0.14.2__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. musica/__init__.py +23 -3
  2. musica/_musica.cp312-win_amd64.pyd +0 -0
  3. musica/_version.py +1 -1
  4. musica/backend.py +58 -0
  5. musica/carma/__init__.py +20 -0
  6. musica/carma/carma.py +1727 -0
  7. musica/constants.py +3 -0
  8. musica/cuda.py +13 -0
  9. musica/examples/__init__.py +1 -0
  10. musica/examples/carma_aluminum.py +124 -0
  11. musica/examples/carma_sulfate.py +246 -0
  12. musica/examples/examples.py +165 -0
  13. musica/examples/sulfate_box_model.py +439 -0
  14. musica/examples/ts1_latin_hypercube.py +245 -0
  15. musica/main.py +128 -0
  16. musica/mechanism_configuration/__init__.py +18 -0
  17. musica/mechanism_configuration/ancillary.py +6 -0
  18. musica/mechanism_configuration/arrhenius.py +149 -0
  19. musica/mechanism_configuration/branched.py +140 -0
  20. musica/mechanism_configuration/emission.py +82 -0
  21. musica/mechanism_configuration/first_order_loss.py +90 -0
  22. musica/mechanism_configuration/mechanism.py +93 -0
  23. musica/mechanism_configuration/phase.py +58 -0
  24. musica/mechanism_configuration/phase_species.py +58 -0
  25. musica/mechanism_configuration/photolysis.py +98 -0
  26. musica/mechanism_configuration/reaction_component.py +54 -0
  27. musica/mechanism_configuration/reactions.py +32 -0
  28. musica/mechanism_configuration/species.py +65 -0
  29. musica/mechanism_configuration/surface.py +98 -0
  30. musica/mechanism_configuration/taylor_series.py +136 -0
  31. musica/mechanism_configuration/ternary_chemical_activation.py +160 -0
  32. musica/mechanism_configuration/troe.py +160 -0
  33. musica/mechanism_configuration/tunneling.py +126 -0
  34. musica/mechanism_configuration/user_defined.py +99 -0
  35. musica/mechanism_configuration/utils.py +10 -0
  36. musica/micm/__init__.py +10 -0
  37. musica/micm/conditions.py +49 -0
  38. musica/micm/micm.py +135 -0
  39. musica/micm/solver.py +8 -0
  40. musica/micm/solver_result.py +24 -0
  41. musica/micm/state.py +220 -0
  42. musica/micm/utils.py +18 -0
  43. musica/tuvx/__init__.py +11 -0
  44. musica/tuvx/grid.py +98 -0
  45. musica/tuvx/grid_map.py +167 -0
  46. musica/tuvx/profile.py +130 -0
  47. musica/tuvx/profile_map.py +167 -0
  48. musica/tuvx/radiator.py +95 -0
  49. musica/tuvx/radiator_map.py +173 -0
  50. musica/tuvx/tuvx.py +283 -0
  51. musica-0.14.2.dist-info/DELVEWHEEL +2 -0
  52. {musica-0.11.1.1.dist-info → musica-0.14.2.dist-info}/METADATA +146 -63
  53. musica-0.14.2.dist-info/RECORD +104 -0
  54. {musica-0.11.1.1.dist-info → musica-0.14.2.dist-info}/WHEEL +1 -1
  55. musica-0.14.2.dist-info/entry_points.txt +3 -0
  56. musica-0.14.2.dist-info/licenses/AUTHORS.md +59 -0
  57. musica.libs/libaws-c-auth-0a61a643442f1c0912920b37d9fb0be5.dll +0 -0
  58. musica.libs/libaws-c-cal-eaafa5905de6c9ba274eb8737e6087dd.dll +0 -0
  59. musica.libs/libaws-c-common-b4aa4468297ae8e1664f9380a5510317.dll +0 -0
  60. musica.libs/libaws-c-compression-9f997952aeae03067122ca493c9081b5.dll +0 -0
  61. musica.libs/libaws-c-event-stream-fe9cc8e1692f60c2b5694a8959dbd7c3.dll +0 -0
  62. musica.libs/libaws-c-http-4a9d50ba6ad8882f5267ef89e5e4103a.dll +0 -0
  63. musica.libs/libaws-c-io-e454f1c7a44e77f8c957a016888754be.dll +0 -0
  64. musica.libs/libaws-c-mqtt-67c5fc291740f5cbc5e53fb767e93226.dll +0 -0
  65. musica.libs/libaws-c-s3-206db4af6e1a95637b1921ea596603b9.dll +0 -0
  66. musica.libs/libaws-c-sdkutils-5c9c62dafb8b774cd4a3386f95ef428d.dll +0 -0
  67. musica.libs/libaws-checksums-7e50fe01b862214958f4d2ab4215fde5.dll +0 -0
  68. musica.libs/libaws-cpp-sdk-core-7a9ba9c045ee16f5262e955d96865718.dll +0 -0
  69. musica.libs/libaws-cpp-sdk-s3-4eebff3923c6d250fb508da3c990e0ae.dll +0 -0
  70. musica.libs/libaws-crt-cpp-3173f1e6f504a96d88e8dbf9e04b3b14.dll +0 -0
  71. musica.libs/libbrotlicommon-c62c08223e450dfc2fff33c752cc2285.dll +0 -0
  72. musica.libs/libbrotlidec-ccde7c3978eb1d2e052b193f2968d30a.dll +0 -0
  73. musica.libs/libbz2-1-669a4bf9266d5f020e843aa5fd75b93c.dll +0 -0
  74. musica.libs/libcrypto-3-x64-237eeb55505d067eab5e0b886e519387.dll +0 -0
  75. musica.libs/libcurl-4-bdf865458887dc1235b192ec83729214.dll +0 -0
  76. musica.libs/libgcc_s_seh-1-5a3153f12338f79fbbb7bf095fc5cef1.dll +0 -0
  77. musica.libs/libgfortran-5-90848e0eacdecce3a9005faf5aaec7e7.dll +0 -0
  78. musica.libs/libgomp-1-b8afcf09fecd2f6f01e454c9a5f2c690.dll +0 -0
  79. musica.libs/libhdf5-320-eec6c8ba2fdde30d365786ffbff40989.dll +0 -0
  80. musica.libs/libhdf5_hl-320-7e26e1caaad6be4082d728cf08ab2de4.dll +0 -0
  81. musica.libs/libiconv-2-b37d1b4acab5310c4e4f6e2a961d1464.dll +0 -0
  82. musica.libs/libidn2-0-d17600177f3b4cd2521d595b3472d240.dll +0 -0
  83. musica.libs/libintl-8-e4d4ca6b37338fbb0a8c1246afa7258f.dll +0 -0
  84. musica.libs/liblzma-5-bd95aa0fda6e7c8e41b3843d6fc2942c.dll +0 -0
  85. musica.libs/libnetcdf-0623e518145bddd30cc615b6d7f2f9c1.dll +0 -0
  86. musica.libs/libnetcdff-7-982cb7ee026b78f05a79d00e735f91d1.dll +0 -0
  87. musica.libs/libnghttp2-14-6d49ed806389b4892bcf29c6ed6e3984.dll +0 -0
  88. musica.libs/libnghttp3-9-d3c9b57d760f6dae7d6a067a68126b84.dll +0 -0
  89. musica.libs/libngtcp2-16-a43356e6376d41ce4238e2c55581636a.dll +0 -0
  90. musica.libs/libngtcp2_crypto_ossl-0-b37121badf25a552e5654f27bf6ff093.dll +0 -0
  91. musica.libs/libopenblas-a16595c3cae114c5c7304aa8bb3c1272.dll +0 -0
  92. musica.libs/libpsl-5-4368d4c2412410a4a14f3e7f3227e295.dll +0 -0
  93. musica.libs/libquadmath-0-4edeffe0a60c96360445d33a1876dbda.dll +0 -0
  94. musica.libs/libssh2-1-f407a2b50419bd904c7eb2c101ae81ea.dll +0 -0
  95. musica.libs/libssl-3-x64-d2e43d36e6f87f6f1645717cd0871f86.dll +0 -0
  96. musica.libs/libstdc++-6-83061aaccaf8df77a3b584efef12bc7c.dll +0 -0
  97. musica.libs/libsz-2-d12f3d26417507ec8dea9964f9fe36a1.dll +0 -0
  98. musica.libs/libunistring-5-0473d7a71d94f08292beed694c34f7d1.dll +0 -0
  99. musica.libs/libwinpthread-1-9157bac12a85fb717fa3d2bf6712631a.dll +0 -0
  100. musica.libs/libxml2-16-7fe545d280fdef922282226eef91571f.dll +0 -0
  101. musica.libs/libzip-62d3c877b7842bc509fc000316a4731b.dll +0 -0
  102. musica.libs/libzstd-a25427164f8775046eb8ce488d7d0884.dll +0 -0
  103. musica.libs/zlib1-1dc85208162ee57fe97e892bb5160fe9.dll +0 -0
  104. _musica.cp312-win_amd64.pyd +0 -0
  105. lib/musica.lib +0 -0
  106. lib/yaml-cpp.lib +0 -0
  107. musica/CMakeLists.txt +0 -47
  108. musica/binding.cpp +0 -19
  109. musica/mechanism_configuration.cpp +0 -519
  110. musica/mechanism_configuration.py +0 -1291
  111. musica/musica.cpp +0 -214
  112. musica/test/examples/v0/config.json +0 -7
  113. musica/test/examples/v0/config.yaml +0 -3
  114. musica/test/examples/v0/reactions.json +0 -193
  115. musica/test/examples/v0/reactions.yaml +0 -142
  116. musica/test/examples/v0/species.json +0 -40
  117. musica/test/examples/v0/species.yaml +0 -19
  118. musica/test/examples/v1/full_configuration.json +0 -434
  119. musica/test/examples/v1/full_configuration.yaml +0 -271
  120. musica/test/test_analytical.py +0 -323
  121. musica/test/test_chapman.py +0 -123
  122. musica/test/test_parser.py +0 -693
  123. musica/test/tuvx.py +0 -10
  124. musica/tools/prepare_build_environment_linux.sh +0 -41
  125. musica/tools/prepare_build_environment_windows.sh +0 -22
  126. musica/tools/repair_wheel_gpu.sh +0 -25
  127. musica/types.py +0 -362
  128. musica-0.11.1.1.dist-info/RECORD +0 -30
  129. {musica-0.11.1.1.dist-info → musica-0.14.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,1291 +0,0 @@
1
- # Copyright (C) 2025 University Corporation for Atmospheric Research
2
- # SPDX-License-Identifier: Apache-2.0
3
- #
4
- # This file is part of the musica Python package.
5
- # For more information, see the LICENSE file in the top-level directory of this distribution.
6
- from typing import Optional, Any, Dict, List, Union, Tuple
7
- from _musica._mechanism_configuration import (
8
- _ReactionType,
9
- _Species,
10
- _Phase,
11
- _ReactionComponent,
12
- _Arrhenius,
13
- _CondensedPhaseArrhenius,
14
- _Troe,
15
- _Branched,
16
- _Tunneling,
17
- _Surface,
18
- _Photolysis,
19
- _CondensedPhasePhotolysis,
20
- _Emission,
21
- _FirstOrderLoss,
22
- _AqueousEquilibrium,
23
- _WetDeposition,
24
- _HenrysLaw,
25
- _SimpolPhaseTransfer,
26
- _UserDefined,
27
- _Reactions,
28
- _ReactionsIterator,
29
- _Mechanism,
30
- _Version,
31
- _Parser,
32
- )
33
-
34
- BOLTZMANN_CONSTANT_J_K = 1.380649e-23 # J K-1
35
-
36
-
37
- class ReactionType(_ReactionType):
38
- """
39
- A enum class representing a reaction type in a chemical mechanism.
40
- """
41
-
42
-
43
- class Species(_Species):
44
- """
45
- A class representing a species in a chemical mechanism.
46
-
47
- Attributes:
48
- name (str): The name of the species.
49
- HLC_298K_mol_m3_Pa (float): Henry's Law Constant at 298K [mol m-3 Pa-1]
50
- HLC_exponential_factor_K: Henry's Law Constant exponential factor [K]
51
- diffusion_coefficient_m2_s (float): Diffusion coefficient [m2 s-1]
52
- N_star (float): A parameter used to calculate the mass accomodation factor (Ervens et al., 2003)
53
- molecular_weight_kg_mol (float): Molecular weight [kg mol-1]
54
- density_kg_m3 (float): Density [kg m-3]
55
- tracer_type (str): The type of tracer ("AEROSOL", "THIRD_BODY", "CONSTANT").
56
- other_properties (Dict[str, Any]): A dictionary of other properties of the species.
57
- """
58
-
59
- def __init__(
60
- self,
61
- name: Optional[str] = None,
62
- HLC_298K_mol_m3_Pa: Optional[float] = None,
63
- HLC_exponential_factor_K: Optional[float] = None,
64
- diffusion_coefficient_m2_s: Optional[float] = None,
65
- N_star: Optional[float] = None,
66
- molecular_weight_kg_mol: Optional[float] = None,
67
- density_kg_m3: Optional[float] = None,
68
- tracer_type: Optional[str] = None,
69
- other_properties: Optional[Dict[str, Any]] = None,
70
- ):
71
- """
72
- Initializes the Species object with the given parameters.
73
-
74
- Args:
75
- name (str): The name of the species.
76
- HLC_298K_mol_m3_Pa (float): Henry's Law Constant at 298K [mol m-3 Pa-1]
77
- HLC_exponential_factor_K: Henry's Law Constant exponential factor [K]
78
- diffusion_coefficient_m2_s (float): Diffusion coefficient [m2 s-1]
79
- N_star (float): A parameter used to calculate the mass accomodation factor (Ervens et al., 2003)
80
- molecular_weight_kg_mol (float): Molecular weight [kg mol-1]
81
- density_kg_m3 (float): Density [kg m-3]
82
- tracer_type (str): The type of tracer ("AEROSOL", "THIRD_BODY", "CONSTANT").
83
- other_properties (Dict[str, Any]): A dictionary of other properties of the species.
84
- """
85
- super().__init__()
86
- self.name = name if name is not None else self.name
87
- self.HLC_298K_mol_m3_Pa = HLC_298K_mol_m3_Pa if HLC_298K_mol_m3_Pa is not None else self.HLC_298K_mol_m3_Pa
88
- self.HLC_exponential_factor_K = HLC_exponential_factor_K if HLC_exponential_factor_K is not None else self.HLC_exponential_factor_K
89
- self.diffusion_coefficient_m2_s = diffusion_coefficient_m2_s if diffusion_coefficient_m2_s is not None else self.diffusion_coefficient_m2_s
90
- self.N_star = N_star if N_star is not None else self.N_star
91
- self.molecular_weight_kg_mol = molecular_weight_kg_mol if molecular_weight_kg_mol is not None else self.molecular_weight_kg_mol
92
- self.density_kg_m3 = density_kg_m3 if density_kg_m3 is not None else self.density_kg_m3
93
- self.tracer_type = tracer_type if tracer_type is not None else self.tracer_type
94
- self.other_properties = other_properties if other_properties is not None else self.other_properties
95
-
96
-
97
- class Phase(_Phase):
98
- """
99
- A class representing a phase in a chemical mechanism.
100
-
101
- Attributes:
102
- name (str): The name of the phase.
103
- species (List[Species]): A list of species in the phase.
104
- other_properties (Dict[str, Any]): A dictionary of other properties of the phase.
105
- """
106
-
107
- def __init__(
108
- self,
109
- name: Optional[str] = None,
110
- species: Optional[List[Species]] = None,
111
- other_properties: Optional[Dict[str, Any]] = None,
112
- ):
113
- """
114
- Initializes the Phase object with the given parameters.
115
-
116
- Args:
117
- name (str): The name of the phase.
118
- species (List[Species]): A list of species in the phase.
119
- other_properties (Dict[str, Any]): A dictionary of other properties of the phase.
120
- """
121
- super().__init__()
122
- self.name = name
123
- self.species = [s.name for s in species] if species is not None else self.species
124
- self.other_properties = other_properties if other_properties is not None else self.other_properties
125
-
126
-
127
- class Arrhenius(_Arrhenius):
128
- """
129
- A class representing an Arrhenius rate constant.
130
-
131
- k = A * exp( C / T ) * ( T / D )^B * exp( 1 - E * P )
132
-
133
- where:
134
- k = rate constant
135
- A = pre-exponential factor [(mol m-3)^(n-1)s-1]
136
- B = temperature exponent [unitless]
137
- C = exponential term [K-1]
138
- D = reference temperature [K]
139
- E = pressure scaling term [Pa-1]
140
- T = temperature [K]
141
- P = pressure [Pa]
142
- n = number of reactants
143
-
144
- Attributes:
145
- name (str): The name of the Arrhenius rate constant.
146
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1] where n is the number of reactants.
147
- B (float): Temperature exponent [unitless].
148
- C (float): Exponential term [K-1].
149
- D (float): Reference Temperature [K].
150
- E (float): Pressure scaling term [Pa-1].
151
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
152
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
153
- gas_phase (Phase): The gas phase in which the reaction occurs.
154
- other_properties (Dict[str, Any]): A dictionary of other properties of the Arrhenius rate constant.
155
- """
156
-
157
- def __init__(
158
- self,
159
- name: Optional[str] = None,
160
- A: Optional[float] = None,
161
- B: Optional[float] = None,
162
- C: Optional[float] = None,
163
- Ea: Optional[float] = None,
164
- D: Optional[float] = None,
165
- E: Optional[float] = None,
166
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
167
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
168
- gas_phase: Optional[Phase] = None,
169
- other_properties: Optional[Dict[str, Any]] = None,
170
- ):
171
- """
172
- Initializes the Arrhenius object with the given parameters.
173
-
174
- Args:
175
- name (str): The name of the Arrhenius rate constant.
176
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1] where n is the number of reactants.
177
- B (float): Temperature exponent [unitless].
178
- C (float): Exponential term [K-1].
179
- Ea (float): Activation energy [J molecule-1].
180
- D (float): Reference Temperature [K].
181
- E (float): Pressure scaling term [Pa-1].
182
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
183
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
184
- gas_phase (Phase): The gas phase in which the reaction occurs.
185
- other_properties (Dict[str, Any]): A dictionary of other properties of the Arrhenius rate constant.
186
- """
187
- super().__init__()
188
- self.name = name if name is not None else self.name
189
- self.A = A if A is not None else self.A
190
- self.B = B if B is not None else self.B
191
- if C is not None and Ea is not None:
192
- raise ValueError("Cannot specify both C and Ea.")
193
- self.C = -Ea / BOLTZMANN_CONSTANT_J_K if Ea is not None else C if C is not None else self.C
194
- self.D = D if D is not None else self.D
195
- self.E = E if E is not None else self.E
196
- self.reactants = (
197
- [
198
- (
199
- _ReactionComponent(r.name)
200
- if isinstance(r, Species)
201
- else _ReactionComponent(r[1].name, r[0])
202
- )
203
- for r in reactants
204
- ]
205
- if reactants is not None
206
- else self.reactants
207
- )
208
- self.products = (
209
- [
210
- (
211
- _ReactionComponent(p.name)
212
- if isinstance(p, Species)
213
- else _ReactionComponent(p[1].name, p[0])
214
- )
215
- for p in products
216
- ]
217
- if products is not None
218
- else self.products
219
- )
220
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
221
- self.other_properties = other_properties if other_properties is not None else self.other_properties
222
-
223
-
224
- class CondensedPhaseArrhenius(_CondensedPhaseArrhenius):
225
- """
226
- A class representing a condensed phase Arrhenius rate constant.
227
-
228
- Attributes:
229
- name (str): The name of the condensed phase Arrhenius rate constant.
230
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
231
- B (float): Temperature exponent [unitless].
232
- C (float): Exponential term [K-1].
233
- Ea (float): Activation energy [J molecule-1].
234
- D (float): Reference Temperature [K].
235
- E (float): Pressure scaling term [Pa-1].
236
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
237
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
238
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
239
- aerosol_phase_water (Species): The water species in the aerosol phase.
240
- other_properties (Dict[str, Any]): A dictionary of other properties of the condensed phase Arrhenius rate constant.
241
- """
242
-
243
- def __init__(
244
- self,
245
- name: Optional[str] = None,
246
- A: Optional[float] = None,
247
- B: Optional[float] = None,
248
- C: Optional[float] = None,
249
- Ea: Optional[float] = None,
250
- D: Optional[float] = None,
251
- E: Optional[float] = None,
252
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
253
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
254
- aerosol_phase: Optional[Phase] = None,
255
- aerosol_phase_water: Optional[Species] = None,
256
- other_properties: Optional[Dict[str, Any]] = None,
257
- ):
258
- """
259
- Initializes the CondensedPhaseArrhenius object with the given parameters.
260
-
261
- Args:
262
- name (str): The name of the condensed phase Arrhenius rate constant.
263
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
264
- B (float): Temperature exponent [unitless].
265
- C (float): Exponential term [K-1].
266
- Ea (float): Activation energy [J molecule-1].
267
- D (float): Reference Temperature [K].
268
- E (float): Pressure scaling term [Pa-1].
269
- reactants (List[Union[Species, Tuple[float, Species]]]]: A list of reactants involved in the reaction.
270
- products (List[Union[Species, Tuple[float, Species]]]]: A list of products formed in the reaction.
271
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
272
- aerosol_phase_water (Species): The water species in the aerosol phase.
273
- other_properties (Dict[str, Any]): A dictionary of other properties of the condensed phase Arrhenius rate constant.
274
- """
275
- super().__init__()
276
- self.name = name if name is not None else self.name
277
- self.A = A if A is not None else self.A
278
- self.B = B if B is not None else self.B
279
- if C is not None and Ea is not None:
280
- raise ValueError("Cannot specify both C and Ea.")
281
- self.C = -Ea / BOLTZMANN_CONSTANT_J_K if Ea is not None else C if C is not None else self.C
282
- self.D = D if D is not None else self.D
283
- self.E = E if E is not None else self.E
284
- self.reactants = (
285
- [
286
- (
287
- _ReactionComponent(r.name)
288
- if isinstance(r, Species)
289
- else _ReactionComponent(r[1].name, r[0])
290
- )
291
- for r in reactants
292
- ]
293
- if reactants is not None
294
- else self.reactants
295
- )
296
- self.products = (
297
- [
298
- (
299
- _ReactionComponent(p.name)
300
- if isinstance(p, Species)
301
- else _ReactionComponent(p[1].name, p[0])
302
- )
303
- for p in products
304
- ]
305
- if products is not None
306
- else self.products
307
- )
308
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
309
- self.aerosol_phase_water = (
310
- aerosol_phase_water.name if aerosol_phase_water is not None else self.aerosol_phase_water
311
- )
312
- self.other_properties = other_properties if other_properties is not None else self.other_properties
313
-
314
-
315
- class Troe(_Troe):
316
- """
317
- A class representing a Troe rate constant.
318
-
319
- Attributes:
320
- name (str): The name of the Troe rate constant.
321
- k0_A (float): Pre-exponential factor for the low-pressure limit [(mol m-3)^(n-1)s-1].
322
- k0_B (float): Temperature exponent for the low-pressure limit [unitless].
323
- k0_C (float): Exponential term for the low-pressure limit [K-1].
324
- kinf_A (float): Pre-exponential factor for the high-pressure limit [(mol m-3)^(n-1)s-1].
325
- kinf_B (float): Temperature exponent for the high-pressure limit [unitless].
326
- kinf_C (float): Exponential term for the high-pressure limit [K-1].
327
- Fc (float): Troe parameter [unitless].
328
- N (float): Troe parameter [unitless].
329
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
330
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
331
- gas_phase (Phase): The gas phase in which the reaction occurs.
332
- other_properties (Dict[str, Any]): A dictionary of other properties of the Troe rate constant.
333
- """
334
-
335
- def __init__(
336
- self,
337
- name: Optional[str] = None,
338
- k0_A: Optional[float] = None,
339
- k0_B: Optional[float] = None,
340
- k0_C: Optional[float] = None,
341
- kinf_A: Optional[float] = None,
342
- kinf_B: Optional[float] = None,
343
- kinf_C: Optional[float] = None,
344
- Fc: Optional[float] = None,
345
- N: Optional[float] = None,
346
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
347
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
348
- gas_phase: Optional[Phase] = None,
349
- other_properties: Optional[Dict[str, Any]] = None,
350
- ):
351
- """
352
- Initializes the Troe object with the given parameters.
353
-
354
- k0 = k0_A * exp( k0_C / T ) * ( T / 300.0 )^k0_B
355
- kinf = kinf_A * exp( kinf_C / T ) * ( T / 300.0 )^kinf_B
356
- k = k0[M] / ( 1 + k0[M] / kinf ) * Fc^(1 + 1/N*(log10(k0[M]/kinf))^2)^-1
357
-
358
- where:
359
- k = rate constant
360
- k0 = low-pressure limit rate constant
361
- kinf = high-pressure limit rate constant
362
- k0_A = pre-exponential factor for the low-pressure limit [(mol m-3)^(n-1)s-1]
363
- k0_B = temperature exponent for the low-pressure limit [unitless]
364
- k0_C = exponential term for the low-pressure limit [K-1]
365
- kinf_A = pre-exponential factor for the high-pressure limit [(mol m-3)^(n-1)s-1]
366
- kinf_B = temperature exponent for the high-pressure limit [unitless]
367
- kinf_C = exponential term for the high-pressure limit [K-1]
368
- Fc = Troe parameter [unitless]
369
- N = Troe parameter [unitless]
370
- T = temperature [K]
371
- M = concentration of the third body [mol m-3]
372
-
373
- Args:
374
- name (str): The name of the Troe rate constant.
375
- k0_A (float): Pre-exponential factor for the low-pressure limit [(mol m-3)^(n-1)s-1].
376
- k0_B (float): Temperature exponent for the low-pressure limit [unitless].
377
- k0_C (float): Exponential term for the low-pressure limit [K-1].
378
- kinf_A (float): Pre-exponential factor for the high-pressure limit [(mol m-3)^(n-1)s-1].
379
- kinf_B (float): Temperature exponent for the high-pressure limit [unitless].
380
- kinf_C (float): Exponential term for the high-pressure limit [K-1].
381
- Fc (float): Troe parameter [unitless].
382
- N (float): Troe parameter [unitless].
383
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
384
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
385
- gas_phase (Phase): The gas phase in which the reaction occurs.
386
- other_properties (Dict[str, Any]): A dictionary of other properties of the Troe rate constant.
387
- """
388
- super().__init__()
389
- self.name = name if name is not None else self.name
390
- self.k0_A = k0_A if k0_A is not None else self.k0_A
391
- self.k0_B = k0_B if k0_B is not None else self.k0_B
392
- self.k0_C = k0_C if k0_C is not None else self.k0_C
393
- self.kinf_A = kinf_A if kinf_A is not None else self.kinf_A
394
- self.kinf_B = kinf_B if kinf_B is not None else self.kinf_B
395
- self.kinf_C = kinf_C if kinf_C is not None else self.kinf_C
396
- self.Fc = Fc if Fc is not None else self.Fc
397
- self.N = N if N is not None else self.N
398
- self.reactants = (
399
- [
400
- (
401
- _ReactionComponent(r.name)
402
- if isinstance(r, Species)
403
- else _ReactionComponent(r[1].name, r[0])
404
- )
405
- for r in reactants
406
- ]
407
- if reactants is not None
408
- else self.reactants
409
- )
410
- self.products = (
411
- [
412
- (
413
- _ReactionComponent(p.name)
414
- if isinstance(p, Species)
415
- else _ReactionComponent(p[1].name, p[0])
416
- )
417
- for p in products
418
- ]
419
- if products is not None
420
- else self.products
421
- )
422
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
423
- self.other_properties = other_properties if other_properties is not None else self.other_properties
424
-
425
-
426
- class Branched(_Branched):
427
- """
428
- A class representing a branched reaction rate constant.
429
-
430
- (TODO: get details from MusicBox)
431
-
432
- Attributes:
433
- name (str): The name of the branched reaction rate constant.
434
- X (float): Pre-exponential branching factor [(mol m-3)^-(n-1)s-1].
435
- Y (float): Exponential branching factor [K-1].
436
- a0 (float): Z parameter [unitless].
437
- n (float): A parameter [unitless].
438
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
439
- nitrate_products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the nitrate branch.
440
- alkoxy_products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the alkoxy branch.
441
- gas_phase (Phase): The gas phase in which the reaction occurs.
442
- other_properties (Dict[str, Any]): A dictionary of other properties of the branched reaction rate constant.
443
- """
444
-
445
- def __init__(
446
- self,
447
- name: Optional[str] = None,
448
- X: Optional[float] = None,
449
- Y: Optional[float] = None,
450
- a0: Optional[float] = None,
451
- n: Optional[float] = None,
452
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
453
- nitrate_products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
454
- alkoxy_products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
455
- gas_phase: Optional[Phase] = None,
456
- other_properties: Optional[Dict[str, Any]] = None,
457
- ):
458
- """
459
- Initializes the Branched object with the given parameters.
460
-
461
- Args:
462
- name (str): The name of the branched reaction rate constant.
463
- X (float): Pre-exponential branching factor [(mol m-3)^-(n-1)s-1].
464
- Y (float): Exponential branching factor [K-1].
465
- a0 (float): Z parameter [unitless].
466
- n (float): A parameter [unitless].
467
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
468
- nitrate_products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the nitrate branch.
469
- alkoxy_products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the alkoxy branch.
470
- gas_phase (Phase): The gas phase in which the reaction occurs.
471
- other_properties (Dict[str, Any]): A dictionary of other properties of the branched reaction rate constant.
472
- """
473
- super().__init__()
474
- self.name = name if name is not None else self.name
475
- self.X = X if X is not None else self.X
476
- self.Y = Y if Y is not None else self.Y
477
- self.a0 = a0 if a0 is not None else self.a0
478
- self.n = n if n is not None else self.n
479
- self.reactants = (
480
- [
481
- (
482
- _ReactionComponent(r.name)
483
- if isinstance(r, Species)
484
- else _ReactionComponent(r[1].name, r[0])
485
- )
486
- for r in reactants
487
- ]
488
- if reactants is not None
489
- else self.reactants
490
- )
491
- self.nitrate_products = (
492
- [
493
- (
494
- _ReactionComponent(p.name)
495
- if isinstance(p, Species)
496
- else _ReactionComponent(p[1].name, p[0])
497
- )
498
- for p in nitrate_products
499
- ]
500
- if nitrate_products is not None
501
- else self.nitrate_products
502
- )
503
- self.alkoxy_products = (
504
- [
505
- (
506
- _ReactionComponent(p.name)
507
- if isinstance(p, Species)
508
- else _ReactionComponent(p[1].name, p[0])
509
- )
510
- for p in alkoxy_products
511
- ]
512
- if alkoxy_products is not None
513
- else self.alkoxy_products
514
- )
515
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
516
- self.other_properties = other_properties if other_properties is not None else self.other_properties
517
-
518
-
519
- class Tunneling(_Tunneling):
520
- """
521
- A class representing a quantum tunneling reaction rate constant.
522
-
523
- k = A * exp( -B / T ) * exp( C / T^3 )
524
-
525
- where:
526
- k = rate constant
527
- A = pre-exponential factor [(mol m-3)^(n-1)s-1]
528
- B = tunneling parameter [K^-1]
529
- C = tunneling parameter [K^-3]
530
- T = temperature [K]
531
- n = number of reactants
532
-
533
- Attributes:
534
- name (str): The name of the tunneling reaction rate constant.
535
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
536
- B (float): Tunneling parameter [K^-1].
537
- C (float): Tunneling parameter [K^-3].
538
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
539
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
540
- gas_phase (Phase): The gas phase in which the reaction occurs.
541
- other_properties (Dict[str, Any]): A dictionary of other properties of the tunneling reaction rate constant.
542
- """
543
-
544
- def __init__(
545
- self,
546
- name: Optional[str] = None,
547
- A: Optional[float] = None,
548
- B: Optional[float] = None,
549
- C: Optional[float] = None,
550
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
551
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
552
- gas_phase: Optional[Phase] = None,
553
- other_properties: Optional[Dict[str, Any]] = None,
554
- ):
555
- """
556
- Initializes the Tunneling object with the given parameters.
557
-
558
- Args:
559
- name (str): The name of the tunneling reaction rate constant.
560
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
561
- B (float): Tunneling parameter [K^-1].
562
- C (float): Tunneling parameter [K^-3].
563
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
564
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
565
- gas_phase (Phase): The gas phase in which the reaction occurs.
566
- other_properties (Dict[str, Any]): A dictionary of other properties of the tunneling reaction rate constant.
567
- """
568
- super().__init__()
569
- self.name = name if name is not None else self.name
570
- self.A = A if A is not None else self.A
571
- self.B = B if B is not None else self.B
572
- self.C = C if C is not None else self.C
573
- self.reactants = (
574
- [
575
- (
576
- _ReactionComponent(r.name)
577
- if isinstance(r, Species)
578
- else _ReactionComponent(r[1].name, r[0])
579
- )
580
- for r in reactants
581
- ]
582
- if reactants is not None
583
- else self.reactants
584
- )
585
- self.products = (
586
- [
587
- (
588
- _ReactionComponent(p.name)
589
- if isinstance(p, Species)
590
- else _ReactionComponent(p[1].name, p[0])
591
- )
592
- for p in products
593
- ]
594
- if products is not None
595
- else self.products
596
- )
597
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
598
- self.other_properties = other_properties if other_properties is not None else self.other_properties
599
-
600
-
601
- class Surface(_Surface):
602
- """
603
- A class representing a surface in a chemical mechanism.
604
-
605
- (TODO: get details from MusicBox)
606
-
607
- Attributes:
608
- name (str): The name of the surface.
609
- reaction_probability (float): The probability of a reaction occurring on the surface.
610
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
611
- gas_phase_products (List[Union[Species, Tuple[float, Species]]]): The gas phase products formed in the reaction.
612
- gas_phase (Phase): The gas phase in which the reaction occurs.
613
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
614
- other_properties (Dict[str, Any]): A dictionary of other properties of the surface.
615
- """
616
-
617
- def __init__(
618
- self,
619
- name: Optional[str] = None,
620
- reaction_probability: Optional[float] = None,
621
- gas_phase_species: Optional[Union[Species, Tuple[float, Species]]] = None,
622
- gas_phase_products: Optional[
623
- List[Union[Species, Tuple[float, Species]]]
624
- ] = None,
625
- gas_phase: Optional[Phase] = None,
626
- aerosol_phase: Optional[Phase] = None,
627
- other_properties: Optional[Dict[str, Any]] = None,
628
- ):
629
- """
630
- Initializes the Surface object with the given parameters.
631
-
632
- Args:
633
- name (str): The name of the surface.
634
- reaction_probability (float): The probability of a reaction occurring on the surface.
635
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
636
- gas_phase_products (List[Union[Species, Tuple[float, Species]]]): The gas phase products formed in the reaction.
637
- gas_phase (Phase): The gas phase in which the reaction occurs.
638
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
639
- other_properties (Dict[str, Any]): A dictionary of other properties of the surface.
640
- """
641
- super().__init__()
642
- self.name = name if name is not None else self.name
643
- self.reaction_probability = reaction_probability if reaction_probability is not None else self.reaction_probability
644
- self.gas_phase_species = (
645
- (
646
- _ReactionComponent(gas_phase_species.name)
647
- if isinstance(gas_phase_species, Species)
648
- else _ReactionComponent(gas_phase_species[1].name, gas_phase_species[0])
649
- )
650
- if gas_phase_species is not None
651
- else self.gas_phase_species
652
- )
653
- self.gas_phase_products = (
654
- [
655
- (
656
- _ReactionComponent(p.name)
657
- if isinstance(p, Species)
658
- else _ReactionComponent(p[1].name, p[0])
659
- )
660
- for p in gas_phase_products
661
- ]
662
- if gas_phase_products is not None
663
- else self.gas_phase_products
664
- )
665
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
666
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
667
- self.other_properties = other_properties if other_properties is not None else self.other_properties
668
-
669
-
670
- class Photolysis(_Photolysis):
671
- """
672
- A class representing a photolysis reaction rate constant.
673
-
674
- Attributes:
675
- name (str): The name of the photolysis reaction rate constant.
676
- scaling_factor (float): The scaling factor for the photolysis rate constant.
677
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
678
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
679
- gas_phase (Phase): The gas phase in which the reaction occurs.
680
- other_properties (Dict[str, Any]): A dictionary of other properties of the photolysis reaction rate constant.
681
- """
682
-
683
- def __init__(
684
- self,
685
- name: Optional[str] = None,
686
- scaling_factor: Optional[float] = None,
687
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
688
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
689
- gas_phase: Optional[Phase] = None,
690
- other_properties: Optional[Dict[str, Any]] = None,
691
- ):
692
- """
693
- Initializes the Photolysis object with the given parameters.
694
-
695
- Args:
696
- name (str): The name of the photolysis reaction rate constant.
697
- scaling_factor (float): The scaling factor for the photolysis rate constant.
698
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
699
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
700
- gas_phase (Phase): The gas phase in which the reaction occurs.
701
- other_properties (Dict[str, Any]): A dictionary of other properties of the photolysis reaction rate constant.
702
- """
703
- super().__init__()
704
- self.name = name = name if name is not None else self.name
705
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
706
- self.reactants = (
707
- [
708
- (
709
- _ReactionComponent(r.name)
710
- if isinstance(r, Species)
711
- else _ReactionComponent(r[1].name, r[0])
712
- )
713
- for r in reactants
714
- ]
715
- if reactants is not None
716
- else self.reactants
717
- )
718
- self.products = (
719
- [
720
- (
721
- _ReactionComponent(p.name)
722
- if isinstance(p, Species)
723
- else _ReactionComponent(p[1].name, p[0])
724
- )
725
- for p in products
726
- ]
727
- if products is not None
728
- else self.products
729
- )
730
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
731
- self.other_properties = other_properties if other_properties is not None else self.other_properties
732
-
733
-
734
- class CondensedPhasePhotolysis(_CondensedPhasePhotolysis):
735
- """
736
- A class representing a condensed phase photolysis reaction rate constant.
737
-
738
- Attributes:
739
- name (str): The name of the condensed phase photolysis reaction rate constant.
740
- scaling_factor (float): The scaling factor for the photolysis rate constant.
741
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
742
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
743
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
744
- aerosol_phase_water (float): The water species in the aerosol phase [unitless].
745
- other_properties (Dict[str, Any]): A dictionary of other properties of the condensed phase photolysis reaction rate constant.
746
- """
747
-
748
- def __init__(
749
- self,
750
- name: Optional[str] = None,
751
- scaling_factor: Optional[float] = None,
752
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
753
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
754
- aerosol_phase: Optional[Phase] = None,
755
- aerosol_phase_water: Optional[Species] = None,
756
- other_properties: Optional[Dict[str, Any]] = None,
757
- ):
758
- """
759
- Initializes the CondensedPhasePhotolysis object with the given parameters.
760
-
761
- Args:
762
- name (str): The name of the condensed phase photolysis reaction rate constant.
763
- scaling_factor (float): The scaling factor for the photolysis rate constant.
764
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
765
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
766
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
767
- aerosol_phase_water (Species): The water species in the aerosol phase [unitless].
768
- other_properties (Dict[str, Any]): A dictionary of other properties of the condensed phase photolysis reaction rate constant.
769
- """
770
- super().__init__()
771
- self.name = name if name is not None else self.name
772
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
773
- self.reactants = (
774
- [
775
- (
776
- _ReactionComponent(r.name)
777
- if isinstance(r, Species)
778
- else _ReactionComponent(r[1].name, r[0])
779
- )
780
- for r in reactants
781
- ]
782
- if reactants is not None
783
- else self.reactants
784
- )
785
- self.products = (
786
- [
787
- (
788
- _ReactionComponent(p.name)
789
- if isinstance(p, Species)
790
- else _ReactionComponent(p[1].name, p[0])
791
- )
792
- for p in products
793
- ]
794
- if products is not None
795
- else self.products
796
- )
797
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
798
- self.aerosol_phase_water = (
799
- aerosol_phase_water.name if aerosol_phase_water is not None else self.aerosol_phase_water
800
- )
801
- self.other_properties = other_properties if other_properties is not None else self.other_properties
802
-
803
-
804
- class Emission(_Emission):
805
- """
806
- A class representing an emission reaction rate constant.
807
-
808
- Attributes:
809
- name (str): The name of the emission reaction rate constant.
810
- scaling_factor (float): The scaling factor for the emission rate constant.
811
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
812
- gas_phase (Phase): The gas phase in which the reaction occurs.
813
- other_properties (Dict[str, Any]): A dictionary of other properties of the emission reaction rate constant.
814
- """
815
-
816
- def __init__(
817
- self,
818
- name: Optional[str] = None,
819
- scaling_factor: Optional[float] = None,
820
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
821
- gas_phase: Optional[Phase] = None,
822
- other_properties: Optional[Dict[str, Any]] = None,
823
- ):
824
- """
825
- Initializes the Emission object with the given parameters.
826
-
827
- Args:
828
- name (str): The name of the emission reaction rate constant.
829
- scaling_factor (float): The scaling factor for the emission rate constant.
830
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
831
- gas_phase (Phase): The gas phase in which the reaction occurs.
832
- other_properties (Dict[str, Any]): A dictionary of other properties of the emission reaction rate constant.
833
- """
834
- super().__init__()
835
- self.name = name if name is not None else self.name
836
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
837
- self.products = (
838
- [
839
- (
840
- _ReactionComponent(p.name)
841
- if isinstance(p, Species)
842
- else _ReactionComponent(p[1].name, p[0])
843
- )
844
- for p in products
845
- ]
846
- if products is not None
847
- else self.products
848
- )
849
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
850
- self.other_properties = other_properties if other_properties is not None else self.other_properties
851
-
852
-
853
- class FirstOrderLoss(_FirstOrderLoss):
854
- """
855
- A class representing a first-order loss reaction rate constant.
856
-
857
- Attributes:
858
- name (str): The name of the first-order loss reaction rate constant.
859
- scaling_factor (float): The scaling factor for the first-order loss rate constant.
860
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
861
- gas_phase (Phase): The gas phase in which the reaction occurs.
862
- other_properties (Dict[str, Any]): A dictionary of other properties of the first-order loss reaction rate constant.
863
- """
864
-
865
- def __init__(
866
- self,
867
- name: Optional[str] = None,
868
- scaling_factor: Optional[float] = None,
869
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
870
- gas_phase: Optional[Phase] = None,
871
- other_properties: Optional[Dict[str, Any]] = None,
872
- ):
873
- """
874
- Initializes the FirstOrderLoss object with the given parameters.
875
-
876
- Args:
877
- name (str): The name of the first-order loss reaction rate constant.
878
- scaling_factor (float): The scaling factor for the first-order loss rate constant.
879
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
880
- gas_phase (Phase): The gas phase in which the reaction occurs.
881
- other_properties (Dict[str, Any]): A dictionary of other properties of the first-order loss reaction rate constant.
882
- """
883
- super().__init__()
884
- self.name = name if name is not None else self.name
885
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
886
- self.reactants = (
887
- [
888
- (
889
- _ReactionComponent(r.name)
890
- if isinstance(r, Species)
891
- else _ReactionComponent(r[1].name, r[0])
892
- )
893
- for r in reactants
894
- ]
895
- if reactants is not None
896
- else self.reactants
897
- )
898
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
899
- self.other_properties = other_properties if other_properties is not None else self.other_properties
900
-
901
-
902
- class AqueousEquilibrium(_AqueousEquilibrium):
903
- """
904
- A class representing an aqueous equilibrium reaction rate constant.
905
-
906
- Attributes:
907
- name (str): The name of the aqueous equilibrium reaction rate constant.
908
- gas_phase (Phase): The gas phase in which the reaction occurs.
909
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
910
- aerosol_phase_water (Species): The water species in the aerosol phase.
911
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
912
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
913
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
914
- C (float): Exponential term [K-1].
915
- k_reverse (float): Reverse rate constant [(mol m-3)^(n-1)s-1].
916
- other_properties (Dict[str, Any]): A dictionary of other properties of the aqueous equilibrium reaction rate constant.
917
- """
918
-
919
- def __init__(
920
- self,
921
- name: Optional[str] = None,
922
- gas_phase: Optional[Phase] = None,
923
- aerosol_phase: Optional[Phase] = None,
924
- aerosol_phase_water: Optional[Species] = None,
925
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
926
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
927
- A: Optional[float] = None,
928
- C: Optional[float] = None,
929
- k_reverse: Optional[float] = None,
930
- other_properties: Optional[Dict[str, Any]] = None,
931
- ):
932
- """
933
- Initializes the AqueousEquilibrium object with the given parameters.
934
-
935
- Args:
936
- name (str): The name of the aqueous equilibrium reaction rate constant.
937
- gas_phase (Phase): The gas phase in which the reaction occurs.
938
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
939
- aerosol_phase_water (Species): The water species in the aerosol phase.
940
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
941
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
942
- A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
943
- C (float): Exponential term [K-1].
944
- k_reverse (float): Reverse rate constant [(mol m-3)^(n-1)s-1].
945
- other_properties (Dict[str, Any]): A dictionary of other properties of the aqueous equilibrium reaction rate constant.
946
- """
947
- super().__init__()
948
- self.name = name if name is not None else self.name
949
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
950
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
951
- self.aerosol_phase_water = (
952
- aerosol_phase_water.name if aerosol_phase_water is not None else self.aerosol_phase_water
953
- )
954
- self.reactants = (
955
- [
956
- (
957
- _ReactionComponent(r.name)
958
- if isinstance(r, Species)
959
- else _ReactionComponent(r[1].name, r[0])
960
- )
961
- for r in reactants
962
- ]
963
- if reactants is not None
964
- else self.reactants
965
- )
966
- self.products = (
967
- [
968
- (
969
- _ReactionComponent(p.name)
970
- if isinstance(p, Species)
971
- else _ReactionComponent(p[1].name, p[0])
972
- )
973
- for p in products
974
- ]
975
- if products is not None
976
- else self.products
977
- )
978
- self.A = A if A is not None else self.A
979
- self.C = C if C is not None else self.C
980
- self.k_reverse = k_reverse if k_reverse is not None else self.k_reverse
981
- self.other_properties = other_properties if other_properties is not None else self.other_properties
982
-
983
-
984
- class WetDeposition(_WetDeposition):
985
- """
986
- A class representing a wet deposition reaction rate constant.
987
-
988
- Attributes:
989
- name (str): The name of the wet deposition reaction rate constant.
990
- scaling_factor (float): The scaling factor for the wet deposition rate constant.
991
- aerosol_phase (Phase): The aerosol phase which undergoes wet deposition.
992
- unknown_properties (Dict[str, Any]): A dictionary of other properties of the wet deposition reaction rate constant.
993
- """
994
-
995
- def __init__(
996
- self,
997
- name: Optional[str] = None,
998
- scaling_factor: Optional[float] = None,
999
- aerosol_phase: Optional[Phase] = None,
1000
- other_properties: Optional[Dict[str, Any]] = None,
1001
- ):
1002
- """
1003
- Initializes the WetDeposition object with the given parameters.
1004
-
1005
- Args:
1006
- name (str): The name of the wet deposition reaction rate constant.
1007
- scaling_factor (float): The scaling factor for the wet deposition rate constant.
1008
- aerosol_phase (Phase): The aerosol phase which undergoes wet deposition.
1009
- other_properties (Dict[str, Any]): A dictionary of other properties of the wet deposition reaction rate constant.
1010
- """
1011
- super().__init__()
1012
- self.name = name if name is not None else self.name
1013
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
1014
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
1015
- self.other_properties = other_properties if other_properties is not None else self.other_properties
1016
-
1017
-
1018
- class HenrysLaw(_HenrysLaw):
1019
- """
1020
- A class representing a Henry's law reaction rate constant.
1021
-
1022
- Attributes:
1023
- name (str): The name of the Henry's law reaction rate constant.
1024
- gas_phase (Phase): The gas phase in which the reaction occurs.
1025
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
1026
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
1027
- aerosol_phase_water (Species): The water species in the aerosol phase.
1028
- aerosol_phase_species (Union[Species, Tuple[float, Species]]): The aerosol phase species involved in the reaction.
1029
- other_properties (Dict[str, Any]): A dictionary of other properties of the Henry's law reaction rate constant.
1030
- """
1031
-
1032
- def __init__(
1033
- self,
1034
- name: Optional[str] = None,
1035
- gas_phase: Optional[Phase] = None,
1036
- gas_phase_species: Optional[Union[Species, Tuple[float, Species]]] = None,
1037
- aerosol_phase: Optional[Phase] = None,
1038
- aerosol_phase_water: Optional[Species] = None,
1039
- aerosol_phase_species: Optional[Union[Species, Tuple[float, Species]]] = None,
1040
- other_properties: Optional[Dict[str, Any]] = None,
1041
- ):
1042
- """
1043
- Initializes the HenrysLaw object with the given parameters.
1044
-
1045
- Args:
1046
- name (str): The name of the Henry's law reaction rate constant.
1047
- gas_phase (Phase): The gas phase in which the reaction occurs.
1048
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
1049
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
1050
- aerosol_phase_water (Species): The water species in the aerosol phase.
1051
- aerosol_phase_species (Union[Species, Tuple[float, Species]]): The aerosol phase species involved in the reaction.
1052
- other_properties (Dict[str, Any]): A dictionary of other properties of the Henry's law reaction rate constant.
1053
- """
1054
- super().__init__()
1055
- self.name = name if name is not None else self.name
1056
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
1057
- self.gas_phase_species = (
1058
- (
1059
- _ReactionComponent(gas_phase_species.name)
1060
- if isinstance(gas_phase_species, Species)
1061
- else _ReactionComponent(gas_phase_species[1].name, gas_phase_species[0])
1062
- )
1063
- if gas_phase_species is not None
1064
- else self.gas_phase_species
1065
- )
1066
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
1067
- self.aerosol_phase_water = (
1068
- aerosol_phase_water.name if aerosol_phase_water is not None else self.aerosol_phase_water
1069
- )
1070
- self.aerosol_phase_species = (
1071
- (
1072
- _ReactionComponent(aerosol_phase_species.name)
1073
- if isinstance(aerosol_phase_species, Species)
1074
- else _ReactionComponent(
1075
- aerosol_phase_species[1].name, aerosol_phase_species[0]
1076
- )
1077
- )
1078
- if aerosol_phase_species is not None
1079
- else self.aerosol_phase_species
1080
- )
1081
- self.other_properties = other_properties if other_properties is not None else self.other_properties
1082
-
1083
-
1084
- class SimpolPhaseTransfer(_SimpolPhaseTransfer):
1085
- """
1086
- A class representing a simplified phase transfer reaction rate constant.
1087
-
1088
- Attributes:
1089
- name (str): The name of the simplified phase transfer reaction rate constant.
1090
- gas_phase (Phase): The gas phase in which the reaction occurs.
1091
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
1092
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
1093
- aerosol_phase_species (Union[Species, Tuple[float, Species]]): The aerosol phase species involved in the reaction.
1094
- B (List[float]): The B parameters [unitless].
1095
- unknown_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
1096
- """
1097
-
1098
- def __init__(
1099
- self,
1100
- name: Optional[str] = None,
1101
- gas_phase: Optional[Phase] = None,
1102
- gas_phase_species: Optional[Union[Species, Tuple[float, Species]]] = None,
1103
- aerosol_phase: Optional[Phase] = None,
1104
- aerosol_phase_species: Optional[Union[Species, Tuple[float, Species]]] = None,
1105
- B: Optional[List[float]] = None,
1106
- other_properties: Optional[Dict[str, Any]] = None,
1107
- ):
1108
- """
1109
- Initializes the SimpolPhaseTransfer object with the given parameters.
1110
-
1111
- Args:
1112
- name (str): The name of the simplified phase transfer reaction rate constant.
1113
- gas_phase (Phase): The gas phase in which the reaction occurs.
1114
- gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
1115
- aerosol_phase (Phase): The aerosol phase in which the reaction occurs.
1116
- aerosol_phase_species (Union[Species, Tuple[float, Species]]): The aerosol phase species involved in the reaction.
1117
- B (List[float]): The B parameters [unitless].
1118
- other_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
1119
- """
1120
- super().__init__()
1121
- self.name = name if name is not None else self.name
1122
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
1123
- self.gas_phase_species = (
1124
- (
1125
- _ReactionComponent(gas_phase_species.name)
1126
- if isinstance(gas_phase_species, Species)
1127
- else _ReactionComponent(gas_phase_species[1].name, gas_phase_species[0])
1128
- )
1129
- if gas_phase_species is not None
1130
- else self.gas_phase_species
1131
- )
1132
- self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
1133
- self.aerosol_phase_species = (
1134
- (
1135
- _ReactionComponent(aerosol_phase_species.name)
1136
- if isinstance(aerosol_phase_species, Species)
1137
- else _ReactionComponent(
1138
- aerosol_phase_species[1].name, aerosol_phase_species[0]
1139
- )
1140
- )
1141
- if aerosol_phase_species is not None
1142
- else self.aerosol_phase_species
1143
- )
1144
- if B is not None:
1145
- if len(B) != 4:
1146
- raise ValueError("B must be a list of 4 elements.")
1147
- self.B = B
1148
- else:
1149
- self.B = [0, 0, 0, 0]
1150
- self.other_properties = other_properties if other_properties is not None else self.other_properties
1151
-
1152
-
1153
- class UserDefined(_UserDefined):
1154
- """
1155
- A class representing a user-defined reaction rate constant.
1156
-
1157
- Attributes:
1158
- name (str): The name of the photolysis reaction rate constant.
1159
- scaling_factor (float): The scaling factor for the photolysis rate constant.
1160
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
1161
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
1162
- gas_phase (Phase): The gas phase in which the reaction occurs.
1163
- other_properties (Dict[str, Any]): A dictionary of other properties of the photolysis reaction rate constant.
1164
- """
1165
-
1166
- def __init__(
1167
- self,
1168
- name: Optional[str] = None,
1169
- scaling_factor: Optional[float] = None,
1170
- reactants: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
1171
- products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
1172
- gas_phase: Optional[Phase] = None,
1173
- other_properties: Optional[Dict[str, Any]] = None,
1174
- ):
1175
- """
1176
- Initializes the UserDefined object with the given parameters.
1177
-
1178
- Args:
1179
- name (str): The name of the photolysis reaction rate constant.
1180
- scaling_factor (float): The scaling factor for the photolysis rate constant.
1181
- reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
1182
- products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
1183
- gas_phase (Phase): The gas phase in which the reaction occurs.
1184
- other_properties (Dict[str, Any]): A dictionary of other properties of the photolysis reaction rate constant.
1185
- """
1186
- super().__init__()
1187
- self.name = name if name is not None else self.name
1188
- self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
1189
- self.reactants = (
1190
- [
1191
- (
1192
- _ReactionComponent(r.name)
1193
- if isinstance(r, Species)
1194
- else _ReactionComponent(r[1].name, r[0])
1195
- )
1196
- for r in reactants
1197
- ]
1198
- if reactants is not None
1199
- else self.reactants
1200
- )
1201
- self.products = (
1202
- [
1203
- (
1204
- _ReactionComponent(p.name)
1205
- if isinstance(p, Species)
1206
- else _ReactionComponent(p[1].name, p[0])
1207
- )
1208
- for p in products
1209
- ]
1210
- if products is not None
1211
- else self.products
1212
- )
1213
- self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
1214
- self.other_properties = other_properties if other_properties is not None else self.other_properties
1215
-
1216
-
1217
- class Reactions(_Reactions):
1218
- """
1219
- A class representing a collection of reactions in a chemical mechanism.
1220
-
1221
- Attributes:
1222
- reactions (List[Any]): A list of reactions in the mechanism.
1223
- """
1224
-
1225
- def __init__(
1226
- self,
1227
- reactions: Optional[List[Any]] = None,
1228
- ):
1229
- """
1230
- Initializes the Reactions object with the given parameters.
1231
-
1232
- Args:
1233
- reactions (List[]): A list of reactions in the mechanism.
1234
- """
1235
- super().__init__(reactions)
1236
-
1237
-
1238
- class ReactionsIterator(_ReactionsIterator):
1239
- """
1240
- An iterator for the Reactions class.
1241
- """
1242
-
1243
-
1244
- class Version(_Version):
1245
- """
1246
- A class representing the version of the mechanism.
1247
- """
1248
-
1249
-
1250
- class Mechanism(_Mechanism):
1251
- """
1252
- A class representing a chemical mechanism.
1253
-
1254
- Attributes:
1255
- name (str): The name of the mechanism.
1256
- reactions (List[Reaction]): A list of reactions in the mechanism.
1257
- species (List[Species]): A list of species in the mechanism.
1258
- phases (List[Phase]): A list of phases in the mechanism.
1259
- version (Version): The version of the mechanism.
1260
- """
1261
-
1262
- def __init__(
1263
- self,
1264
- name: Optional[str] = None,
1265
- reactions: Optional[List[Any]] = None,
1266
- species: Optional[List[Species]] = None,
1267
- phases: Optional[List[Phase]] = None,
1268
- version: Optional[Version] = None,
1269
- ):
1270
- """
1271
- Initializes the Mechanism object with the given parameters.
1272
-
1273
- Args:
1274
- name (str): The name of the mechanism.
1275
- reactions (List[]): A list of reactions in the mechanism.
1276
- species (List[Species]): A list of species in the mechanism.
1277
- phases (List[Phase]): A list of phases in the mechanism.
1278
- version (Version): The version of the mechanism.
1279
- """
1280
- super().__init__()
1281
- self.name = name
1282
- self.species = species if species is not None else []
1283
- self.phases = phases if phases is not None else []
1284
- self.reactions = Reactions(reactions=reactions)
1285
- self.version = version if version is not None else Version()
1286
-
1287
-
1288
- class Parser(_Parser):
1289
- """
1290
- A class for parsing a chemical mechanism.
1291
- """