pyThermoEst 0.1.0__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.
- pythermoest-0.1.0/LICENSE +21 -0
- pythermoest-0.1.0/PKG-INFO +191 -0
- pythermoest-0.1.0/README.md +163 -0
- pythermoest-0.1.0/pyThermoEst/__init__.py +21 -0
- pythermoest-0.1.0/pyThermoEst/app.py +109 -0
- pythermoest-0.1.0/pyThermoEst/configs/__init__.py +29 -0
- pythermoest-0.1.0/pyThermoEst/configs/info.py +10 -0
- pythermoest-0.1.0/pyThermoEst/configs/settings.py +18 -0
- pythermoest-0.1.0/pyThermoEst/core/__init__.py +7 -0
- pythermoest-0.1.0/pyThermoEst/core/joback.py +754 -0
- pythermoest-0.1.0/pyThermoEst/core/zabransky_ruzicka.py +507 -0
- pythermoest-0.1.0/pyThermoEst/data/__init__.py +0 -0
- pythermoest-0.1.0/pyThermoEst/data/joback.csv +43 -0
- pythermoest-0.1.0/pyThermoEst/data/zabransky-ruzicka-1.csv +131 -0
- pythermoest-0.1.0/pyThermoEst/data/zabransky-ruzicka-2.csv +29 -0
- pythermoest-0.1.0/pyThermoEst/docs/__init__.py +27 -0
- pythermoest-0.1.0/pyThermoEst/docs/joback.py +76 -0
- pythermoest-0.1.0/pyThermoEst/docs/refcore.py +38 -0
- pythermoest-0.1.0/pyThermoEst/docs/zabransky_ruzicka.py +171 -0
- pythermoest-0.1.0/pyThermoEst/models/__init__.py +25 -0
- pythermoest-0.1.0/pyThermoEst/models/jb.py +256 -0
- pythermoest-0.1.0/pyThermoEst/models/ref.py +29 -0
- pythermoest-0.1.0/pyThermoEst/models/zr.py +344 -0
- pythermoest-0.1.0/pyThermoEst/util/__init__.py +5 -0
- pythermoest-0.1.0/pyThermoEst/util/tools.py +86 -0
- pythermoest-0.1.0/pyThermoEst.egg-info/PKG-INFO +191 -0
- pythermoest-0.1.0/pyThermoEst.egg-info/SOURCES.txt +33 -0
- pythermoest-0.1.0/pyThermoEst.egg-info/dependency_links.txt +1 -0
- pythermoest-0.1.0/pyThermoEst.egg-info/requires.txt +7 -0
- pythermoest-0.1.0/pyThermoEst.egg-info/top_level.txt +4 -0
- pythermoest-0.1.0/pyproject.toml +88 -0
- pythermoest-0.1.0/setup.cfg +4 -0
- pythermoest-0.1.0/sources/data.py +132 -0
- pythermoest-0.1.0/sources/data2.py +30 -0
- pythermoest-0.1.0/test/test1.py +9 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Sina Gilassi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyThermoEst
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python toolkit for estimating thermodynamic properties
|
|
5
|
+
Author-email: Sina Gilassi <sina.gilassi@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sinagilassi/PyThermoEst
|
|
8
|
+
Project-URL: Documentation, https://pythermoest.readthedocs.io/en/latest/
|
|
9
|
+
Project-URL: Source, https://github.com/sinagilassi/PyThermoEst
|
|
10
|
+
Project-URL: Tracker, https://github.com/sinagilassi/PyThermoEst/issues
|
|
11
|
+
Keywords: chemical-engineering,thermodynamics,property-estimation,joback-method,zabransky-ruzicka-method,group-contribution-methods
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Operating System :: Unix
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: pandas>=2.3.3
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
23
|
+
Requires-Dist: pydantic>=2.12.4
|
|
24
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: rich>=14.2.0; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# 🧪 PyThermoEst
|
|
30
|
+
|
|
31
|
+
[](https://pepy.tech/projects/pythermoest)
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
PyThermoEst is a Python toolkit for estimating thermodynamic properties from group-contribution methods. It currently supports the **Joback** method for estimating a wide range of properties and the **Zabransky–Ruzicka** method for predicting the liquid-phase heat capacity.
|
|
37
|
+
|
|
38
|
+
## 📦 Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install pyThermoEst
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🚀 Usage
|
|
45
|
+
|
|
46
|
+
The package exposes convenience helpers in `pyThermoEst.app` for both calculation workflows. See the `examples/` directory for runnable scripts.
|
|
47
|
+
|
|
48
|
+
### 🧬 Joback property estimation
|
|
49
|
+
|
|
50
|
+
Provide Joback group contributions along with the total number of atoms, then call `joback_calc`. You can mix field names or their documented aliases when building `JobackGroupContributions`.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from pyThermoEst import joback_calc
|
|
54
|
+
from pyThermoEst.models import JobackGroupContributions, GroupUnit
|
|
55
|
+
|
|
56
|
+
payload = {
|
|
57
|
+
"-CH3": GroupUnit(value=2),
|
|
58
|
+
"=CH- @ring": GroupUnit(value=3),
|
|
59
|
+
"=C< @ring": GroupUnit(value=3),
|
|
60
|
+
"-OH @phenol": GroupUnit(value=1),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
joback_groups = JobackGroupContributions(**payload)
|
|
64
|
+
|
|
65
|
+
# or dict with aliases:
|
|
66
|
+
# joback_groups = {
|
|
67
|
+
# "-CH3": 2,
|
|
68
|
+
# "=CH- @ring": 3,
|
|
69
|
+
# "=C< @ring": 3,
|
|
70
|
+
# "-OH @phenol": 1,
|
|
71
|
+
# }
|
|
72
|
+
|
|
73
|
+
result = joback_calc(groups=joback_groups, total_atoms_number=18)
|
|
74
|
+
|
|
75
|
+
# Evaluate a temperature-dependent property, e.g., heat capacity at 273 K
|
|
76
|
+
cp_273 = result["heat_capacity"]["value"](273)
|
|
77
|
+
print(cp_273)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 💧 Zabransky–Ruzicka liquid heat capacity
|
|
81
|
+
|
|
82
|
+
To compute liquid heat capacity, provide required group contributions and optional correction terms, then call `zabransky_ruzicka_calc`.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from pyThermoEst import zabransky_ruzicka_calc
|
|
86
|
+
from pyThermoEst.models import (
|
|
87
|
+
ZabranskyRuzickaGroupContributions,
|
|
88
|
+
ZabranskyRuzickaGroupContributionsCorrections,
|
|
89
|
+
GroupUnit,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
payload = {
|
|
93
|
+
"C-(H)3(O)": GroupUnit(value=2),
|
|
94
|
+
"CO-(O)2": GroupUnit(value=1),
|
|
95
|
+
"O-(C)(CO)": GroupUnit(value=2),
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
contributions = ZabranskyRuzickaGroupContributions(**payload)
|
|
99
|
+
corrections = ZabranskyRuzickaGroupContributionsCorrections()
|
|
100
|
+
|
|
101
|
+
# or dicts with aliases:
|
|
102
|
+
# contributions = {
|
|
103
|
+
# "C-(H)3(O)": 2,
|
|
104
|
+
# "CO-(O)2": 1,
|
|
105
|
+
# "O-(C)(CO)": 2,
|
|
106
|
+
# }
|
|
107
|
+
|
|
108
|
+
result = zabransky_ruzicka_calc(
|
|
109
|
+
group_contributions=contributions,
|
|
110
|
+
group_corrections=corrections
|
|
111
|
+
)
|
|
112
|
+
cp_liq_at_300k = result["value"](298.15)
|
|
113
|
+
print(cp_liq_at_300k, result["unit"], result["symbol"])
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 📚 Getting group contribution IDs and names
|
|
117
|
+
|
|
118
|
+
You can inspect available group contribution identifiers and names for each method:
|
|
119
|
+
|
|
120
|
+
#### 🧬 Joback group contributions
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from pyThermoEst.docs.joback import (
|
|
124
|
+
joback_group_contribution_info,
|
|
125
|
+
joback_group_contribution_names,
|
|
126
|
+
joback_group_contribution_ids
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# Get all group contribution IDs (aliases)
|
|
130
|
+
group_ids = joback_group_contribution_ids()
|
|
131
|
+
|
|
132
|
+
# Get all group contribution names (field names)
|
|
133
|
+
group_names = joback_group_contribution_names()
|
|
134
|
+
|
|
135
|
+
# Get both names and IDs as tuples
|
|
136
|
+
names, ids = joback_group_contribution_info()
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### 💧 Zabransky–Ruzicka group contributions
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from pyThermoEst.docs.zabransky_ruzicka import (
|
|
143
|
+
zabransky_ruzicka_group_contribution_info,
|
|
144
|
+
zabransky_ruzicka_group_contribution_names,
|
|
145
|
+
zabransky_ruzicka_group_contribution_ids,
|
|
146
|
+
zabransky_ruzicka_group_correction_info,
|
|
147
|
+
zabransky_ruzicka_group_correction_ids,
|
|
148
|
+
zabransky_ruzicka_group_correction_names
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# Get group contribution IDs (aliases)
|
|
152
|
+
group_ids = zabransky_ruzicka_group_contribution_ids()
|
|
153
|
+
|
|
154
|
+
# Get group contribution names (field names)
|
|
155
|
+
group_names = zabransky_ruzicka_group_contribution_names()
|
|
156
|
+
|
|
157
|
+
# Get both names and IDs as tuples
|
|
158
|
+
names, ids = zabransky_ruzicka_group_contribution_info()
|
|
159
|
+
|
|
160
|
+
# Get correction term IDs
|
|
161
|
+
correction_ids = zabransky_ruzicka_group_correction_ids()
|
|
162
|
+
|
|
163
|
+
# Get correction term names
|
|
164
|
+
correction_names = zabransky_ruzicka_group_correction_names()
|
|
165
|
+
|
|
166
|
+
# Get both correction names and IDs as tuples
|
|
167
|
+
corr_names, corr_ids = zabransky_ruzicka_group_correction_info()
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 📖 Further examples
|
|
171
|
+
|
|
172
|
+
- `examples/joback-exp-0.py`: Inspect available Joback group IDs and names.
|
|
173
|
+
- `examples/joback-exp-1.py`: Build Joback group payloads with field names or aliases.
|
|
174
|
+
- `examples/joback-exp-2.py`: Full Joback calculation including temperature evaluation.
|
|
175
|
+
- `examples/zabransky-ruzicka-exp-0.py`: Inspect available Zabransky–Ruzicka group IDs, names, and corrections.
|
|
176
|
+
- `examples/zabransky-ruzicka-exp-1.py`: Zabransky–Ruzicka calculation with optional corrections.
|
|
177
|
+
|
|
178
|
+
## 🔧 API reference
|
|
179
|
+
|
|
180
|
+
- `pyThermoEst.app.joback_calc(groups, total_atoms_number)`: Runs Joback method and returns calculated properties.
|
|
181
|
+
- `pyThermoEst.app.zabransky_ruzicka_calc(group_contributions, group_corrections=None)`: Returns an equation for liquid heat capacity plus units and symbol metadata.
|
|
182
|
+
|
|
183
|
+
Each function accepts either the pydantic models or plain dictionaries keyed by group identifiers; aliases are supported for convenience.
|
|
184
|
+
|
|
185
|
+
## 📝 License
|
|
186
|
+
|
|
187
|
+
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
|
|
188
|
+
|
|
189
|
+
## ❓ FAQ
|
|
190
|
+
|
|
191
|
+
For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# 🧪 PyThermoEst
|
|
2
|
+
|
|
3
|
+
[](https://pepy.tech/projects/pythermoest)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
PyThermoEst is a Python toolkit for estimating thermodynamic properties from group-contribution methods. It currently supports the **Joback** method for estimating a wide range of properties and the **Zabransky–Ruzicka** method for predicting the liquid-phase heat capacity.
|
|
9
|
+
|
|
10
|
+
## 📦 Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install pyThermoEst
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 🚀 Usage
|
|
17
|
+
|
|
18
|
+
The package exposes convenience helpers in `pyThermoEst.app` for both calculation workflows. See the `examples/` directory for runnable scripts.
|
|
19
|
+
|
|
20
|
+
### 🧬 Joback property estimation
|
|
21
|
+
|
|
22
|
+
Provide Joback group contributions along with the total number of atoms, then call `joback_calc`. You can mix field names or their documented aliases when building `JobackGroupContributions`.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from pyThermoEst import joback_calc
|
|
26
|
+
from pyThermoEst.models import JobackGroupContributions, GroupUnit
|
|
27
|
+
|
|
28
|
+
payload = {
|
|
29
|
+
"-CH3": GroupUnit(value=2),
|
|
30
|
+
"=CH- @ring": GroupUnit(value=3),
|
|
31
|
+
"=C< @ring": GroupUnit(value=3),
|
|
32
|
+
"-OH @phenol": GroupUnit(value=1),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
joback_groups = JobackGroupContributions(**payload)
|
|
36
|
+
|
|
37
|
+
# or dict with aliases:
|
|
38
|
+
# joback_groups = {
|
|
39
|
+
# "-CH3": 2,
|
|
40
|
+
# "=CH- @ring": 3,
|
|
41
|
+
# "=C< @ring": 3,
|
|
42
|
+
# "-OH @phenol": 1,
|
|
43
|
+
# }
|
|
44
|
+
|
|
45
|
+
result = joback_calc(groups=joback_groups, total_atoms_number=18)
|
|
46
|
+
|
|
47
|
+
# Evaluate a temperature-dependent property, e.g., heat capacity at 273 K
|
|
48
|
+
cp_273 = result["heat_capacity"]["value"](273)
|
|
49
|
+
print(cp_273)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 💧 Zabransky–Ruzicka liquid heat capacity
|
|
53
|
+
|
|
54
|
+
To compute liquid heat capacity, provide required group contributions and optional correction terms, then call `zabransky_ruzicka_calc`.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from pyThermoEst import zabransky_ruzicka_calc
|
|
58
|
+
from pyThermoEst.models import (
|
|
59
|
+
ZabranskyRuzickaGroupContributions,
|
|
60
|
+
ZabranskyRuzickaGroupContributionsCorrections,
|
|
61
|
+
GroupUnit,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
payload = {
|
|
65
|
+
"C-(H)3(O)": GroupUnit(value=2),
|
|
66
|
+
"CO-(O)2": GroupUnit(value=1),
|
|
67
|
+
"O-(C)(CO)": GroupUnit(value=2),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
contributions = ZabranskyRuzickaGroupContributions(**payload)
|
|
71
|
+
corrections = ZabranskyRuzickaGroupContributionsCorrections()
|
|
72
|
+
|
|
73
|
+
# or dicts with aliases:
|
|
74
|
+
# contributions = {
|
|
75
|
+
# "C-(H)3(O)": 2,
|
|
76
|
+
# "CO-(O)2": 1,
|
|
77
|
+
# "O-(C)(CO)": 2,
|
|
78
|
+
# }
|
|
79
|
+
|
|
80
|
+
result = zabransky_ruzicka_calc(
|
|
81
|
+
group_contributions=contributions,
|
|
82
|
+
group_corrections=corrections
|
|
83
|
+
)
|
|
84
|
+
cp_liq_at_300k = result["value"](298.15)
|
|
85
|
+
print(cp_liq_at_300k, result["unit"], result["symbol"])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 📚 Getting group contribution IDs and names
|
|
89
|
+
|
|
90
|
+
You can inspect available group contribution identifiers and names for each method:
|
|
91
|
+
|
|
92
|
+
#### 🧬 Joback group contributions
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from pyThermoEst.docs.joback import (
|
|
96
|
+
joback_group_contribution_info,
|
|
97
|
+
joback_group_contribution_names,
|
|
98
|
+
joback_group_contribution_ids
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Get all group contribution IDs (aliases)
|
|
102
|
+
group_ids = joback_group_contribution_ids()
|
|
103
|
+
|
|
104
|
+
# Get all group contribution names (field names)
|
|
105
|
+
group_names = joback_group_contribution_names()
|
|
106
|
+
|
|
107
|
+
# Get both names and IDs as tuples
|
|
108
|
+
names, ids = joback_group_contribution_info()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### 💧 Zabransky–Ruzicka group contributions
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from pyThermoEst.docs.zabransky_ruzicka import (
|
|
115
|
+
zabransky_ruzicka_group_contribution_info,
|
|
116
|
+
zabransky_ruzicka_group_contribution_names,
|
|
117
|
+
zabransky_ruzicka_group_contribution_ids,
|
|
118
|
+
zabransky_ruzicka_group_correction_info,
|
|
119
|
+
zabransky_ruzicka_group_correction_ids,
|
|
120
|
+
zabransky_ruzicka_group_correction_names
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Get group contribution IDs (aliases)
|
|
124
|
+
group_ids = zabransky_ruzicka_group_contribution_ids()
|
|
125
|
+
|
|
126
|
+
# Get group contribution names (field names)
|
|
127
|
+
group_names = zabransky_ruzicka_group_contribution_names()
|
|
128
|
+
|
|
129
|
+
# Get both names and IDs as tuples
|
|
130
|
+
names, ids = zabransky_ruzicka_group_contribution_info()
|
|
131
|
+
|
|
132
|
+
# Get correction term IDs
|
|
133
|
+
correction_ids = zabransky_ruzicka_group_correction_ids()
|
|
134
|
+
|
|
135
|
+
# Get correction term names
|
|
136
|
+
correction_names = zabransky_ruzicka_group_correction_names()
|
|
137
|
+
|
|
138
|
+
# Get both correction names and IDs as tuples
|
|
139
|
+
corr_names, corr_ids = zabransky_ruzicka_group_correction_info()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 📖 Further examples
|
|
143
|
+
|
|
144
|
+
- `examples/joback-exp-0.py`: Inspect available Joback group IDs and names.
|
|
145
|
+
- `examples/joback-exp-1.py`: Build Joback group payloads with field names or aliases.
|
|
146
|
+
- `examples/joback-exp-2.py`: Full Joback calculation including temperature evaluation.
|
|
147
|
+
- `examples/zabransky-ruzicka-exp-0.py`: Inspect available Zabransky–Ruzicka group IDs, names, and corrections.
|
|
148
|
+
- `examples/zabransky-ruzicka-exp-1.py`: Zabransky–Ruzicka calculation with optional corrections.
|
|
149
|
+
|
|
150
|
+
## 🔧 API reference
|
|
151
|
+
|
|
152
|
+
- `pyThermoEst.app.joback_calc(groups, total_atoms_number)`: Runs Joback method and returns calculated properties.
|
|
153
|
+
- `pyThermoEst.app.zabransky_ruzicka_calc(group_contributions, group_corrections=None)`: Returns an equation for liquid heat capacity plus units and symbol metadata.
|
|
154
|
+
|
|
155
|
+
Each function accepts either the pydantic models or plain dictionaries keyed by group identifiers; aliases are supported for convenience.
|
|
156
|
+
|
|
157
|
+
## 📝 License
|
|
158
|
+
|
|
159
|
+
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
|
|
160
|
+
|
|
161
|
+
## ❓ FAQ
|
|
162
|
+
|
|
163
|
+
For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .configs import (
|
|
2
|
+
__version__,
|
|
3
|
+
__author__,
|
|
4
|
+
__description__,
|
|
5
|
+
__email__,
|
|
6
|
+
__license__,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .app import joback_calc, zabransky_ruzicka_calc
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
# config
|
|
13
|
+
"__version__",
|
|
14
|
+
"__author__",
|
|
15
|
+
"__description__",
|
|
16
|
+
"__email__",
|
|
17
|
+
"__license__",
|
|
18
|
+
# app
|
|
19
|
+
"joback_calc",
|
|
20
|
+
"zabransky_ruzicka_calc",
|
|
21
|
+
]
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# import libs
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
# locals
|
|
5
|
+
from .models import (
|
|
6
|
+
JobackGroupContributions,
|
|
7
|
+
ZabranskyRuzickaGroupContributions,
|
|
8
|
+
ZabranskyRuzickaGroupContributionsCorrections,
|
|
9
|
+
EstimatedProp
|
|
10
|
+
)
|
|
11
|
+
from .core import Joback, ZabranskyRuzicka
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# NOTE: logger
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# SECTION: Joback Group Contributions
|
|
19
|
+
|
|
20
|
+
def joback_calc(
|
|
21
|
+
groups: JobackGroupContributions | Dict[str, int] | Dict[str, float],
|
|
22
|
+
total_atoms_number: int
|
|
23
|
+
) -> Optional[Dict[str, EstimatedProp]]:
|
|
24
|
+
"""
|
|
25
|
+
Using Joback method to calculate thermodynamic properties including
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
groups : JobackGroupContributions | Dict[str, float] | Dict[str, int]
|
|
30
|
+
Group contributions for Joback method.
|
|
31
|
+
total_atoms_number : int
|
|
32
|
+
Total number of atoms in the molecule.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
Dict[str, EstimatedProp] | None
|
|
37
|
+
A dictionary containing calculated thermodynamic properties.
|
|
38
|
+
|
|
39
|
+
Notes
|
|
40
|
+
-----
|
|
41
|
+
You can use either the field names or their aliases to specify group contributions. For example:
|
|
42
|
+
- methyl has alias '-CH3'
|
|
43
|
+
- methylene has alias '-CH2- @non-ring'
|
|
44
|
+
- imine_non_ring has alias '-N= @non-ring'
|
|
45
|
+
- imine_ring has alias '-N= @ring'
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
try:
|
|
49
|
+
# SECTION: initialize Joback method
|
|
50
|
+
Joback_ = Joback(
|
|
51
|
+
group_contributions=groups,
|
|
52
|
+
total_atoms_number=total_atoms_number
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# NOTE: calculate properties
|
|
56
|
+
return Joback_._calc()
|
|
57
|
+
except Exception as e:
|
|
58
|
+
logger.error(f"Error in Joback calculation: {e}")
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
# SECTION: Zabransky-Ruzicka Group Contributions
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def zabransky_ruzicka_calc(
|
|
65
|
+
group_contributions: ZabranskyRuzickaGroupContributions | Dict[str, float] | Dict[str, int],
|
|
66
|
+
group_corrections: Optional[
|
|
67
|
+
ZabranskyRuzickaGroupContributionsCorrections |
|
|
68
|
+
Dict[str, float] |
|
|
69
|
+
Dict[str, int]
|
|
70
|
+
] = None
|
|
71
|
+
) -> Optional[EstimatedProp]:
|
|
72
|
+
"""
|
|
73
|
+
Using Zabransky-Ruzicka method to calculate thermodynamic properties including
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
group_contributions : ZabranskyRuzickaGroupContributions | Dict[str, float] | Dict[str, int]
|
|
78
|
+
Group contributions for Zabransky-Ruzicka method.
|
|
79
|
+
group_corrections : Optional[ZabranskyRuzickaGroupContributionsCorrections | Dict[str, float] | Dict[str, int]]
|
|
80
|
+
Group correction contributions for Zabransky-Ruzicka method.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
EstimatedProp | None
|
|
85
|
+
A dictionary containing calculated thermodynamic properties as:
|
|
86
|
+
- value: equation to calculate heat capacity.
|
|
87
|
+
- units: units of the heat capacity (J/mol.K).
|
|
88
|
+
- symbol: symbol representing heat capacity (Cp_LIQ).
|
|
89
|
+
|
|
90
|
+
Notes
|
|
91
|
+
-----
|
|
92
|
+
You can use either the field names or their aliases to specify group contributions. For example:
|
|
93
|
+
- C-(H)3(C)
|
|
94
|
+
- C-(H)2(C)2
|
|
95
|
+
- C-(H)(C)3
|
|
96
|
+
|
|
97
|
+
"""
|
|
98
|
+
try:
|
|
99
|
+
# SECTION: initialize Zabransky-Ruzicka method
|
|
100
|
+
ZabranskyRuzicka_ = ZabranskyRuzicka(
|
|
101
|
+
group_contributions=group_contributions,
|
|
102
|
+
group_corrections=group_corrections
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# NOTE: calculate properties
|
|
106
|
+
return ZabranskyRuzicka_._calc()
|
|
107
|
+
except Exception as e:
|
|
108
|
+
logger.error(f"Error in Zabransky-Ruzicka calculation: {e}")
|
|
109
|
+
return None
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from .info import (
|
|
2
|
+
__author__,
|
|
3
|
+
__description__,
|
|
4
|
+
__email__,
|
|
5
|
+
__license__,
|
|
6
|
+
__version__,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .settings import (
|
|
10
|
+
JOBACK_DATA_FILE,
|
|
11
|
+
JOBACK_TABLE_COLUMN_GROUP,
|
|
12
|
+
ZABRANSKY_RUZICKA_DATA_FILE_1,
|
|
13
|
+
ZABRANSKY_RUZICKA_DATA_FILE_2,
|
|
14
|
+
ZABRANSKY_RUZICKA_TABLE_COLUMN_GROUP,
|
|
15
|
+
ZABRANSKY_RUZICKA_REFERENCE
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"__author__",
|
|
20
|
+
"__description__",
|
|
21
|
+
"__email__",
|
|
22
|
+
"__license__",
|
|
23
|
+
"__version__",
|
|
24
|
+
"JOBACK_DATA_FILE",
|
|
25
|
+
"JOBACK_TABLE_COLUMN_GROUP",
|
|
26
|
+
"ZABRANSKY_RUZICKA_DATA_FILE_1",
|
|
27
|
+
"ZABRANSKY_RUZICKA_DATA_FILE_2",
|
|
28
|
+
"ZABRANSKY_RUZICKA_TABLE_COLUMN_GROUP",
|
|
29
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# import libs
|
|
2
|
+
|
|
3
|
+
# SECTION: Joback method settings
|
|
4
|
+
JOBACK_DATA_FILE = 'joback.csv'
|
|
5
|
+
|
|
6
|
+
# NOTE: tables
|
|
7
|
+
JOBACK_TABLE_COLUMN_GROUP = 'Group'
|
|
8
|
+
|
|
9
|
+
# SECTION: zabransky-ruzicka method settings
|
|
10
|
+
ZABRANSKY_RUZICKA_DATA_FILE_1 = 'zabransky-ruzicka-1.csv'
|
|
11
|
+
ZABRANSKY_RUZICKA_DATA_FILE_2 = 'zabransky-ruzicka-2.csv'
|
|
12
|
+
|
|
13
|
+
# NOTE: tables
|
|
14
|
+
ZABRANSKY_RUZICKA_TABLE_COLUMN_GROUP = 'Group'
|
|
15
|
+
|
|
16
|
+
# NOTE: reference
|
|
17
|
+
ZABRANSKY_RUZICKA_REFERENCE = """Zábranský, Milan, and Vlastimil Růžička Jr. "Estimation of the heat capacities of organic liquids as a function of temperature using group additivity: an amendment." Journal of physical and chemical reference data 33.4 (2004): 1071-1081.
|
|
18
|
+
"""
|