musica 0.12.0__cp312-cp312-win_amd64.whl → 0.12.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.
Potentially problematic release.
This version of musica might be problematic. Click here for more details.
- musica/CMakeLists.txt +28 -2
- musica/__init__.py +9 -49
- musica/_musica.cp312-win_amd64.pyd +0 -0
- musica/_version.py +1 -1
- musica/backend.py +41 -0
- musica/binding_common.cpp +23 -6
- musica/carma.cpp +911 -0
- musica/carma.py +1729 -0
- musica/constants.py +1 -1
- musica/cpu_binding.cpp +2 -1
- musica/cuda.py +4 -1
- musica/examples/__init__.py +1 -0
- musica/examples/carma_aluminum.py +124 -0
- musica/examples/carma_sulfate.py +246 -0
- musica/examples/examples.py +165 -0
- musica/examples/sulfate_box_model.py +439 -0
- musica/examples/ts1_latin_hypercube.py +245 -0
- musica/gpu_binding.cpp +2 -1
- musica/main.py +89 -0
- musica/mechanism_configuration/__init__.py +1 -1
- musica/mechanism_configuration/aqueous_equilibrium.py +227 -54
- musica/mechanism_configuration/arrhenius.py +228 -42
- musica/mechanism_configuration/branched.py +249 -66
- musica/mechanism_configuration/condensed_phase_arrhenius.py +243 -50
- musica/mechanism_configuration/condensed_phase_photolysis.py +16 -19
- musica/mechanism_configuration/emission.py +10 -6
- musica/mechanism_configuration/first_order_loss.py +133 -26
- musica/mechanism_configuration/henrys_law.py +7 -48
- musica/mechanism_configuration/mechanism_configuration.py +114 -41
- musica/mechanism_configuration/phase.py +6 -2
- musica/mechanism_configuration/photolysis.py +12 -7
- musica/mechanism_configuration/reactions.py +20 -8
- musica/mechanism_configuration/simpol_phase_transfer.py +180 -51
- musica/mechanism_configuration/species.py +23 -4
- musica/mechanism_configuration/surface.py +14 -9
- musica/mechanism_configuration/ternary_chemical_activation.py +352 -0
- musica/mechanism_configuration/troe.py +259 -44
- musica/mechanism_configuration/tunneling.py +196 -49
- musica/mechanism_configuration/user_defined.py +9 -4
- musica/mechanism_configuration/wet_deposition.py +11 -8
- musica/mechanism_configuration.cpp +184 -95
- musica/musica.cpp +48 -61
- musica/test/examples/v1/full_configuration/full_configuration.json +39 -22
- musica/test/examples/v1/full_configuration/full_configuration.yaml +29 -20
- musica/test/{test_analytical.py → integration/test_analytical.py} +0 -1
- musica/test/integration/test_carma.py +227 -0
- musica/test/integration/test_carma_aluminum.py +12 -0
- musica/test/integration/test_carma_sulfate.py +17 -0
- musica/test/integration/test_sulfate_box_model.py +34 -0
- musica/test/integration/test_tuvx.py +62 -0
- musica/test/unit/test_parser.py +64 -0
- musica/test/{test_serializer.py → unit/test_serializer.py} +2 -2
- musica/test/unit/test_state.py +325 -0
- musica/test/{test_util_full_mechanism.py → unit/test_util_full_mechanism.py} +152 -122
- musica/tools/prepare_build_environment_linux.sh +23 -34
- musica/tools/prepare_build_environment_macos.sh +1 -0
- musica/tuvx.cpp +93 -0
- musica/tuvx.py +199 -0
- musica/types.py +120 -73
- {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/METADATA +41 -39
- musica-0.12.2.dist-info/RECORD +70 -0
- {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/WHEEL +1 -1
- musica-0.12.2.dist-info/entry_points.txt +3 -0
- musica/test/examples/v0/config.json +0 -7
- musica/test/examples/v0/config.yaml +0 -3
- musica/test/examples/v0/reactions.json +0 -193
- musica/test/examples/v0/reactions.yaml +0 -142
- musica/test/examples/v0/species.json +0 -40
- musica/test/examples/v0/species.yaml +0 -19
- musica/test/test_parser.py +0 -57
- musica/test/tuvx.py +0 -10
- musica/tools/prepare_build_environment_windows.sh +0 -22
- musica-0.12.0.dist-info/RECORD +0 -57
- /musica/test/{test_chapman.py → integration/test_chapman.py} +0 -0
- {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/licenses/AUTHORS.md +0 -0
- {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
from
|
|
2
|
-
from musica import _SimpolPhaseTransfer, _ReactionComponent
|
|
3
|
-
from .phase import Phase
|
|
1
|
+
from .utils import _add_other_properties
|
|
4
2
|
from .species import Species
|
|
5
|
-
from .
|
|
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
|
|
6
11
|
|
|
7
12
|
|
|
8
|
-
class SimpolPhaseTransfer
|
|
13
|
+
class SimpolPhaseTransfer:
|
|
9
14
|
"""
|
|
10
15
|
A class representing a simplified phase transfer reaction rate constant.
|
|
11
16
|
|
|
@@ -13,19 +18,21 @@ class SimpolPhaseTransfer(_SimpolPhaseTransfer):
|
|
|
13
18
|
name (str): The name of the simplified phase transfer reaction rate constant.
|
|
14
19
|
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
15
20
|
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
16
|
-
|
|
17
|
-
|
|
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.
|
|
18
23
|
B (List[float]): The B parameters [unitless].
|
|
19
|
-
|
|
24
|
+
other_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
|
|
20
25
|
"""
|
|
21
26
|
|
|
22
27
|
def __init__(
|
|
23
28
|
self,
|
|
24
29
|
name: Optional[str] = None,
|
|
25
30
|
gas_phase: Optional[Phase] = None,
|
|
26
|
-
gas_phase_species: Optional[Union[Species,
|
|
27
|
-
|
|
28
|
-
|
|
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,
|
|
29
36
|
B: Optional[List[float]] = None,
|
|
30
37
|
other_properties: Optional[Dict[str, Any]] = None,
|
|
31
38
|
):
|
|
@@ -36,53 +43,175 @@ class SimpolPhaseTransfer(_SimpolPhaseTransfer):
|
|
|
36
43
|
name (str): The name of the simplified phase transfer reaction rate constant.
|
|
37
44
|
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
38
45
|
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
39
|
-
|
|
40
|
-
|
|
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.
|
|
41
48
|
B (List[float]): The B parameters [unitless].
|
|
42
49
|
other_properties (Dict[str, Any]): A dictionary of other properties of the simplified phase transfer reaction rate constant.
|
|
43
50
|
"""
|
|
44
|
-
|
|
45
|
-
self.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(
|
|
59
|
-
_ReactionComponent(aerosol_phase_species.name)
|
|
60
|
-
if isinstance(aerosol_phase_species, Species)
|
|
61
|
-
else _ReactionComponent(
|
|
62
|
-
aerosol_phase_species[1].name, aerosol_phase_species[0]
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
if aerosol_phase_species is not None
|
|
66
|
-
else self.aerosol_phase_species
|
|
67
|
-
)
|
|
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
|
|
68
65
|
if B is not None:
|
|
69
|
-
if len(B) != 4:
|
|
70
|
-
raise ValueError("B must be a list of 4 elements.")
|
|
71
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
|
|
72
93
|
else:
|
|
73
|
-
|
|
74
|
-
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
94
|
+
raise ValueError(f"Invalid gas_phase type: {type(value)}")
|
|
75
95
|
|
|
76
|
-
@
|
|
77
|
-
def
|
|
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
|
+
"""
|
|
78
191
|
serialize_dict = {
|
|
79
192
|
"type": "SIMPOL_PHASE_TRANSFER",
|
|
80
|
-
"name":
|
|
81
|
-
"gas phase":
|
|
82
|
-
"gas-phase species":
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"B":
|
|
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,
|
|
86
199
|
}
|
|
87
|
-
_add_other_properties(serialize_dict,
|
|
88
|
-
return
|
|
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,6 +1,10 @@
|
|
|
1
1
|
from typing import Optional, Any, Dict
|
|
2
|
-
from
|
|
2
|
+
from .. import backend
|
|
3
3
|
from .utils import _add_other_properties, _remove_empty_keys
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
_backend = backend.get_backend()
|
|
7
|
+
_Species = _backend._mechanism_configuration._Species
|
|
4
8
|
|
|
5
9
|
|
|
6
10
|
class Species(_Species):
|
|
@@ -15,7 +19,10 @@ class Species(_Species):
|
|
|
15
19
|
N_star (float): A parameter used to calculate the mass accomodation factor (Ervens et al., 2003)
|
|
16
20
|
molecular_weight_kg_mol (float): Molecular weight [kg mol-1]
|
|
17
21
|
density_kg_m3 (float): Density [kg m-3]
|
|
18
|
-
tracer_type (str):
|
|
22
|
+
tracer_type (str): Type of tracer: 'THIRD_BODY' or None [Deprecated, use is_third_body instead]
|
|
23
|
+
constant_concentration_mol_m3 (float): Constant concentration of the species (mol m-3)
|
|
24
|
+
constant_mixing_ratio_mol_mol (float): Constant mixing ratio of the species (mol mol-1)
|
|
25
|
+
is_third_body (bool): Whether the species is a third body.
|
|
19
26
|
other_properties (Dict[str, Any]): A dictionary of other properties of the species.
|
|
20
27
|
"""
|
|
21
28
|
|
|
@@ -28,7 +35,10 @@ class Species(_Species):
|
|
|
28
35
|
N_star: Optional[float] = None,
|
|
29
36
|
molecular_weight_kg_mol: Optional[float] = None,
|
|
30
37
|
density_kg_m3: Optional[float] = None,
|
|
31
|
-
tracer_type: Optional[str] = None,
|
|
38
|
+
tracer_type: Optional[str] = None, # Deprecated use is_third_body instead
|
|
39
|
+
constant_concentration_mol_m3: Optional[float] = None,
|
|
40
|
+
constant_mixing_ratio_mol_mol: Optional[float] = None,
|
|
41
|
+
is_third_body: Optional[bool] = False,
|
|
32
42
|
other_properties: Optional[Dict[str, Any]] = None,
|
|
33
43
|
):
|
|
34
44
|
"""
|
|
@@ -42,7 +52,10 @@ class Species(_Species):
|
|
|
42
52
|
N_star (float): A parameter used to calculate the mass accomodation factor (Ervens et al., 2003)
|
|
43
53
|
molecular_weight_kg_mol (float): Molecular weight [kg mol-1]
|
|
44
54
|
density_kg_m3 (float): Density [kg m-3]
|
|
45
|
-
tracer_type (str):
|
|
55
|
+
tracer_type (str): Type of tracer: 'THIRD_BODY' or None [Deprecated, use is_third_body instead]
|
|
56
|
+
constant_concentration_mol_m3 (float): Constant concentration of the species (mol m-3)
|
|
57
|
+
constant_mixing_ratio_mol_mol (float): Constant mixing ratio of the species (mol mol-1)
|
|
58
|
+
is_third_body (bool): Whether the species is a third body.
|
|
46
59
|
other_properties (Dict[str, Any]): A dictionary of other properties of the species.
|
|
47
60
|
"""
|
|
48
61
|
super().__init__()
|
|
@@ -54,6 +67,9 @@ class Species(_Species):
|
|
|
54
67
|
self.molecular_weight_kg_mol = molecular_weight_kg_mol if molecular_weight_kg_mol is not None else self.molecular_weight_kg_mol
|
|
55
68
|
self.density_kg_m3 = density_kg_m3 if density_kg_m3 is not None else self.density_kg_m3
|
|
56
69
|
self.tracer_type = tracer_type if tracer_type is not None else self.tracer_type
|
|
70
|
+
self.constant_concentration_mol_m3 = constant_concentration_mol_m3 if constant_concentration_mol_m3 is not None else self.constant_concentration_mol_m3
|
|
71
|
+
self.constant_mixing_ratio_mol_mol = constant_mixing_ratio_mol_mol if constant_mixing_ratio_mol_mol is not None else self.constant_mixing_ratio_mol_mol
|
|
72
|
+
self.is_third_body = is_third_body if is_third_body is not None else self.is_third_body
|
|
57
73
|
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
58
74
|
|
|
59
75
|
@staticmethod
|
|
@@ -67,6 +83,9 @@ class Species(_Species):
|
|
|
67
83
|
"molecular weight [kg mol-1]": instance.molecular_weight_kg_mol,
|
|
68
84
|
"density [kg m-3]": instance.density_kg_m3,
|
|
69
85
|
"tracer type": instance.tracer_type,
|
|
86
|
+
"constant concentration [mol m-3]": instance.constant_concentration_mol_m3,
|
|
87
|
+
"constant mixing ratio [mol mol-1]": instance.constant_mixing_ratio_mol_mol,
|
|
88
|
+
"is third body": instance.is_third_body,
|
|
70
89
|
}
|
|
71
90
|
_add_other_properties(serialize_dict, instance.other_properties)
|
|
72
91
|
return _remove_empty_keys(serialize_dict)
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
from typing import Optional, Any, Dict, List, Union, Tuple
|
|
2
|
-
from
|
|
2
|
+
from .. import backend
|
|
3
3
|
from .phase import Phase
|
|
4
4
|
from .species import Species
|
|
5
5
|
from .reactions import ReactionComponentSerializer
|
|
6
|
-
from .utils import _add_other_properties
|
|
6
|
+
from .utils import _add_other_properties
|
|
7
|
+
|
|
8
|
+
_backend = backend.get_backend()
|
|
9
|
+
_Surface = _backend._mechanism_configuration._Surface
|
|
10
|
+
_ReactionComponent = _backend._mechanism_configuration._ReactionComponent
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
class Surface(_Surface):
|
|
@@ -18,7 +22,7 @@ class Surface(_Surface):
|
|
|
18
22
|
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
19
23
|
gas_phase_products (List[Union[Species, Tuple[float, Species]]]): The gas phase products formed in the reaction.
|
|
20
24
|
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
21
|
-
|
|
25
|
+
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
22
26
|
other_properties (Dict[str, Any]): A dictionary of other properties of the surface.
|
|
23
27
|
"""
|
|
24
28
|
|
|
@@ -26,12 +30,13 @@ class Surface(_Surface):
|
|
|
26
30
|
self,
|
|
27
31
|
name: Optional[str] = None,
|
|
28
32
|
reaction_probability: Optional[float] = None,
|
|
29
|
-
gas_phase_species: Optional[Union[Species,
|
|
33
|
+
gas_phase_species: Optional[Union[Species,
|
|
34
|
+
Tuple[float, Species]]] = None,
|
|
30
35
|
gas_phase_products: Optional[
|
|
31
36
|
List[Union[Species, Tuple[float, Species]]]
|
|
32
37
|
] = None,
|
|
33
38
|
gas_phase: Optional[Phase] = None,
|
|
34
|
-
|
|
39
|
+
condensed_phase: Optional[Phase] = None,
|
|
35
40
|
other_properties: Optional[Dict[str, Any]] = None,
|
|
36
41
|
):
|
|
37
42
|
"""
|
|
@@ -43,7 +48,7 @@ class Surface(_Surface):
|
|
|
43
48
|
gas_phase_species (Union[Species, Tuple[float, Species]]): The gas phase species involved in the reaction.
|
|
44
49
|
gas_phase_products (List[Union[Species, Tuple[float, Species]]]): The gas phase products formed in the reaction.
|
|
45
50
|
gas_phase (Phase): The gas phase in which the reaction occurs.
|
|
46
|
-
|
|
51
|
+
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
47
52
|
other_properties (Dict[str, Any]): A dictionary of other properties of the surface.
|
|
48
53
|
"""
|
|
49
54
|
super().__init__()
|
|
@@ -71,7 +76,7 @@ class Surface(_Surface):
|
|
|
71
76
|
else self.gas_phase_products
|
|
72
77
|
)
|
|
73
78
|
self.gas_phase = gas_phase.name if gas_phase is not None else self.gas_phase
|
|
74
|
-
self.
|
|
79
|
+
self.condensed_phase = condensed_phase.name if condensed_phase is not None else self.condensed_phase
|
|
75
80
|
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
76
81
|
|
|
77
82
|
@staticmethod
|
|
@@ -83,7 +88,7 @@ class Surface(_Surface):
|
|
|
83
88
|
"gas-phase species": instance.gas_phase_species.species_name,
|
|
84
89
|
"gas-phase products": ReactionComponentSerializer.serialize_list_reaction_components(instance.gas_phase_products),
|
|
85
90
|
"gas phase": instance.gas_phase,
|
|
86
|
-
"
|
|
91
|
+
"condensed phase": instance.condensed_phase,
|
|
87
92
|
}
|
|
88
93
|
_add_other_properties(serialize_dict, instance.other_properties)
|
|
89
|
-
return
|
|
94
|
+
return serialize_dict
|