pyreactlab-core 0.1.2__tar.gz → 0.1.3__tar.gz
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.
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/PKG-INFO +1 -1
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyproject.toml +74 -74
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/configs/info.py +1 -1
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/core/chem_react.py +63 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/models/reaction.py +5 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/PKG-INFO +1 -1
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/LICENSE +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/README.md +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/app.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/configs/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/configs/constants.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/core/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/docs/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/docs/chem_balance.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/docs/chem_utils.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/models/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/utils/__init__.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core/utils/tools.py +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/SOURCES.txt +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/dependency_links.txt +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/requires.txt +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/top_level.txt +0 -0
- {pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyreactlab-core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: pyreactlab-core is the core foundation of the PyReactLab ecosystem, offering shared data structures and algorithms for chemical reaction representation, stoichiometry, and reaction analysis.
|
|
5
5
|
Author-email: Sina Gilassi <sina.gilassi@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "pyreactlab-core"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "pyreactlab-core is the core foundation of the PyReactLab ecosystem, offering shared data structures and algorithms for chemical reaction representation, stoichiometry, and reaction analysis."
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.11"
|
|
11
|
-
license = "Apache-2.0"
|
|
12
|
-
license-files = ["LICENSE"]
|
|
13
|
-
authors = [
|
|
14
|
-
{name = "Sina Gilassi", email = "sina.gilassi@gmail.com"}
|
|
15
|
-
]
|
|
16
|
-
keywords = [
|
|
17
|
-
"chemical-engineering",
|
|
18
|
-
"chemical-reactions",
|
|
19
|
-
"reaction-representation",
|
|
20
|
-
"reaction-stoichiometry",
|
|
21
|
-
"reaction-analysis",
|
|
22
|
-
]
|
|
23
|
-
classifiers = [
|
|
24
|
-
"Development Status :: 1 - Planning",
|
|
25
|
-
"Intended Audience :: Education",
|
|
26
|
-
"Programming Language :: Python :: 3.11",
|
|
27
|
-
"Operating System :: Unix",
|
|
28
|
-
"Operating System :: MacOS :: MacOS X",
|
|
29
|
-
"Operating System :: Microsoft :: Windows",
|
|
30
|
-
]
|
|
31
|
-
dependencies = [
|
|
32
|
-
"numpy>=2.4.0",
|
|
33
|
-
"scipy>=1.16.3",
|
|
34
|
-
"pydantic>=2.12.5",
|
|
35
|
-
"pydantic-settings>=2.12.0",
|
|
36
|
-
"rich>=14.2.0",
|
|
37
|
-
"pythermodb-settings",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
[project.urls]
|
|
41
|
-
Homepage = "https://github.com/sinagilassi/PyReactLab-Core"
|
|
42
|
-
Documentation = "https://pyreactlab-core.readthedocs.io/en/latest/"
|
|
43
|
-
Source = "https://github.com/sinagilassi/PyReactLab-Core"
|
|
44
|
-
Tracker = "https://github.com/sinagilassi/PyReactLab-Core/issues"
|
|
45
|
-
|
|
46
|
-
[tool.setuptools]
|
|
47
|
-
include-package-data = true
|
|
48
|
-
|
|
49
|
-
[tool.setuptools.packages.find]
|
|
50
|
-
where = ["."]
|
|
51
|
-
include = ["pyreactlab_core*"]
|
|
52
|
-
exclude = [
|
|
53
|
-
"tests",
|
|
54
|
-
"tests.*",
|
|
55
|
-
"examples",
|
|
56
|
-
"examples.*",
|
|
57
|
-
"notebooks",
|
|
58
|
-
"notebooks.*",
|
|
59
|
-
"statics",
|
|
60
|
-
"statics.*",
|
|
61
|
-
"private",
|
|
62
|
-
"private.*",
|
|
63
|
-
"app",
|
|
64
|
-
"app.*"
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
[tool.setuptools.package-data]
|
|
68
|
-
pyreactlab_core = [
|
|
69
|
-
"config/*.yml",
|
|
70
|
-
"data/*.csv",
|
|
71
|
-
"templates/*.html",
|
|
72
|
-
"static/*",
|
|
73
|
-
"static/**/*"
|
|
74
|
-
]
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyreactlab-core"
|
|
7
|
+
version = "0.1.3"
|
|
8
|
+
description = "pyreactlab-core is the core foundation of the PyReactLab ecosystem, offering shared data structures and algorithms for chemical reaction representation, stoichiometry, and reaction analysis."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Sina Gilassi", email = "sina.gilassi@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
keywords = [
|
|
17
|
+
"chemical-engineering",
|
|
18
|
+
"chemical-reactions",
|
|
19
|
+
"reaction-representation",
|
|
20
|
+
"reaction-stoichiometry",
|
|
21
|
+
"reaction-analysis",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 1 - Planning",
|
|
25
|
+
"Intended Audience :: Education",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Operating System :: Unix",
|
|
28
|
+
"Operating System :: MacOS :: MacOS X",
|
|
29
|
+
"Operating System :: Microsoft :: Windows",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"numpy>=2.4.0",
|
|
33
|
+
"scipy>=1.16.3",
|
|
34
|
+
"pydantic>=2.12.5",
|
|
35
|
+
"pydantic-settings>=2.12.0",
|
|
36
|
+
"rich>=14.2.0",
|
|
37
|
+
"pythermodb-settings",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/sinagilassi/PyReactLab-Core"
|
|
42
|
+
Documentation = "https://pyreactlab-core.readthedocs.io/en/latest/"
|
|
43
|
+
Source = "https://github.com/sinagilassi/PyReactLab-Core"
|
|
44
|
+
Tracker = "https://github.com/sinagilassi/PyReactLab-Core/issues"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools]
|
|
47
|
+
include-package-data = true
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["."]
|
|
51
|
+
include = ["pyreactlab_core*"]
|
|
52
|
+
exclude = [
|
|
53
|
+
"tests",
|
|
54
|
+
"tests.*",
|
|
55
|
+
"examples",
|
|
56
|
+
"examples.*",
|
|
57
|
+
"notebooks",
|
|
58
|
+
"notebooks.*",
|
|
59
|
+
"statics",
|
|
60
|
+
"statics.*",
|
|
61
|
+
"private",
|
|
62
|
+
"private.*",
|
|
63
|
+
"app",
|
|
64
|
+
"app.*"
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.package-data]
|
|
68
|
+
pyreactlab_core = [
|
|
69
|
+
"config/*.yml",
|
|
70
|
+
"data/*.csv",
|
|
71
|
+
"templates/*.html",
|
|
72
|
+
"static/*",
|
|
73
|
+
"static/**/*"
|
|
74
|
+
]
|
|
@@ -46,6 +46,8 @@ class ChemReact:
|
|
|
46
46
|
- Use = → when thermodynamics dominates
|
|
47
47
|
- Use <=> → when kinetics + thermodynamics matter
|
|
48
48
|
- Use => → when kinetics only matter
|
|
49
|
+
- The class supports reactions involving components in gas, liquid, aqueous, and solid phases.
|
|
50
|
+
- It includes methods for analyzing reactions, counting carbon atoms, determining reaction phases, and more.
|
|
49
51
|
"""
|
|
50
52
|
# # NOTE: variables
|
|
51
53
|
# system inputs
|
|
@@ -87,6 +89,8 @@ class ChemReact:
|
|
|
87
89
|
- Use "<=>" when kinetics + thermodynamics matter
|
|
88
90
|
- Use "=" when thermodynamics dominates
|
|
89
91
|
- Use "=>" when kinetics only matter
|
|
92
|
+
- If components is None, component IDs will be an empty list.
|
|
93
|
+
- Component IDs are generated by combining the formula and state of each component, separated by a hyphen such as "H2O-l" for liquid water.
|
|
90
94
|
"""
|
|
91
95
|
# NOTE: set reaction mode symbol
|
|
92
96
|
self.reaction_mode_symbol = reaction_mode_symbol
|
|
@@ -386,6 +390,12 @@ class ChemReact:
|
|
|
386
390
|
products
|
|
387
391
|
)
|
|
388
392
|
|
|
393
|
+
# SECTION: map components
|
|
394
|
+
map_components = self.map_components(
|
|
395
|
+
reactants,
|
|
396
|
+
products,
|
|
397
|
+
)
|
|
398
|
+
|
|
389
399
|
# res
|
|
390
400
|
res = {
|
|
391
401
|
'name': name,
|
|
@@ -406,6 +416,7 @@ class ChemReact:
|
|
|
406
416
|
'reaction_phase': reaction_phase,
|
|
407
417
|
'state_count': state_count,
|
|
408
418
|
'components': components,
|
|
419
|
+
'map_components': map_components,
|
|
409
420
|
'component_checker': self._component_checker,
|
|
410
421
|
}
|
|
411
422
|
|
|
@@ -954,3 +965,55 @@ class ChemReact:
|
|
|
954
965
|
return components
|
|
955
966
|
except Exception as e:
|
|
956
967
|
raise Exception(f"Error collecting components: {e}")
|
|
968
|
+
|
|
969
|
+
def map_components(
|
|
970
|
+
self,
|
|
971
|
+
reactants: List[Reactant],
|
|
972
|
+
products: List[Product],
|
|
973
|
+
) -> Dict[str, Component]:
|
|
974
|
+
'''
|
|
975
|
+
Map components from reactants and products.
|
|
976
|
+
|
|
977
|
+
Parameters
|
|
978
|
+
----------
|
|
979
|
+
reactants: list
|
|
980
|
+
List of reactants.
|
|
981
|
+
products: list
|
|
982
|
+
List of products.
|
|
983
|
+
|
|
984
|
+
Returns
|
|
985
|
+
-------
|
|
986
|
+
component_map: dict
|
|
987
|
+
Dictionary mapping component IDs to Component objects.
|
|
988
|
+
'''
|
|
989
|
+
try:
|
|
990
|
+
# NOTE: initialize component map
|
|
991
|
+
component_map: Dict[str, Component] = {}
|
|
992
|
+
|
|
993
|
+
# SECTION: Check components
|
|
994
|
+
if self.components is None:
|
|
995
|
+
return component_map
|
|
996
|
+
|
|
997
|
+
# SECTION: Map components from reactants/products
|
|
998
|
+
# NOTE: reaction participants
|
|
999
|
+
reaction_participants = reactants + products
|
|
1000
|
+
|
|
1001
|
+
for item in reaction_participants:
|
|
1002
|
+
# component id
|
|
1003
|
+
component_id_ = item['molecule_state']
|
|
1004
|
+
|
|
1005
|
+
# check
|
|
1006
|
+
if (
|
|
1007
|
+
component_id_ in self.component_ids and
|
|
1008
|
+
component_id_ not in component_map
|
|
1009
|
+
):
|
|
1010
|
+
# >> get index
|
|
1011
|
+
index = self.component_ids.index(component_id_)
|
|
1012
|
+
# get component
|
|
1013
|
+
component = self.components[index]
|
|
1014
|
+
# map to component map
|
|
1015
|
+
component_map[component_id_] = component
|
|
1016
|
+
|
|
1017
|
+
return component_map
|
|
1018
|
+
except Exception as e:
|
|
1019
|
+
raise Exception(f"Error mapping components: {e}")
|
|
@@ -193,3 +193,8 @@ class Reaction(BaseModel):
|
|
|
193
193
|
@property
|
|
194
194
|
def component_checker(self) -> bool:
|
|
195
195
|
return self.analysis.get("component_checker", False)
|
|
196
|
+
|
|
197
|
+
@computed_field
|
|
198
|
+
@property
|
|
199
|
+
def map_components(self) -> Dict[str, Component]:
|
|
200
|
+
return self.analysis.get("map_components", {})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyreactlab-core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: pyreactlab-core is the core foundation of the PyReactLab ecosystem, offering shared data structures and algorithms for chemical reaction representation, stoichiometry, and reaction analysis.
|
|
5
5
|
Author-email: Sina Gilassi <sina.gilassi@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyreactlab_core-0.1.2 → pyreactlab_core-0.1.3}/pyreactlab_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|