musica 0.12.2__cp312-cp312-win_amd64.whl → 0.13.0__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.
Potentially problematic release.
This version of musica might be problematic. Click here for more details.
- musica/CMakeLists.txt +4 -0
- musica/_musica.cp312-win_amd64.pyd +0 -0
- musica/_version.py +1 -1
- musica/binding_common.cpp +6 -9
- musica/binding_common.hpp +17 -1
- musica/grid.cpp +206 -0
- musica/grid.py +98 -0
- musica/grid_map.cpp +117 -0
- musica/grid_map.py +167 -0
- musica/mechanism_configuration/__init__.py +18 -1
- musica/mechanism_configuration/ancillary.py +6 -0
- musica/mechanism_configuration/arrhenius.py +111 -269
- musica/mechanism_configuration/branched.py +116 -275
- musica/mechanism_configuration/emission.py +63 -52
- musica/mechanism_configuration/first_order_loss.py +73 -157
- musica/mechanism_configuration/mechanism.py +93 -0
- musica/mechanism_configuration/phase.py +44 -33
- musica/mechanism_configuration/phase_species.py +58 -0
- musica/mechanism_configuration/photolysis.py +77 -67
- musica/mechanism_configuration/reaction_component.py +54 -0
- musica/mechanism_configuration/reactions.py +17 -58
- musica/mechanism_configuration/species.py +45 -71
- musica/mechanism_configuration/surface.py +78 -74
- musica/mechanism_configuration/taylor_series.py +136 -0
- musica/mechanism_configuration/ternary_chemical_activation.py +138 -330
- musica/mechanism_configuration/troe.py +138 -330
- musica/mechanism_configuration/tunneling.py +105 -229
- musica/mechanism_configuration/user_defined.py +79 -68
- musica/mechanism_configuration.cpp +54 -162
- musica/musica.cpp +2 -5
- musica/profile.cpp +294 -0
- musica/profile.py +93 -0
- musica/profile_map.cpp +117 -0
- musica/profile_map.py +167 -0
- musica/test/examples/v1/full_configuration/full_configuration.json +91 -233
- musica/test/examples/v1/full_configuration/full_configuration.yaml +191 -290
- musica/test/integration/test_chapman.py +2 -2
- musica/test/integration/test_tuvx.py +72 -15
- musica/test/unit/test_grid.py +137 -0
- musica/test/unit/test_grid_map.py +126 -0
- musica/test/unit/test_parser.py +10 -10
- musica/test/unit/test_profile.py +169 -0
- musica/test/unit/test_profile_map.py +137 -0
- musica/test/unit/test_serializer.py +17 -16
- musica/test/unit/test_state.py +17 -4
- musica/test/unit/test_util_full_mechanism.py +78 -298
- musica/tuvx.cpp +94 -15
- musica/tuvx.py +92 -22
- musica/types.py +13 -5
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/METADATA +14 -14
- musica-0.13.0.dist-info/RECORD +80 -0
- musica/mechanism_configuration/aqueous_equilibrium.py +0 -274
- musica/mechanism_configuration/condensed_phase_arrhenius.py +0 -309
- musica/mechanism_configuration/condensed_phase_photolysis.py +0 -88
- musica/mechanism_configuration/henrys_law.py +0 -44
- musica/mechanism_configuration/mechanism_configuration.py +0 -234
- musica/mechanism_configuration/simpol_phase_transfer.py +0 -217
- musica/mechanism_configuration/wet_deposition.py +0 -52
- musica-0.12.2.dist-info/RECORD +0 -70
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/WHEEL +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/entry_points.txt +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/licenses/AUTHORS.md +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Any, Dict, Union, Tuple
|
|
2
|
-
from .. import backend
|
|
3
|
-
from .phase import Phase
|
|
4
|
-
from .species import Species
|
|
5
|
-
from .utils import _add_other_properties
|
|
6
|
-
|
|
7
|
-
_backend = backend.get_backend()
|
|
8
|
-
_HenrysLaw = _backend._mechanism_configuration._HenrysLaw
|
|
9
|
-
_ReactionComponent = _backend._mechanism_configuration._ReactionComponent
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class HenrysLaw(_HenrysLaw):
|
|
13
|
-
"""
|
|
14
|
-
A class representing a Henry's law reaction rate constant.
|
|
15
|
-
|
|
16
|
-
Attributes:
|
|
17
|
-
name (str): The name of the Henry's law reaction rate constant.
|
|
18
|
-
other_properties (Dict[str, Any]): A dictionary of other properties of the Henry's law reaction rate constant.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
def __init__(
|
|
22
|
-
self,
|
|
23
|
-
name: Optional[str] = None,
|
|
24
|
-
other_properties: Optional[Dict[str, Any]] = None,
|
|
25
|
-
):
|
|
26
|
-
"""
|
|
27
|
-
Initializes the HenrysLaw object with the given parameters.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
name (str): The name of the Henry's law reaction rate constant.
|
|
31
|
-
other_properties (Dict[str, Any]): A dictionary of other properties of the Henry's law reaction rate constant.
|
|
32
|
-
"""
|
|
33
|
-
super().__init__()
|
|
34
|
-
self.name = name if name is not None else self.name
|
|
35
|
-
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
36
|
-
|
|
37
|
-
@staticmethod
|
|
38
|
-
def serialize(instance) -> Dict:
|
|
39
|
-
serialize_dict = {
|
|
40
|
-
"type": "HL_PHASE_TRANSFER",
|
|
41
|
-
"name": instance.name,
|
|
42
|
-
}
|
|
43
|
-
_add_other_properties(serialize_dict, instance.other_properties)
|
|
44
|
-
return serialize_dict
|
|
@@ -1,234 +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 .reactions import Reactions, ReactionType
|
|
7
|
-
from .user_defined import UserDefined, _UserDefined
|
|
8
|
-
from .simpol_phase_transfer import SimpolPhaseTransfer, _SimpolPhaseTransfer
|
|
9
|
-
from .henrys_law import HenrysLaw, _HenrysLaw
|
|
10
|
-
from .wet_deposition import WetDeposition, _WetDeposition
|
|
11
|
-
from .aqueous_equilibrium import AqueousEquilibrium, _AqueousEquilibrium
|
|
12
|
-
from .first_order_loss import FirstOrderLoss, _FirstOrderLoss
|
|
13
|
-
from .emission import Emission, _Emission
|
|
14
|
-
from .condensed_phase_photolysis import CondensedPhasePhotolysis, _CondensedPhasePhotolysis
|
|
15
|
-
from .photolysis import Photolysis, _Photolysis
|
|
16
|
-
from .surface import Surface, _Surface
|
|
17
|
-
from .tunneling import Tunneling, _Tunneling
|
|
18
|
-
from .branched import Branched, _Branched
|
|
19
|
-
from .troe import Troe, _Troe
|
|
20
|
-
from .ternary_chemical_activation import TernaryChemicalActivation, _TernaryChemicalActivation
|
|
21
|
-
from .condensed_phase_arrhenius import CondensedPhaseArrhenius, _CondensedPhaseArrhenius
|
|
22
|
-
from .arrhenius import Arrhenius, _Arrhenius
|
|
23
|
-
from .phase import Phase
|
|
24
|
-
from .species import Species
|
|
25
|
-
import os
|
|
26
|
-
import json
|
|
27
|
-
import yaml
|
|
28
|
-
from typing import Optional, Any, Dict, List
|
|
29
|
-
from .. import backend
|
|
30
|
-
|
|
31
|
-
_backend = backend.get_backend()
|
|
32
|
-
_mc = _backend._mechanism_configuration
|
|
33
|
-
_Mechanism = _mc._Mechanism
|
|
34
|
-
_Version = _mc._Version
|
|
35
|
-
_Parser = _mc._Parser
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class Version(_Version):
|
|
39
|
-
"""
|
|
40
|
-
A class representing the version of the mechanism.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class Mechanism(_Mechanism):
|
|
45
|
-
"""
|
|
46
|
-
A class representing a chemical mechanism.
|
|
47
|
-
|
|
48
|
-
Attributes:
|
|
49
|
-
name (str): The name of the mechanism.
|
|
50
|
-
reactions (List[Reaction]): A list of reactions in the mechanism.
|
|
51
|
-
species (List[Species]): A list of species in the mechanism.
|
|
52
|
-
phases (List[Phase]): A list of phases in the mechanism.
|
|
53
|
-
version (Version): The version of the mechanism.
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
def __init__(
|
|
57
|
-
self,
|
|
58
|
-
name: Optional[str] = None,
|
|
59
|
-
reactions: Optional[List[Any]] = None,
|
|
60
|
-
species: Optional[List[Species]] = None,
|
|
61
|
-
phases: Optional[List[Phase]] = None,
|
|
62
|
-
version: Optional[Version] = None,
|
|
63
|
-
):
|
|
64
|
-
"""
|
|
65
|
-
Initializes the Mechanism object with the given parameters.
|
|
66
|
-
|
|
67
|
-
Args:
|
|
68
|
-
name (str): The name of the mechanism.
|
|
69
|
-
reactions (List[]): A list of reactions in the mechanism.
|
|
70
|
-
species (List[Species]): A list of species in the mechanism.
|
|
71
|
-
phases (List[Phase]): A list of phases in the mechanism.
|
|
72
|
-
version (Version): The version of the mechanism.
|
|
73
|
-
"""
|
|
74
|
-
super().__init__()
|
|
75
|
-
self.name = name
|
|
76
|
-
self.species = species if species is not None else []
|
|
77
|
-
self.phases = phases if phases is not None else []
|
|
78
|
-
self.reactions = Reactions(
|
|
79
|
-
reactions=reactions if reactions is not None else [])
|
|
80
|
-
self.version = version if version is not None else Version()
|
|
81
|
-
|
|
82
|
-
def to_dict(self) -> Dict:
|
|
83
|
-
species_list = []
|
|
84
|
-
for species in self.species:
|
|
85
|
-
species_list.append(Species.serialize(species))
|
|
86
|
-
|
|
87
|
-
phases_list = []
|
|
88
|
-
for phase in self.phases:
|
|
89
|
-
phases_list.append(Phase.serialize(phase))
|
|
90
|
-
|
|
91
|
-
reactions_list = []
|
|
92
|
-
for reaction in self.reactions:
|
|
93
|
-
if isinstance(reaction, _Arrhenius):
|
|
94
|
-
# Handle C++ _Arrhenius objects with static serialize call
|
|
95
|
-
reactions_list.append(Arrhenius.serialize_static(reaction))
|
|
96
|
-
elif isinstance(reaction, Arrhenius):
|
|
97
|
-
# Handle Python Arrhenius objects with instance serialize call
|
|
98
|
-
reactions_list.append(reaction.serialize())
|
|
99
|
-
elif isinstance(reaction, _Branched):
|
|
100
|
-
# Handle C++ _Branched objects with static serialize call
|
|
101
|
-
reactions_list.append(Branched.serialize_static(reaction))
|
|
102
|
-
elif isinstance(reaction, Branched):
|
|
103
|
-
# Handle Python Branched objects with instance serialize call
|
|
104
|
-
reactions_list.append(reaction.serialize())
|
|
105
|
-
elif isinstance(reaction, (_CondensedPhaseArrhenius, CondensedPhaseArrhenius)):
|
|
106
|
-
reactions_list.append(
|
|
107
|
-
CondensedPhaseArrhenius.serialize_static(reaction))
|
|
108
|
-
elif isinstance(reaction, (_CondensedPhasePhotolysis, CondensedPhasePhotolysis)):
|
|
109
|
-
reactions_list.append(
|
|
110
|
-
CondensedPhasePhotolysis.serialize(reaction))
|
|
111
|
-
elif isinstance(reaction, (_Emission, Emission)):
|
|
112
|
-
reactions_list.append(Emission.serialize(reaction))
|
|
113
|
-
elif isinstance(reaction, _FirstOrderLoss):
|
|
114
|
-
# Handle C++ _FirstOrderLoss objects with static serialize call
|
|
115
|
-
reactions_list.append(FirstOrderLoss.serialize_static(reaction))
|
|
116
|
-
elif isinstance(reaction, FirstOrderLoss):
|
|
117
|
-
# Handle Python FirstOrderLoss objects with instance serialize call
|
|
118
|
-
reactions_list.append(reaction.serialize())
|
|
119
|
-
elif isinstance(reaction, _SimpolPhaseTransfer):
|
|
120
|
-
# Handle C++ _SimpolPhaseTransfer objects with static serialize call
|
|
121
|
-
reactions_list.append(
|
|
122
|
-
SimpolPhaseTransfer.serialize_static(reaction))
|
|
123
|
-
elif isinstance(reaction, SimpolPhaseTransfer):
|
|
124
|
-
# Handle Python SimpolPhaseTransfer objects with instance serialize call
|
|
125
|
-
reactions_list.append(reaction.serialize())
|
|
126
|
-
elif isinstance(reaction, _AqueousEquilibrium):
|
|
127
|
-
# Handle C++ _AqueousEquilibrium objects with static serialize call
|
|
128
|
-
reactions_list.append(
|
|
129
|
-
AqueousEquilibrium.serialize_static(reaction))
|
|
130
|
-
elif isinstance(reaction, AqueousEquilibrium):
|
|
131
|
-
# Handle Python AqueousEquilibrium objects with instance serialize call
|
|
132
|
-
reactions_list.append(reaction.serialize())
|
|
133
|
-
elif isinstance(reaction, (_WetDeposition, WetDeposition)):
|
|
134
|
-
reactions_list.append(WetDeposition.serialize(reaction))
|
|
135
|
-
elif isinstance(reaction, (_HenrysLaw, HenrysLaw)):
|
|
136
|
-
reactions_list.append(HenrysLaw.serialize(reaction))
|
|
137
|
-
elif isinstance(reaction, (_Photolysis, Photolysis)):
|
|
138
|
-
reactions_list.append(Photolysis.serialize(reaction))
|
|
139
|
-
elif isinstance(reaction, (_Surface, Surface)):
|
|
140
|
-
reactions_list.append(Surface.serialize(reaction))
|
|
141
|
-
elif isinstance(reaction, _Troe):
|
|
142
|
-
# Handle C++ _Troe objects with static serialize call
|
|
143
|
-
reactions_list.append(Troe.serialize_static(reaction))
|
|
144
|
-
elif isinstance(reaction, Troe):
|
|
145
|
-
# Handle Python Troe objects with instance serialize call
|
|
146
|
-
reactions_list.append(reaction.serialize())
|
|
147
|
-
elif isinstance(reaction, _TernaryChemicalActivation):
|
|
148
|
-
# Handle C++ _TernaryChemicalActivation objects with static serialize call
|
|
149
|
-
reactions_list.append(TernaryChemicalActivation.serialize_static(reaction))
|
|
150
|
-
elif isinstance(reaction, TernaryChemicalActivation):
|
|
151
|
-
# Handle Python TernaryChemicalActivation objects with instance serialize call
|
|
152
|
-
reactions_list.append(reaction.serialize())
|
|
153
|
-
elif isinstance(reaction, _Tunneling):
|
|
154
|
-
# Handle C++ _Tunneling objects with static serialize call
|
|
155
|
-
reactions_list.append(Tunneling.serialize_static(reaction))
|
|
156
|
-
elif isinstance(reaction, Tunneling):
|
|
157
|
-
# Handle Python Tunneling objects with instance serialize call
|
|
158
|
-
reactions_list.append(reaction.serialize())
|
|
159
|
-
elif isinstance(reaction, (_UserDefined, UserDefined)):
|
|
160
|
-
reactions_list.append(UserDefined.serialize(reaction))
|
|
161
|
-
else:
|
|
162
|
-
raise TypeError(
|
|
163
|
-
f'Reaction type {type(reaction)} is not supported for export.')
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
"name": self.name,
|
|
167
|
-
"reactions": reactions_list,
|
|
168
|
-
"species": species_list,
|
|
169
|
-
"phases": phases_list,
|
|
170
|
-
"version": self.version.to_string(),
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
def export(self, file_path: str) -> None:
|
|
174
|
-
MechanismSerializer.serialize(self, file_path)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
class Parser(_Parser):
|
|
178
|
-
"""
|
|
179
|
-
A class for parsing a chemical mechanism.
|
|
180
|
-
"""
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
class MechanismSerializer():
|
|
184
|
-
"""
|
|
185
|
-
A class for exporting a chemical mechanism.
|
|
186
|
-
"""
|
|
187
|
-
|
|
188
|
-
@staticmethod
|
|
189
|
-
def _convert_cpp_mechanism_to_python(cpp_mechanism: Any) -> Mechanism:
|
|
190
|
-
"""
|
|
191
|
-
Convert a C++ _Mechanism object to a Python Mechanism object.
|
|
192
|
-
"""
|
|
193
|
-
reactions_list = []
|
|
194
|
-
for reaction in cpp_mechanism.reactions:
|
|
195
|
-
reactions_list.append(reaction)
|
|
196
|
-
|
|
197
|
-
python_mechanism = Mechanism(
|
|
198
|
-
name=cpp_mechanism.name,
|
|
199
|
-
reactions=reactions_list,
|
|
200
|
-
species=list(cpp_mechanism.species),
|
|
201
|
-
phases=list(cpp_mechanism.phases),
|
|
202
|
-
version=Version() if cpp_mechanism.version is None else cpp_mechanism.version
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
return python_mechanism
|
|
206
|
-
|
|
207
|
-
@staticmethod
|
|
208
|
-
def serialize(mechanism: Mechanism, file_path: str = "./mechanism.json") -> None:
|
|
209
|
-
if not isinstance(mechanism, (Mechanism, _Mechanism)):
|
|
210
|
-
raise TypeError(f"Object {mechanism} is not of type Mechanism.")
|
|
211
|
-
|
|
212
|
-
directory, file = os.path.split(file_path)
|
|
213
|
-
if directory:
|
|
214
|
-
os.makedirs(directory, exist_ok=True)
|
|
215
|
-
|
|
216
|
-
if isinstance(mechanism, _Mechanism) and not isinstance(mechanism, Mechanism):
|
|
217
|
-
mechanism = MechanismSerializer._convert_cpp_mechanism_to_python(
|
|
218
|
-
mechanism)
|
|
219
|
-
|
|
220
|
-
# Now we can use the standard to_dict method
|
|
221
|
-
dictionary = mechanism.to_dict()
|
|
222
|
-
|
|
223
|
-
_, file_ext = os.path.splitext(file)
|
|
224
|
-
file_ext = file_ext.lower()
|
|
225
|
-
if file_ext in ['.yaml', '.yml']:
|
|
226
|
-
with open(file_path, 'w') as file:
|
|
227
|
-
yaml.dump(dictionary, file)
|
|
228
|
-
elif '.json' == file_ext:
|
|
229
|
-
json_str = json.dumps(dictionary, indent=4)
|
|
230
|
-
with open(file_path, 'w') as file:
|
|
231
|
-
file.write(json_str)
|
|
232
|
-
else:
|
|
233
|
-
raise ValueError(
|
|
234
|
-
'Allowable write formats are .json, .yaml, and .yml')
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
from .utils import _add_other_properties
|
|
2
|
-
from .species import Species
|
|
3
|
-
from .phase import Phase
|
|
4
|
-
from typing import Optional, Any, Dict, List, Union, Tuple
|
|
5
|
-
from .. import backend
|
|
6
|
-
|
|
7
|
-
_backend = backend.get_backend()
|
|
8
|
-
_SimpolPhaseTransfer = _backend._mechanism_configuration._SimpolPhaseTransfer
|
|
9
|
-
_ReactionComponent = _backend._mechanism_configuration._ReactionComponent
|
|
10
|
-
ReactionType = _backend._mechanism_configuration._ReactionType
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class SimpolPhaseTransfer:
|
|
14
|
-
"""
|
|
15
|
-
A class representing a simplified phase transfer reaction rate constant.
|
|
16
|
-
|
|
17
|
-
Attributes:
|
|
18
|
-
name (str): The name of the simplified phase transfer reaction rate constant.
|
|
19
|
-
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
20
|
-
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
21
|
-
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
22
|
-
condensed_phase_species (Union[Species, Tuple[float, Species]]): The condensed phase species involved in the reaction.
|
|
23
|
-
B (List[float]): The B parameters [unitless].
|
|
24
|
-
other_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
def __init__(
|
|
28
|
-
self,
|
|
29
|
-
name: Optional[str] = None,
|
|
30
|
-
gas_phase: Optional[Phase] = None,
|
|
31
|
-
gas_phase_species: Optional[Union[Species,
|
|
32
|
-
Tuple[float, Species]]] = None,
|
|
33
|
-
condensed_phase: Optional[Phase] = None,
|
|
34
|
-
condensed_phase_species: Optional[Union[Species,
|
|
35
|
-
Tuple[float, Species]]] = None,
|
|
36
|
-
B: Optional[List[float]] = None,
|
|
37
|
-
other_properties: Optional[Dict[str, Any]] = None,
|
|
38
|
-
):
|
|
39
|
-
"""
|
|
40
|
-
Initializes the SimpolPhaseTransfer object with the given parameters.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
name (str): The name of the simplified phase transfer reaction rate constant.
|
|
44
|
-
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
45
|
-
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
46
|
-
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
47
|
-
condensed_phase_species (Union[Species, Tuple[float, Species]]): The condensed phase species involved in the reaction.
|
|
48
|
-
B (List[float]): The B parameters [unitless].
|
|
49
|
-
other_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
|
|
50
|
-
"""
|
|
51
|
-
# Create the internal C++ instance
|
|
52
|
-
self._instance = _SimpolPhaseTransfer()
|
|
53
|
-
|
|
54
|
-
# Set all parameters
|
|
55
|
-
if name is not None:
|
|
56
|
-
self.name = name
|
|
57
|
-
if gas_phase is not None:
|
|
58
|
-
self.gas_phase = gas_phase
|
|
59
|
-
if gas_phase_species is not None:
|
|
60
|
-
self.gas_phase_species = gas_phase_species
|
|
61
|
-
if condensed_phase is not None:
|
|
62
|
-
self.condensed_phase = condensed_phase
|
|
63
|
-
if condensed_phase_species is not None:
|
|
64
|
-
self.condensed_phase_species = condensed_phase_species
|
|
65
|
-
if B is not None:
|
|
66
|
-
self.B = B
|
|
67
|
-
if other_properties is not None:
|
|
68
|
-
self.other_properties = other_properties
|
|
69
|
-
|
|
70
|
-
# Property delegation to self._instance
|
|
71
|
-
@property
|
|
72
|
-
def name(self) -> str:
|
|
73
|
-
"""Get the name of the simplified phase transfer reaction rate constant."""
|
|
74
|
-
return self._instance.name
|
|
75
|
-
|
|
76
|
-
@name.setter
|
|
77
|
-
def name(self, value: str):
|
|
78
|
-
"""Set the name of the simplified phase transfer reaction rate constant."""
|
|
79
|
-
self._instance.name = value
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def gas_phase(self) -> str:
|
|
83
|
-
"""Get the gas phase name."""
|
|
84
|
-
return self._instance.gas_phase
|
|
85
|
-
|
|
86
|
-
@gas_phase.setter
|
|
87
|
-
def gas_phase(self, value: Union[Phase, str]):
|
|
88
|
-
"""Set the gas phase."""
|
|
89
|
-
if isinstance(value, Phase):
|
|
90
|
-
self._instance.gas_phase = value.name
|
|
91
|
-
elif isinstance(value, str):
|
|
92
|
-
self._instance.gas_phase = value
|
|
93
|
-
else:
|
|
94
|
-
raise ValueError(f"Invalid gas_phase type: {type(value)}")
|
|
95
|
-
|
|
96
|
-
@property
|
|
97
|
-
def gas_phase_species(self) -> Union[Species, Tuple[float, Species]]:
|
|
98
|
-
"""Get the gas phase species as Python object."""
|
|
99
|
-
rc = self._instance.gas_phase_species
|
|
100
|
-
if hasattr(rc, 'coefficient') and rc.coefficient != 1.0:
|
|
101
|
-
# Create a tuple with coefficient and species
|
|
102
|
-
species = Species(name=rc.species_name)
|
|
103
|
-
return (rc.coefficient, species)
|
|
104
|
-
else:
|
|
105
|
-
# Just the species
|
|
106
|
-
return Species(name=rc.species_name)
|
|
107
|
-
|
|
108
|
-
@gas_phase_species.setter
|
|
109
|
-
def gas_phase_species(self, value: Union[Species, Tuple[float, Species]]):
|
|
110
|
-
"""Set the gas phase species, converting from Python to C++ object."""
|
|
111
|
-
if isinstance(value, Species):
|
|
112
|
-
self._instance.gas_phase_species = _ReactionComponent(value.name)
|
|
113
|
-
elif isinstance(value, tuple) and len(value) == 2:
|
|
114
|
-
coefficient, species = value
|
|
115
|
-
self._instance.gas_phase_species = _ReactionComponent(species.name, coefficient)
|
|
116
|
-
else:
|
|
117
|
-
raise ValueError(f"Invalid gas_phase_species format: {value}")
|
|
118
|
-
|
|
119
|
-
@property
|
|
120
|
-
def condensed_phase(self) -> str:
|
|
121
|
-
"""Get the condensed phase name."""
|
|
122
|
-
return self._instance.condensed_phase
|
|
123
|
-
|
|
124
|
-
@condensed_phase.setter
|
|
125
|
-
def condensed_phase(self, value: Union[Phase, str]):
|
|
126
|
-
"""Set the condensed phase."""
|
|
127
|
-
if isinstance(value, Phase):
|
|
128
|
-
self._instance.condensed_phase = value.name
|
|
129
|
-
elif isinstance(value, str):
|
|
130
|
-
self._instance.condensed_phase = value
|
|
131
|
-
else:
|
|
132
|
-
raise ValueError(f"Invalid condensed_phase type: {type(value)}")
|
|
133
|
-
|
|
134
|
-
@property
|
|
135
|
-
def condensed_phase_species(self) -> Union[Species, Tuple[float, Species]]:
|
|
136
|
-
"""Get the condensed phase species as Python object."""
|
|
137
|
-
rc = self._instance.condensed_phase_species
|
|
138
|
-
if hasattr(rc, 'coefficient') and rc.coefficient != 1.0:
|
|
139
|
-
# Create a tuple with coefficient and species
|
|
140
|
-
species = Species(name=rc.species_name)
|
|
141
|
-
return (rc.coefficient, species)
|
|
142
|
-
else:
|
|
143
|
-
# Just the species
|
|
144
|
-
return Species(name=rc.species_name)
|
|
145
|
-
|
|
146
|
-
@condensed_phase_species.setter
|
|
147
|
-
def condensed_phase_species(self, value: Union[Species, Tuple[float, Species]]):
|
|
148
|
-
"""Set the condensed phase species, converting from Python to C++ object."""
|
|
149
|
-
if isinstance(value, Species):
|
|
150
|
-
self._instance.condensed_phase_species = _ReactionComponent(value.name)
|
|
151
|
-
elif isinstance(value, tuple) and len(value) == 2:
|
|
152
|
-
coefficient, species = value
|
|
153
|
-
self._instance.condensed_phase_species = _ReactionComponent(species.name, coefficient)
|
|
154
|
-
else:
|
|
155
|
-
raise ValueError(f"Invalid condensed_phase_species format: {value}")
|
|
156
|
-
|
|
157
|
-
@property
|
|
158
|
-
def B(self) -> List[float]:
|
|
159
|
-
"""Get the B parameters."""
|
|
160
|
-
return self._instance.B
|
|
161
|
-
|
|
162
|
-
@B.setter
|
|
163
|
-
def B(self, value: List[float]):
|
|
164
|
-
"""Set the B parameters with validation."""
|
|
165
|
-
if not isinstance(value, list) or len(value) != 4:
|
|
166
|
-
raise ValueError("B must be a list of 4 elements.")
|
|
167
|
-
self._instance.B = value
|
|
168
|
-
|
|
169
|
-
@property
|
|
170
|
-
def other_properties(self) -> Dict[str, Any]:
|
|
171
|
-
"""Get the other properties."""
|
|
172
|
-
return self._instance.other_properties
|
|
173
|
-
|
|
174
|
-
@other_properties.setter
|
|
175
|
-
def other_properties(self, value: Dict[str, Any]):
|
|
176
|
-
"""Set the other properties."""
|
|
177
|
-
self._instance.other_properties = value
|
|
178
|
-
|
|
179
|
-
@property
|
|
180
|
-
def type(self):
|
|
181
|
-
"""Get the reaction type."""
|
|
182
|
-
return ReactionType.SimpolPhaseTransfer
|
|
183
|
-
|
|
184
|
-
def serialize(self) -> Dict:
|
|
185
|
-
"""
|
|
186
|
-
Serialize the SimpolPhaseTransfer object to a dictionary using only Python-visible data.
|
|
187
|
-
|
|
188
|
-
Returns:
|
|
189
|
-
Dict: A dictionary representation of the SimpolPhaseTransfer object.
|
|
190
|
-
"""
|
|
191
|
-
serialize_dict = {
|
|
192
|
-
"type": "SIMPOL_PHASE_TRANSFER",
|
|
193
|
-
"name": self._instance.name,
|
|
194
|
-
"gas phase": self._instance.gas_phase,
|
|
195
|
-
"gas-phase species": self._instance.gas_phase_species.species_name,
|
|
196
|
-
"condensed phase": self._instance.condensed_phase,
|
|
197
|
-
"condensed-phase species": self._instance.condensed_phase_species.species_name,
|
|
198
|
-
"B": self._instance.B,
|
|
199
|
-
}
|
|
200
|
-
_add_other_properties(serialize_dict, self.other_properties)
|
|
201
|
-
return serialize_dict
|
|
202
|
-
|
|
203
|
-
@staticmethod
|
|
204
|
-
def serialize_static(instance) -> Dict:
|
|
205
|
-
"""
|
|
206
|
-
Static serialize method for compatibility with C++ _SimpolPhaseTransfer objects.
|
|
207
|
-
|
|
208
|
-
Args:
|
|
209
|
-
instance: The _SimpolPhaseTransfer instance to serialize.
|
|
210
|
-
|
|
211
|
-
Returns:
|
|
212
|
-
Dict: A dictionary representation of the SimpolPhaseTransfer object.
|
|
213
|
-
"""
|
|
214
|
-
# Create a local copy to call serialize
|
|
215
|
-
temp_obj = SimpolPhaseTransfer()
|
|
216
|
-
temp_obj._instance = instance
|
|
217
|
-
return temp_obj.serialize()
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Any, Dict
|
|
2
|
-
from .. import backend
|
|
3
|
-
from .phase import Phase
|
|
4
|
-
from .utils import _add_other_properties
|
|
5
|
-
|
|
6
|
-
_backend = backend.get_backend()
|
|
7
|
-
_WetDeposition = _backend._mechanism_configuration._WetDeposition
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class WetDeposition(_WetDeposition):
|
|
11
|
-
"""
|
|
12
|
-
A class representing a wet deposition reaction rate constant.
|
|
13
|
-
|
|
14
|
-
Attributes:
|
|
15
|
-
name (str): The name of the wet deposition reaction rate constant.
|
|
16
|
-
scaling_factor (float): The scaling factor for the wet deposition rate constant.
|
|
17
|
-
condensed_phase (Phase): The condensed phase which undergoes wet deposition.
|
|
18
|
-
unknown_properties (Dict[str, Any]): A dictionary of other properties of the wet deposition reaction rate constant.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
def __init__(
|
|
22
|
-
self,
|
|
23
|
-
name: Optional[str] = None,
|
|
24
|
-
scaling_factor: Optional[float] = None,
|
|
25
|
-
condensed_phase: Optional[Phase] = None,
|
|
26
|
-
other_properties: Optional[Dict[str, Any]] = None,
|
|
27
|
-
):
|
|
28
|
-
"""
|
|
29
|
-
Initializes the WetDeposition object with the given parameters.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
name (str): The name of the wet deposition reaction rate constant.
|
|
33
|
-
scaling_factor (float): The scaling factor for the wet deposition rate constant.
|
|
34
|
-
condensed_phase (Phase): The condensed phase which undergoes wet deposition.
|
|
35
|
-
other_properties (Dict[str, Any]): A dictionary of other properties of the wet deposition reaction rate constant.
|
|
36
|
-
"""
|
|
37
|
-
super().__init__()
|
|
38
|
-
self.name = name if name is not None else self.name
|
|
39
|
-
self.scaling_factor = scaling_factor if scaling_factor is not None else self.scaling_factor
|
|
40
|
-
self.condensed_phase = condensed_phase.name if condensed_phase is not None else self.condensed_phase
|
|
41
|
-
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
42
|
-
|
|
43
|
-
@staticmethod
|
|
44
|
-
def serialize(instance) -> Dict:
|
|
45
|
-
serialize_dict = {
|
|
46
|
-
"type": "WET_DEPOSITION",
|
|
47
|
-
"name": instance.name,
|
|
48
|
-
"scaling factor": instance.scaling_factor,
|
|
49
|
-
"condensed phase": instance.condensed_phase,
|
|
50
|
-
}
|
|
51
|
-
_add_other_properties(serialize_dict, instance.other_properties)
|
|
52
|
-
return serialize_dict
|
musica-0.12.2.dist-info/RECORD
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
musica/__init__.py,sha256=pSZ-H2IJ4EEYIbQDygjGwjhGySXdeifB1DzQBMJzz2g,403
|
|
2
|
-
musica/_musica.cp312-win_amd64.pyd,sha256=mAyJVsJfi9l-5rco3BKKeWJ9V38C64zrVP-5GGXX8Vs,1590272
|
|
3
|
-
musica/_version.py,sha256=4bzF9LMIExRVigCODQ4A-chBc4NdBm0Fk_FjBxMRo9Q,20
|
|
4
|
-
musica/backend.py,sha256=Fw3-HECqsifQmvRonDTGeEZqS-KXYD09BCwBue_HwfM,1081
|
|
5
|
-
musica/binding_common.cpp,sha256=qrJCfdePt-ZoIgCTrPJqSUF1Ie8Mq7b7S2_pEdpi4CE,1013
|
|
6
|
-
musica/binding_common.hpp,sha256=YAcb9WnfXL7Ps-rR-iMBSwUgBQZfZZdCQQod5CTMEZA,108
|
|
7
|
-
musica/carma.cpp,sha256=v6f2MF1PUGHR46vVZ544o6bEZjCTI2rWvtgL8M0oSns,43244
|
|
8
|
-
musica/carma.py,sha256=FNd4pWJQJ8VJoo2LSl2aXUVSfLZFgABTSKqtTE-Cgv4,68716
|
|
9
|
-
musica/CMakeLists.txt,sha256=MTZYtahh4tLpn6adVKZ9oZ9g-np7Hw8-VHiaFaA-lIM,1817
|
|
10
|
-
musica/constants.py,sha256=sQqh1UVu2HRvl25qWPW0ACT8NrHe_r4Ugy-v_BiTGG4,126
|
|
11
|
-
musica/cpu_binding.cpp,sha256=Cy06zLErMV0g7Ol9Fg-q2cpG-g5fb8hcBl-M-ihHLyk,236
|
|
12
|
-
musica/cuda.cpp,sha256=oTG2ZnL-SiW2kx9eL4XJOQGJeIiGuy8tJ5BEoLRWL4M,358
|
|
13
|
-
musica/cuda.py,sha256=ClHKnSNiU8SX0BANh5KybismYHH6mFUyC-3r8S9qARo,271
|
|
14
|
-
musica/examples/__init__.py,sha256=hR0kZhoHfL9dcup7gg64HDJyIyAQqHAsip8LpuRNnI8,32
|
|
15
|
-
musica/examples/carma_aluminum.py,sha256=Q2IRvU9jxuKAUZvhQkTawVfZV0UADiMvXP-R6uzjemo,3808
|
|
16
|
-
musica/examples/carma_sulfate.py,sha256=MbV1oBrB6rc7yWMxbnYVr_SHlTMqd6uV21kwVhlUymY,8365
|
|
17
|
-
musica/examples/examples.py,sha256=xWnFSNMYPpUhz04YtSSNsr6DoxmQoOdUtTT9GSUm3ps,5901
|
|
18
|
-
musica/examples/sulfate_box_model.py,sha256=LU1kJYtCZNV_4Mi8kJl2V7YQwQuP1dv8Ba4-2vhPFbE,17110
|
|
19
|
-
musica/examples/ts1_latin_hypercube.py,sha256=tLH9swPT4pvDnd7a86-xnt8PqXl4Y7bAXowsA0J7PV8,9868
|
|
20
|
-
musica/gpu_binding.cpp,sha256=X0qISrKYz7Ldjn5UnqNw8oLzOY4VgyF3fUUszm-QSJI,240
|
|
21
|
-
musica/main.py,sha256=gVCfeh44VL4EH7eFRR2wU_I_kANB94furojDi-0LhoE,2797
|
|
22
|
-
musica/mechanism_configuration/__init__.py,sha256=odlwrCvBBnqUBi951RysExLDYqK_AfqP4nRY90MQpcc,40
|
|
23
|
-
musica/mechanism_configuration/aqueous_equilibrium.py,sha256=60b017VeO9MrzYnkF47hzjQJRdD7k3M6L3S94SKqmAE,11270
|
|
24
|
-
musica/mechanism_configuration/arrhenius.py,sha256=eIDPb485TzsRAvz2bYIjwI7n8ofhahUpCP5HRO-o00E,11479
|
|
25
|
-
musica/mechanism_configuration/branched.py,sha256=g7IsOzaTK1hLWYn1agGzAPRhM0pIsz5fM0pOfVzDyKA,12061
|
|
26
|
-
musica/mechanism_configuration/condensed_phase_arrhenius.py,sha256=bXXu1ctDYiZ4yrzTu2b28R-sstYIXZGNruyMxM31qFQ,11745
|
|
27
|
-
musica/mechanism_configuration/condensed_phase_photolysis.py,sha256=S-J-e4-9TYw_tE1iLEqp1wDohJVx7Vkblc9kxWrXfBc,4203
|
|
28
|
-
musica/mechanism_configuration/emission.py,sha256=GOlyzDqk4-_jDZn7poYJ3Rxo-KSTaPxEO7P_SBzS_xQ,3115
|
|
29
|
-
musica/mechanism_configuration/first_order_loss.py,sha256=4dPG2YKeEHjJkc0biV8tGy3vLxY5f2PTeLFt6cRAuRM,6815
|
|
30
|
-
musica/mechanism_configuration/henrys_law.py,sha256=vuLlqRFwThUJ9icvKJkEWXKvC9cj7ldTzDpWMXBJHQ4,1607
|
|
31
|
-
musica/mechanism_configuration/mechanism_configuration.py,sha256=bLLSsdZAyn01VPbQeSJX8RpKWJoBkH7zjtUsCaCzXKw,10671
|
|
32
|
-
musica/mechanism_configuration/phase.py,sha256=j7sPiVPxpaPeHwoo3SMhBgIuAWlXmKgBLpTjBbhZV3E,1680
|
|
33
|
-
musica/mechanism_configuration/photolysis.py,sha256=7C3RDJ7_iFsfC_duyfl47VMsAS-EHhVdj4QExo5u7mU,3971
|
|
34
|
-
musica/mechanism_configuration/reactions.py,sha256=1YbmKH2tL82ZmUdOvs6vNV9r_1GwtVHtiEZwdgrYSrI,2440
|
|
35
|
-
musica/mechanism_configuration/simpol_phase_transfer.py,sha256=BneQwt4cfyBicxOXFarGqFNjJI9x0VaW1iReLy2h4DQ,9278
|
|
36
|
-
musica/mechanism_configuration/species.py,sha256=dPsBPcc_E7yzxtojw3DiBP3JvUMSjmMsqH89h74ZMuk,5544
|
|
37
|
-
musica/mechanism_configuration/surface.py,sha256=vJBW-brrcdzABeUV5DQSS4xli0KjB_K32sW0dnnxRGo,4440
|
|
38
|
-
musica/mechanism_configuration/ternary_chemical_activation.py,sha256=rbhzhmbvewf2Q6hf3_4TcuMiQaoWiOpCzTzWPKXWE5A,14675
|
|
39
|
-
musica/mechanism_configuration/troe.py,sha256=s3nTWbhRiJ2NiEhPH_Bjlyw-NP9eYy3EASN6WIeLfVQ,13959
|
|
40
|
-
musica/mechanism_configuration/tunneling.py,sha256=LpSRmTjFoniIcS2D-qPL9HKaRSZ1YmxbjHCevm6fKHA,9628
|
|
41
|
-
musica/mechanism_configuration/user_defined.py,sha256=dUuSpj4rc9XRuD8FZJ9CX4DFjvQcUCNt5Krrn0cj-_I,3980
|
|
42
|
-
musica/mechanism_configuration/utils.py,sha256=dhMFrydNchhdRrfeJw35oJB8Y5oQJa6p65Z7I127P-8,356
|
|
43
|
-
musica/mechanism_configuration/wet_deposition.py,sha256=cP8WL6T3FjGF01lyf1tNsJllaHQEOciCX8yZraBycIc,2306
|
|
44
|
-
musica/mechanism_configuration.cpp,sha256=wwH5dDG7AuXRk4-ZZGPYwcAc_EpOwoXYdfje2hOobOE,29712
|
|
45
|
-
musica/musica.cpp,sha256=CMPdG_ddcEhW5r7u-DDjqGAGM97zHd_7h6wk_o5t0Qk,8584
|
|
46
|
-
musica/test/examples/v1/full_configuration/full_configuration.json,sha256=zBC3EVwIWtBy5t3FOIrqMNOsRaNRXth0kCqBps4PxCs,9902
|
|
47
|
-
musica/test/examples/v1/full_configuration/full_configuration.yaml,sha256=XY6TW78rus0DyrI70NR3yvTeUIPff8_I9ErOXy2m3KE,5911
|
|
48
|
-
musica/test/integration/test_analytical.py,sha256=eOPb3DtjQEodTZCpjelw1LQZM_VyhFi2TOlx1bmEtkk,14129
|
|
49
|
-
musica/test/integration/test_carma.py,sha256=itPJNxSRp7FHJokYSicZFgqzBBrZ9dr1TDxawDPT9BM,7092
|
|
50
|
-
musica/test/integration/test_carma_aluminum.py,sha256=F7_8xwZnKjSxgnZKdZR1tDwzwfVUiD7ZT1b_9cseE3M,368
|
|
51
|
-
musica/test/integration/test_carma_sulfate.py,sha256=OWQDLQNao5vU2FAMpWDVqs8xrFhpxvRfhx8HrP6GTCs,759
|
|
52
|
-
musica/test/integration/test_chapman.py,sha256=t6p0CadUy-B4OP7A-EZ9Wz52diuYs5yc9LKiFUS9T6A,3651
|
|
53
|
-
musica/test/integration/test_sulfate_box_model.py,sha256=umqG0PAaCu27J3s5W_cnWJt9T_9EFox9z_JMHKNz5GI,1638
|
|
54
|
-
musica/test/integration/test_tuvx.py,sha256=6MU5RrbNpX_I5VHTDUTreCGdL9c9y3voy68QurVazNI,1980
|
|
55
|
-
musica/test/unit/test_parser.py,sha256=PF7GPddM4-Mbz0qjzqRvl_YSISj-VQR49MGXLfe8dDg,2667
|
|
56
|
-
musica/test/unit/test_serializer.py,sha256=y6u_e2uJm9TGpn7B3x8_LobVGxIFyuKzF-WrIfP1Ewo,2527
|
|
57
|
-
musica/test/unit/test_state.py,sha256=he0cEVOS7fnWRP7cOzift5abSAwEWUC-eQ6V5deTgdM,10694
|
|
58
|
-
musica/test/unit/test_util_full_mechanism.py,sha256=O7nJjpIt1k-pxUNj4zBiLdSXruyhj8qfbp8Me75kPJg,25915
|
|
59
|
-
musica/tools/prepare_build_environment_linux.sh,sha256=i69LuyY25KE-jFIFNuYC4_33_DGTngentBvt2Tbed9g,1017
|
|
60
|
-
musica/tools/prepare_build_environment_macos.sh,sha256=Yhhd-8W6YvR79NabEqixexU6BsClNf7DH_EYYlsmeMo,41
|
|
61
|
-
musica/tools/repair_wheel_gpu.sh,sha256=nQueyGNC2qWcBAicjVdAfB6JH4m_51dFOG83vVxke54,1525
|
|
62
|
-
musica/tuvx.cpp,sha256=vvRi7T8TLZ-U8H7R-jrWIEmHBexXlms-0abhPGibnC8,3108
|
|
63
|
-
musica/tuvx.py,sha256=6EDOULrBc2cojLgK-lNKH68YVHQyOFpBC-jkGYuaraY,6587
|
|
64
|
-
musica/types.py,sha256=zTqzaflhrwQqVMtwN_5eNxkvMis_QWAo3XwcNSpWEqs,17544
|
|
65
|
-
musica-0.12.2.dist-info/METADATA,sha256=FlXiev8ZTGt1gS9XbB3IKm4X5_jaDHB8dmMnUD29alg,26345
|
|
66
|
-
musica-0.12.2.dist-info/WHEEL,sha256=chqeLhPBtPdrOoreR34YMcofSk3yWDQhkrsDJ2n48LU,106
|
|
67
|
-
musica-0.12.2.dist-info/entry_points.txt,sha256=t9qRU9Ya63_yYMKJkTiVS5kCaW6dDDr0wuQ26lgXTH8,49
|
|
68
|
-
musica-0.12.2.dist-info/licenses/AUTHORS.md,sha256=1ssAXR4WOMdfl5Or1raPu_2nxHbkwCpxfwJwzpF_cJM,2691
|
|
69
|
-
musica-0.12.2.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
70
|
-
musica-0.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|