musica 0.12.0__cp39-cp39-win32.whl → 0.12.2__cp39-cp39-win32.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.cp39-win32.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
musica/main.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import datetime
|
|
3
|
+
import logging
|
|
4
|
+
import shutil
|
|
5
|
+
import os
|
|
6
|
+
from musica import Examples
|
|
7
|
+
from musica import __version__
|
|
8
|
+
import musica.examples
|
|
9
|
+
import importlib.resources as ir
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def format_examples_help(examples):
|
|
13
|
+
return '\n'.join(f"{e.short_name}: {e.description}" for e in examples)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def parse_arguments():
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description='musica CLI',
|
|
19
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
20
|
+
)
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
'-e', '--example',
|
|
23
|
+
type=str,
|
|
24
|
+
choices=[e.short_name for e in Examples],
|
|
25
|
+
help=f'Name of the example to copy out.\nAvailable examples:\n{format_examples_help(Examples)}'
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
'-o', '--output',
|
|
29
|
+
type=str,
|
|
30
|
+
action="append",
|
|
31
|
+
help=("Path to save the example script to.")
|
|
32
|
+
)
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
'-v', '--verbose',
|
|
35
|
+
action='count',
|
|
36
|
+
default=0,
|
|
37
|
+
help='Increase logging verbosity. Use -v for info, -vv for debug.'
|
|
38
|
+
)
|
|
39
|
+
parser.add_argument(
|
|
40
|
+
'--version',
|
|
41
|
+
action='version',
|
|
42
|
+
version=f'musica {__version__}',
|
|
43
|
+
)
|
|
44
|
+
return parser.parse_args()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def setup_logging(verbosity):
|
|
48
|
+
log_level = logging.DEBUG if verbosity >= 2 else logging.INFO if verbosity == 1 else logging.CRITICAL
|
|
49
|
+
datefmt = '%Y-%m-%d %H:%M:%S'
|
|
50
|
+
format_string = '%(asctime)s - %(levelname)s - %(module)s.%(funcName)s - %(message)s'
|
|
51
|
+
formatter = logging.Formatter(format_string, datefmt=datefmt)
|
|
52
|
+
console_handler = logging.StreamHandler()
|
|
53
|
+
console_handler.setFormatter(formatter)
|
|
54
|
+
console_handler.setLevel(log_level)
|
|
55
|
+
logging.basicConfig(level=log_level, handlers=[console_handler])
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def main():
|
|
59
|
+
start = datetime.datetime.now()
|
|
60
|
+
|
|
61
|
+
args = parse_arguments()
|
|
62
|
+
setup_logging(args.verbose)
|
|
63
|
+
|
|
64
|
+
logger = logging.getLogger(__name__)
|
|
65
|
+
|
|
66
|
+
logger.debug(f"{__file__}")
|
|
67
|
+
logger.info(f"Start time: {start}")
|
|
68
|
+
|
|
69
|
+
logger.debug(f"Working directory = {os.getcwd()}")
|
|
70
|
+
|
|
71
|
+
example = next(e for e in Examples if e.short_name == args.example)
|
|
72
|
+
if example is None:
|
|
73
|
+
raise ValueError(f"Example not found: {args.example}")
|
|
74
|
+
if not args.output:
|
|
75
|
+
logger.debug("No output path specified, using current directory.")
|
|
76
|
+
|
|
77
|
+
logger.info(f"Copying example: {example} to {args.output}")
|
|
78
|
+
|
|
79
|
+
with ir.path(musica.examples, example.path) as example_path:
|
|
80
|
+
logger.info(f"Copying example from {example_path} to {args.output}")
|
|
81
|
+
shutil.copy(example_path, args.output[0] if args.output and len(args.output) > 0 else '.')
|
|
82
|
+
|
|
83
|
+
end = datetime.datetime.now()
|
|
84
|
+
logger.info(f"End time: {end}")
|
|
85
|
+
logger.info(f"Elapsed time: {end - start} seconds")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
main()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
from .mechanism_configuration import *
|
|
1
|
+
from .mechanism_configuration import *
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
from
|
|
2
|
-
from musica import _AqueousEquilibrium, _ReactionComponent
|
|
3
|
-
from .phase import Phase
|
|
4
|
-
from .species import Species
|
|
1
|
+
from .utils import _add_other_properties
|
|
5
2
|
from .reactions import ReactionComponentSerializer
|
|
6
|
-
from .
|
|
3
|
+
from .species import Species
|
|
4
|
+
from .phase import Phase
|
|
5
|
+
from typing import Optional, Any, Dict, List, Union, Tuple
|
|
6
|
+
from .. import backend
|
|
7
7
|
|
|
8
|
+
_backend = backend.get_backend()
|
|
9
|
+
_AqueousEquilibrium = _backend._mechanism_configuration._AqueousEquilibrium
|
|
10
|
+
_ReactionComponent = _backend._mechanism_configuration._ReactionComponent
|
|
11
|
+
ReactionType = _backend._mechanism_configuration._ReactionType
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
class AqueousEquilibrium:
|
|
10
15
|
"""
|
|
11
16
|
A class representing an aqueous equilibrium reaction rate constant.
|
|
12
17
|
|
|
13
18
|
Attributes:
|
|
14
19
|
name (str): The name of the aqueous equilibrium reaction rate constant.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
aerosol_phase_water (Species): The water species in the aerosol phase.
|
|
20
|
+
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
21
|
+
condensed_phase_water (Species): The water species in the condensed phase.
|
|
18
22
|
reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
|
|
19
23
|
products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
|
|
20
24
|
A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
|
|
@@ -26,9 +30,10 @@ class AqueousEquilibrium(_AqueousEquilibrium):
|
|
|
26
30
|
def __init__(
|
|
27
31
|
self,
|
|
28
32
|
name: Optional[str] = None,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
reactants: Optional[List[Union[Species,
|
|
33
|
+
condensed_phase: Optional[Phase] = None,
|
|
34
|
+
condensed_phase_water: Optional[Species] = None,
|
|
35
|
+
reactants: Optional[List[Union[Species,
|
|
36
|
+
Tuple[float, Species]]]] = None,
|
|
32
37
|
products: Optional[List[Union[Species, Tuple[float, Species]]]] = None,
|
|
33
38
|
A: Optional[float] = None,
|
|
34
39
|
C: Optional[float] = None,
|
|
@@ -40,8 +45,8 @@ class AqueousEquilibrium(_AqueousEquilibrium):
|
|
|
40
45
|
|
|
41
46
|
Args:
|
|
42
47
|
name (str): The name of the aqueous equilibrium reaction rate constant.
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
condensed_phase (Phase): The condensed phase in which the reaction occurs.
|
|
49
|
+
condensed_phase_water (Species): The water species in the condensed phase.
|
|
45
50
|
reactants (List[Union[Species, Tuple[float, Species]]]): A list of reactants involved in the reaction.
|
|
46
51
|
products (List[Union[Species, Tuple[float, Species]]]): A list of products formed in the reaction.
|
|
47
52
|
A (float): Pre-exponential factor [(mol m-3)^(n-1)s-1].
|
|
@@ -49,53 +54,221 @@ class AqueousEquilibrium(_AqueousEquilibrium):
|
|
|
49
54
|
k_reverse (float): Reverse rate constant [(mol m-3)^(n-1)s-1].
|
|
50
55
|
other_properties (Dict[str, Any]): A dictionary of other properties of the aqueous equilibrium reaction rate constant.
|
|
51
56
|
"""
|
|
52
|
-
|
|
53
|
-
self.
|
|
54
|
-
self.aerosol_phase = aerosol_phase.name if aerosol_phase is not None else self.aerosol_phase
|
|
55
|
-
self.aerosol_phase_water = (
|
|
56
|
-
aerosol_phase_water.name if aerosol_phase_water is not None else self.aerosol_phase_water
|
|
57
|
-
)
|
|
58
|
-
self.reactants = (
|
|
59
|
-
[
|
|
60
|
-
(
|
|
61
|
-
_ReactionComponent(r.name)
|
|
62
|
-
if isinstance(r, Species)
|
|
63
|
-
else _ReactionComponent(r[1].name, r[0])
|
|
64
|
-
)
|
|
65
|
-
for r in reactants
|
|
66
|
-
]
|
|
67
|
-
if reactants is not None
|
|
68
|
-
else self.reactants
|
|
69
|
-
)
|
|
70
|
-
self.products = (
|
|
71
|
-
[
|
|
72
|
-
(
|
|
73
|
-
_ReactionComponent(p.name)
|
|
74
|
-
if isinstance(p, Species)
|
|
75
|
-
else _ReactionComponent(p[1].name, p[0])
|
|
76
|
-
)
|
|
77
|
-
for p in products
|
|
78
|
-
]
|
|
79
|
-
if products is not None
|
|
80
|
-
else self.products
|
|
81
|
-
)
|
|
82
|
-
self.A = A if A is not None else self.A
|
|
83
|
-
self.C = C if C is not None else self.C
|
|
84
|
-
self.k_reverse = k_reverse if k_reverse is not None else self.k_reverse
|
|
85
|
-
self.other_properties = other_properties if other_properties is not None else self.other_properties
|
|
57
|
+
# Create the internal C++ instance
|
|
58
|
+
self._instance = _AqueousEquilibrium()
|
|
86
59
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
# Set all parameters
|
|
61
|
+
if name is not None:
|
|
62
|
+
self.name = name
|
|
63
|
+
if condensed_phase is not None:
|
|
64
|
+
self.condensed_phase = condensed_phase
|
|
65
|
+
if condensed_phase_water is not None:
|
|
66
|
+
self.condensed_phase_water = condensed_phase_water
|
|
67
|
+
if reactants is not None:
|
|
68
|
+
self.reactants = reactants
|
|
69
|
+
if products is not None:
|
|
70
|
+
self.products = products
|
|
71
|
+
if A is not None:
|
|
72
|
+
self.A = A
|
|
73
|
+
if C is not None:
|
|
74
|
+
self.C = C
|
|
75
|
+
if k_reverse is not None:
|
|
76
|
+
self.k_reverse = k_reverse
|
|
77
|
+
if other_properties is not None:
|
|
78
|
+
self.other_properties = other_properties
|
|
79
|
+
|
|
80
|
+
# Property delegation to self._instance
|
|
81
|
+
@property
|
|
82
|
+
def name(self) -> str:
|
|
83
|
+
"""Get the name of the aqueous equilibrium reaction rate constant."""
|
|
84
|
+
return self._instance.name
|
|
85
|
+
|
|
86
|
+
@name.setter
|
|
87
|
+
def name(self, value: str):
|
|
88
|
+
"""Set the name of the aqueous equilibrium reaction rate constant."""
|
|
89
|
+
self._instance.name = value
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def condensed_phase(self) -> str:
|
|
93
|
+
"""Get the condensed phase name."""
|
|
94
|
+
return self._instance.condensed_phase
|
|
95
|
+
|
|
96
|
+
@condensed_phase.setter
|
|
97
|
+
def condensed_phase(self, value: Union[Phase, str]):
|
|
98
|
+
"""Set the condensed phase."""
|
|
99
|
+
if isinstance(value, Phase):
|
|
100
|
+
self._instance.condensed_phase = value.name
|
|
101
|
+
elif isinstance(value, str):
|
|
102
|
+
self._instance.condensed_phase = value
|
|
103
|
+
else:
|
|
104
|
+
raise ValueError(f"Invalid condensed_phase type: {type(value)}")
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def condensed_phase_water(self) -> str:
|
|
108
|
+
"""Get the condensed phase water species name."""
|
|
109
|
+
return self._instance.condensed_phase_water
|
|
110
|
+
|
|
111
|
+
@condensed_phase_water.setter
|
|
112
|
+
def condensed_phase_water(self, value: Union[Species, str]):
|
|
113
|
+
"""Set the condensed phase water species."""
|
|
114
|
+
if isinstance(value, Species):
|
|
115
|
+
self._instance.condensed_phase_water = value.name
|
|
116
|
+
elif isinstance(value, str):
|
|
117
|
+
self._instance.condensed_phase_water = value
|
|
118
|
+
else:
|
|
119
|
+
raise ValueError(f"Invalid condensed_phase_water type: {type(value)}")
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def reactants(self) -> List[Union[Species, Tuple[float, Species]]]:
|
|
123
|
+
"""Get the reactants as Python objects."""
|
|
124
|
+
# Convert from C++ _ReactionComponent objects to Python Species objects
|
|
125
|
+
result = []
|
|
126
|
+
for rc in self._instance.reactants:
|
|
127
|
+
if hasattr(rc, 'coefficient') and rc.coefficient != 1.0:
|
|
128
|
+
# Create a tuple with coefficient and species
|
|
129
|
+
species = Species(name=rc.species_name)
|
|
130
|
+
result.append((rc.coefficient, species))
|
|
131
|
+
else:
|
|
132
|
+
# Just the species
|
|
133
|
+
species = Species(name=rc.species_name)
|
|
134
|
+
result.append(species)
|
|
135
|
+
return result
|
|
136
|
+
|
|
137
|
+
@reactants.setter
|
|
138
|
+
def reactants(self, value: List[Union[Species, Tuple[float, Species]]]):
|
|
139
|
+
"""Set the reactants, converting from Python to C++ objects."""
|
|
140
|
+
cpp_reactants = []
|
|
141
|
+
for r in value:
|
|
142
|
+
if isinstance(r, Species):
|
|
143
|
+
cpp_reactants.append(_ReactionComponent(r.name))
|
|
144
|
+
elif isinstance(r, tuple) and len(r) == 2:
|
|
145
|
+
coefficient, species = r
|
|
146
|
+
cpp_reactants.append(_ReactionComponent(species.name, coefficient))
|
|
147
|
+
else:
|
|
148
|
+
raise ValueError(f"Invalid reactant format: {r}")
|
|
149
|
+
self._instance.reactants = cpp_reactants
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def products(self) -> List[Union[Species, Tuple[float, Species]]]:
|
|
153
|
+
"""Get the products as Python objects."""
|
|
154
|
+
# Convert from C++ _ReactionComponent objects to Python Species objects
|
|
155
|
+
result = []
|
|
156
|
+
for rc in self._instance.products:
|
|
157
|
+
if hasattr(rc, 'coefficient') and rc.coefficient != 1.0:
|
|
158
|
+
# Create a tuple with coefficient and species
|
|
159
|
+
species = Species(name=rc.species_name)
|
|
160
|
+
result.append((rc.coefficient, species))
|
|
161
|
+
else:
|
|
162
|
+
# Just the species
|
|
163
|
+
species = Species(name=rc.species_name)
|
|
164
|
+
result.append(species)
|
|
165
|
+
return result
|
|
166
|
+
|
|
167
|
+
@products.setter
|
|
168
|
+
def products(self, value: List[Union[Species, Tuple[float, Species]]]):
|
|
169
|
+
"""Set the products, converting from Python to C++ objects."""
|
|
170
|
+
cpp_products = []
|
|
171
|
+
for p in value:
|
|
172
|
+
if isinstance(p, Species):
|
|
173
|
+
cpp_products.append(_ReactionComponent(p.name))
|
|
174
|
+
elif isinstance(p, tuple) and len(p) == 2:
|
|
175
|
+
coefficient, species = p
|
|
176
|
+
cpp_products.append(_ReactionComponent(species.name, coefficient))
|
|
177
|
+
else:
|
|
178
|
+
raise ValueError(f"Invalid product format: {p}")
|
|
179
|
+
self._instance.products = cpp_products
|
|
180
|
+
|
|
181
|
+
@property
|
|
182
|
+
def A(self) -> float:
|
|
183
|
+
"""Get the pre-exponential factor."""
|
|
184
|
+
return self._instance.A
|
|
185
|
+
|
|
186
|
+
@A.setter
|
|
187
|
+
def A(self, value: float):
|
|
188
|
+
"""Set the pre-exponential factor."""
|
|
189
|
+
self._instance.A = value
|
|
190
|
+
|
|
191
|
+
@property
|
|
192
|
+
def C(self) -> float:
|
|
193
|
+
"""Get the exponential term."""
|
|
194
|
+
return self._instance.C
|
|
195
|
+
|
|
196
|
+
@C.setter
|
|
197
|
+
def C(self, value: float):
|
|
198
|
+
"""Set the exponential term."""
|
|
199
|
+
self._instance.C = value
|
|
200
|
+
|
|
201
|
+
@property
|
|
202
|
+
def k_reverse(self) -> float:
|
|
203
|
+
"""Get the reverse rate constant."""
|
|
204
|
+
return self._instance.k_reverse
|
|
205
|
+
|
|
206
|
+
@k_reverse.setter
|
|
207
|
+
def k_reverse(self, value: float):
|
|
208
|
+
"""Set the reverse rate constant."""
|
|
209
|
+
self._instance.k_reverse = value
|
|
210
|
+
|
|
211
|
+
@property
|
|
212
|
+
def other_properties(self) -> Dict[str, Any]:
|
|
213
|
+
"""Get the other properties."""
|
|
214
|
+
return self._instance.other_properties
|
|
215
|
+
|
|
216
|
+
@other_properties.setter
|
|
217
|
+
def other_properties(self, value: Dict[str, Any]):
|
|
218
|
+
"""Set the other properties."""
|
|
219
|
+
self._instance.other_properties = value
|
|
220
|
+
|
|
221
|
+
@property
|
|
222
|
+
def type(self):
|
|
223
|
+
"""Get the reaction type."""
|
|
224
|
+
return ReactionType.AqueousEquilibrium
|
|
225
|
+
|
|
226
|
+
def _create_serialize_dict(self, instance) -> Dict:
|
|
227
|
+
"""
|
|
228
|
+
Helper method to create the serialization dictionary.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
instance: The instance to serialize (either self._instance or a _AqueousEquilibrium object).
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Dict: Base serialization dictionary.
|
|
235
|
+
"""
|
|
236
|
+
return {
|
|
90
237
|
"type": "AQUEOUS_EQUILIBRIUM",
|
|
91
238
|
"name": instance.name,
|
|
92
|
-
"
|
|
93
|
-
"
|
|
239
|
+
"condensed phase": instance.condensed_phase,
|
|
240
|
+
"condensed-phase water": instance.condensed_phase_water,
|
|
94
241
|
"reactants": ReactionComponentSerializer.serialize_list_reaction_components(instance.reactants),
|
|
95
242
|
"products": ReactionComponentSerializer.serialize_list_reaction_components(instance.products),
|
|
96
243
|
"A": instance.A,
|
|
97
244
|
"C": instance.C,
|
|
98
245
|
"k_reverse": instance.k_reverse,
|
|
99
246
|
}
|
|
247
|
+
|
|
248
|
+
def serialize(self) -> Dict:
|
|
249
|
+
"""
|
|
250
|
+
Serialize the AqueousEquilibrium object to a dictionary using only Python-visible data.
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
Dict: A dictionary representation of the AqueousEquilibrium object.
|
|
254
|
+
"""
|
|
255
|
+
serialize_dict = self._create_serialize_dict(self._instance)
|
|
256
|
+
_add_other_properties(serialize_dict, self.other_properties)
|
|
257
|
+
return serialize_dict
|
|
258
|
+
|
|
259
|
+
@staticmethod
|
|
260
|
+
def serialize_static(instance) -> Dict:
|
|
261
|
+
"""
|
|
262
|
+
Static serialize method for compatibility with C++ _AqueousEquilibrium objects.
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
instance: The _AqueousEquilibrium instance to serialize.
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
Dict: A dictionary representation of the AqueousEquilibrium object.
|
|
269
|
+
"""
|
|
270
|
+
# Create a temporary AqueousEquilibrium object to use the helper method
|
|
271
|
+
temp_aqueous_equilibrium = AqueousEquilibrium()
|
|
272
|
+
serialize_dict = temp_aqueous_equilibrium._create_serialize_dict(instance)
|
|
100
273
|
_add_other_properties(serialize_dict, instance.other_properties)
|
|
101
|
-
return
|
|
274
|
+
return serialize_dict
|