Skip to content

Commit 5c6d4e2

Browse files
Merge pull request #7 from SalvadorBrandolin/main
to clapeyron
2 parents 8354b68 + 0981f48 commit 5c6d4e2

27 files changed

+1063
-11
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ exclude tox.ini
99
exclude .readthedocs.yml
1010
exclude requirements-dev.txt
1111
exclude *.png
12+
exclude binder.ipynb
1213
exclude reminder.md
1314

1415
recursive-exclude dist *

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ in the molecule.
1717
ugropy is in an early development stage, leaving issues of examples of
1818
molecules that ugropy fails solving the UNIFAC's groups is very helpful.
1919

20+
## Try ugropy now
21+
You can try ugropy from it's
22+
[Binder](https://mybinder.org/v2/gh/ipqa-research/ugropy/main). Open the
23+
binder.ipynb file to explore the basic features.
24+
2025
## Models supported v1.0.0
2126
- Classic liquid-vapor UNIFAC
2227
- Predictive Soave-Redlich-Kwong (PSRK)
2328
- Joback
2429

2530
## Example of use
26-
You can check the full tutorial [here](https://ugropy.readthedocs.io/en/latest/tutorial/tutorial.html).
31+
You can check the full tutorial
32+
[here](https://ugropy.readthedocs.io/en/latest/tutorial/tutorial.html).
2733

2834
Get UNIFAC groups from the molecule's name:
2935

@@ -70,6 +76,26 @@ print(f"{limonene.joback.vapor_pressure(176 + 273.15)} bar")
7076
657.4486692170663 K
7177
1.0254019428522743 bar
7278

79+
Write down the [Clapeyron.jl](https://github.com/ClapeyronThermo/Clapeyron.jl)
80+
.csv input files.
81+
82+
```python
83+
from ugropy import writers
84+
85+
names = ["limonene", "adrenaline", "Trinitrotoluene"]
86+
87+
grps = [Groups(n) for n in names]
88+
89+
# Write the csv files into a database directory
90+
writers.to_clapeyron(
91+
molecules_names=names,
92+
unifac_groups=[g.unifac_groups for g in grps],
93+
psrk_groups=[g.psrk_groups for g in grps],
94+
joback_objects=[g.joback for g in grps],
95+
path="./database"
96+
)
97+
```
98+
7399
## Installation
74100
At the moment ugropy is not uploaded in PyPI (will be soon).
75101

binder.ipynb

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Welcome to the ugropy's Binder\n",
8+
"\n",
9+
"You can use this notebook to try the basics features of ugropy. You can \n",
10+
"check the full tutorial here: https://ugropy.readthedocs.io/en/latest/index.html\n",
11+
"\n",
12+
"Let's use the Groups class to obtain information of the desired molecules:"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 35,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"from ugropy import Groups\n",
22+
"\n",
23+
"# Write the molecule's name as it appears on pubchem\n",
24+
"molecule_name = \"ethanol\"\n",
25+
"\n",
26+
"mol = Groups(molecule_name)"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {},
32+
"source": [
33+
"Get groups information and properties from the Joback model"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 36,
39+
"metadata": {},
40+
"outputs": [
41+
{
42+
"name": "stdout",
43+
"output_type": "stream",
44+
"text": [
45+
"{'CH3': 1, 'CH2': 1, 'OH': 1}\n",
46+
"{'CH3': 1, 'CH2': 1, 'OH': 1}\n",
47+
"{'-CH3': 1, '-CH2-': 1, '-OH (alcohol)': 1}\n"
48+
]
49+
}
50+
],
51+
"source": [
52+
"print(mol.unifac_groups)\n",
53+
"print(mol.psrk_groups)\n",
54+
"print(mol.joback.groups)"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"execution_count": 37,
60+
"metadata": {},
61+
"outputs": [
62+
{
63+
"name": "stdout",
64+
"output_type": "stream",
65+
"text": [
66+
"57.56641437226128\n",
67+
"499.40737356625846\n",
68+
"1.702089531406276\n"
69+
]
70+
}
71+
],
72+
"source": [
73+
"# Experimental value of ethanol's critical pressure is 61.37 bar\n",
74+
"print(mol.joback.critical_pressure)\n",
75+
"\n",
76+
"# Experimental value of ethanol's critical temperature is 514.0 K\n",
77+
"print(mol.joback.critical_temperature)\n",
78+
"\n",
79+
"# Vapor pressure at the normal boiling temperature of ethanol\n",
80+
"print(mol.joback.vapor_pressure(78.37 + 273.15))"
81+
]
82+
},
83+
{
84+
"cell_type": "markdown",
85+
"metadata": {},
86+
"source": [
87+
"You can provide the normal boiling point of the molecules to improve some \n",
88+
"Joback's predictions."
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": 38,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"mol = Groups(molecule_name, normal_boiling_temperature=78.37+273.15)"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 39,
103+
"metadata": {},
104+
"outputs": [
105+
{
106+
"name": "stdout",
107+
"output_type": "stream",
108+
"text": [
109+
"520.0914853232541\n",
110+
"1.0132499999999998\n"
111+
]
112+
}
113+
],
114+
"source": [
115+
"print(mol.joback.critical_temperature)\n",
116+
"\n",
117+
"print(mol.joback.vapor_pressure(78.37+273.15))"
118+
]
119+
},
120+
{
121+
"cell_type": "markdown",
122+
"metadata": {},
123+
"source": [
124+
"You can also create a Groups object from the molecule's SMILES."
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": 40,
130+
"metadata": {},
131+
"outputs": [
132+
{
133+
"name": "stdout",
134+
"output_type": "stream",
135+
"text": [
136+
"520.0914853232541\n",
137+
"1.0132499999999998\n"
138+
]
139+
}
140+
],
141+
"source": [
142+
"# Ethanol again\n",
143+
"mol = Groups(\n",
144+
" \"CCO\", \n",
145+
" identifier_type=\"smiles\", \n",
146+
" normal_boiling_temperature=78.37+273.15\n",
147+
")\n",
148+
"\n",
149+
"print(mol.joback.critical_temperature)\n",
150+
"\n",
151+
"print(mol.joback.vapor_pressure(78.37+273.15))"
152+
]
153+
},
154+
{
155+
"cell_type": "markdown",
156+
"metadata": {},
157+
"source": [
158+
"Check the tutorial to explore more features."
159+
]
160+
}
161+
],
162+
"metadata": {
163+
"kernelspec": {
164+
"display_name": "ugropy",
165+
"language": "python",
166+
"name": "python3"
167+
},
168+
"language_info": {
169+
"codemirror_mode": {
170+
"name": "ipython",
171+
"version": 3
172+
},
173+
"file_extension": ".py",
174+
"mimetype": "text/x-python",
175+
"name": "python",
176+
"nbconvert_exporter": "python",
177+
"pygments_lexer": "ipython3",
178+
"version": "3.10.12"
179+
}
180+
},
181+
"nbformat": 4,
182+
"nbformat_minor": 2
183+
}

docs/source/README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,25 @@ Estimate properties with the Joback model!
8080
657.4486692170663 K
8181
1.0254019428522743 bar
8282

83+
Write down the Clapeyron.jl .csv input files.
84+
85+
.. code:: python
86+
87+
from ugropy import writers
88+
89+
names = ["limonene", "adrenaline", "Trinitrotoluene"]
90+
91+
grps = [Groups(n) for n in names]
92+
93+
# Write the csv files into a database directory
94+
writers.to_clapeyron(
95+
molecules_names=names,
96+
unifac_groups=[g.unifac_groups for g in grps],
97+
psrk_groups=[g.psrk_groups for g in grps],
98+
joback_objects=[g.joback for g in grps],
99+
path="./database"
100+
)
101+
83102
Installation
84103
============
85104

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Clapeyron Database File,
2+
PSRK Groups [csvtype = groups,grouptype = PSRK]
3+
species,groups
4+
limonene,"[""CH3"" => 2, ""CH2"" => 3, ""CH"" => 1, ""CH2=C"" => 1, ""CH=C"" => 1]"
5+
adrenaline,"[""CH2"" => 1, ""ACH"" => 3, ""ACCH"" => 1, ""OH"" => 1, ""ACOH"" => 2, ""CH3NH"" => 1]"
6+
Trinitrotoluene,"[""ACH"" => 2, ""ACCH3"" => 1, ""ACNO2"" => 3]"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Clapeyron Database File,,,,,
2+
Critical Single Parameters,,,,,
3+
species,CAS,Tc,Pc,Vc,acentricfactor
4+
limonene,,657.4486692170663,2755561.066677689,0.0004965,0.3219127551737521
5+
adrenaline,,953.7486693594541,5569169.079973267,0.0004115,1.6071531017924205
6+
Trinitrotoluene,,1146.7095578060987,4067315.701790919,0.0005654999999999999,1.0796561474496789
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Clapeyron Database File,,
2+
Molar Mases Single Params,,
3+
species,CAS,Mw
4+
limonene,,136.23760000000001
5+
adrenaline,,183.20680000000002
6+
Trinitrotoluene,,227.132
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Clapeyron Database File,
2+
original UNIFAC Groups,[csvtype = groups,grouptype = originalUNIFAC]
3+
species,groups
4+
limonene,"[""CH3"" => 2, ""CH2"" => 3, ""CH"" => 1, ""CH2=C"" => 1, ""CH=C"" => 1]"
5+
adrenaline,"[""CH2"" => 1, ""ACH"" => 3, ""ACCH"" => 1, ""OH"" => 1, ""ACOH"" => 2, ""CH3NH"" => 1]"
6+
Trinitrotoluene,"[""ACH"" => 2, ""ACCH3"" => 1, ""ACNO2"" => 3]"

docs/source/tutorial/easy_way.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"metadata": {},
4444
"source": [
4545
"Well, that was easy... `ugropy` uses\n",
46-
"[`PubChemPy`](https://github.com/mcs07/PubChemPy) to access to pubchem and\n",
46+
"`PubChemPy` (https://github.com/mcs07/PubChemPy) to access to pubchem and\n",
4747
"obtain the SMILES representation of the molecule. ugropy uses the SMILES\n",
48-
"representation and the [`rdkit`](https://github.com/rdkit/rdkit) library to\n",
48+
"representation and the `rdkit` (https://github.com/rdkit/rdkit) library to\n",
4949
"obtain the functional groups of the molecules.\n",
5050
"\n",
5151
"The complete signature of the `Groups` class is the following:"
@@ -351,7 +351,7 @@
351351
"name": "python",
352352
"nbconvert_exporter": "python",
353353
"pygments_lexer": "ipython3",
354-
"version": "3.10.12"
354+
"version": "3.10.6"
355355
}
356356
},
357357
"nbformat": 4,

docs/source/tutorial/hard_way.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"source": [
8282
"#### Joback\n",
8383
"\n",
84-
"For context, check the [Joback's article](https://doi.org/10.1080/00986448708960487).\n",
84+
"For context, check the Joback's article: https://doi.org/10.1080/00986448708960487\n",
8585
"\n",
8686
"The Joback object is instantiated by the Group object as we saw in the previous \n",
8787
"tutorial but, a Joback object can be instantiated individually:"
@@ -314,7 +314,7 @@
314314
"name": "python",
315315
"nbconvert_exporter": "python",
316316
"pygments_lexer": "ipython3",
317-
"version": "3.10.12"
317+
"version": "3.10.6"
318318
}
319319
},
320320
"nbformat": 4,

docs/source/tutorial/installation.ipynb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
"At the moment ugropy is not uploaded in PyPI (will be soon).\n",
1010
"\n",
1111
"```\n",
12-
"pip install git+https://github.com/SalvadorBrandolin/ugropy.git\n",
12+
"pip install git+https://github.com/ipqa-research/ugropy.git\n",
1313
"```"
1414
]
1515
}
1616
],
1717
"metadata": {
18+
"kernelspec": {
19+
"display_name": "ugropy",
20+
"language": "python",
21+
"name": "python3"
22+
},
1823
"language_info": {
19-
"name": "python"
24+
"name": "python",
25+
"version": "3.10.12"
2026
}
2127
},
2228
"nbformat": 4,

docs/source/tutorial/tutorial.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Tutorial
77
installation.ipynb
88
easy_way.ipynb
99
hard_way.ipynb
10-
ugropy_failing.ipynb
10+
ugropy_failing.ipynb
11+
writers.ipynb

0 commit comments

Comments
 (0)