logo

Binder License Python 3.10+ Docs PyPI version

ugropy is a Python library to obtain subgroups from different thermodynamic group contribution models using both the name or the SMILES representation of a molecule. If the name is given, the library uses the PubChemPy library to obtain the SMILES representation from PubChem. In both cases, ugropy uses the RDKit library to search the functional groups in the molecule.

ugropy is in an early development stage, leaving issues of examples of molecules that ugropy fails solving the subgroups of a model is very helpful.

ugropy is tested for Python 3.10, 3.11 and 3.12 on Linux, Windows and Mac OS.

Try ugropy now

You can try ugropy from its Binder. Open the binder.ipynb file to explore the basic features.

Models supported v2.0.5

  • Classic liquid-vapor UNIFAC

  • Predictive Soave-Redlich-Kwong (PSRK)

  • Joback

Writers

ugropy allows you to convert the obtained functional groups or estimated properties to the input format required by the following thermodynamic libraries:

Example of use

You can check the full tutorial here.

Get groups from the molecule’s name:

from ugropy import Groups


hexane = Groups("hexane")

print(hexane.unifac.subgroups)
print(hexane.psrk.subgroups)
print(hexane.joback.subgroups)
{'CH3': 2, 'CH2': 4}
{'CH3': 2, 'CH2': 4}
{'-CH3': 2, '-CH2-': 4}

Get groups from molecule’s SMILES:

propanol = Groups("CCCO", "smiles")

print(propanol.unifac.subgroups)
print(propanol.psrk.subgroups)
print(propanol.joback.subgroups)
{'CH3': 1, 'CH2': 2, 'OH': 1}
{'CH3': 1, 'CH2': 2, 'OH': 1}
{'-CH3': 1, '-CH2-': 2, '-OH (alcohol)': 1}

Estimate properties with the Joback model!

limonene = Groups("limonene")

print(limonene.joback.subgroups)
print(f"{limonene.joback.critical_temperature} K")
print(f"{limonene.joback.vapor_pressure(176 + 273.15)} bar")
{'-CH3': 2, '=CH2': 1, '=C<': 1, 'ring-CH2-': 3, 'ring>CH-': 1, 'ring=CH-': 1, 'ring=C<': 1}
657.4486692170663 K
1.0254019428522743 bar

Visualize your results! (The next code creates the ugropy logo)

from IPython.display import SVG

mol = Groups("CCCC1=C(COC(C)(C)COC(=O)OCC)C=C(CC2=CC=CC=C2)C=C1", "smiles")

svg = mol.unifac.draw(
    title="ugropy",
    width=800,
    height=450,
    title_font_size=50,
    legend_font_size=14
)

SVG(svg)

Write down the Clapeyron.jl .csv input files.

from ugropy import writers

names = ["limonene", "adrenaline", "Trinitrotoluene"]

grps = [Groups(n) for n in names]

# Write the csv files into a database directory
writers.to_clapeyron(
    molecules_names=names,
    unifac_groups=[g.unifac.subgroups for g in grps],
    psrk_groups=[g.psrk.subgroups for g in grps],
    joback_objects=[g.joback for g in grps],
    path="database"
)

Obtain the Caleb Bell’s Thermo subgroups

from ugropy import unifac

names = ["hexane", "2-butanone"]

grps = [Groups(n) for n in names]

[writers.to_thermo(g.unifac.subgroups, unifac) for g in grps]
[{1: 2, 2: 4}, {1: 1, 2: 1, 18: 1}]

Installation

pip install ugropy

References

[1]

Published Parameters UNIFAC - DDBST GmbH — ddbst.com. http://www.ddbst.com/published-parameters-unifac.html. [Accessed 23-04-2024].

[2]

Juergen Gmehling, Peter Rasmussen, and Aage Fredenslund. Vapor-liquid equilibriums by UNIFAC group contribution. Revision and extension. 2. Industrial & Engineering Chemistry Process Design and Development, 21(1):118–127, January 1982. doi:10.1021/i200016a021.

[3]

Henrik K. Hansen, Peter Rasmussen, Aage Fredenslund, Martin Schiller, and Juergen Gmehling. Vapor-liquid equilibria by UNIFAC group contribution. 5. Revision and extension. Industrial & Engineering Chemistry Research, 30(10):2352–2355, October 1991. doi:10.1021/ie00058a017.

[4]

Eugenia Almeida Macedo, Ulrich Weidlich, Juergen Gmehling, and Peter Rasmussen. Vapor-liquid equilibriums by UNIFAC group contribution. Revision and extension. 3. Industrial & Engineering Chemistry Process Design and Development, 22(4):676–678, October 1983. doi:10.1021/i200023a023.

[5]

Steen Skjold-Jorgensen, Barbel Kolbe, Jurgen Gmehling, and Peter Rasmussen. Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and Extension. Industrial & Engineering Chemistry Process Design and Development, 18(4):714–722, October 1979. doi:10.1021/i260072a024.

[6]

Detlef Tiegs, Peter Rasmussen, Juergen Gmehling, and Aage Fredenslund. Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and extension. Industrial & Engineering Chemistry Research, 26(1):159–161, January 1987. doi:10.1021/ie00061a030.

[7]

Roland Wittig, Jürgen Lohmann, and Jürgen Gmehling. Vapor-Liquid Equilibria by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & Engineering Chemistry Research, 42(1):183–188, January 2003. doi:10.1021/ie020506l.

[8]

T. Holderbaum and J. Gmehling. PSRK: A Group Contribution Equation of State Based on UNIFAC. Fluid Phase Equilibria, 70(2-3):251–265, December 1991. doi:10.1016/0378-3812(91)85038-V.

[9]

Sven Horstmann, Anna Jabłoniec, Jörg Krafczyk, Kai Fischer, and Jürgen Gmehling. PSRK group contribution equation of state: comprehensive revision and extension IV, including critical constants and α-function parameters for 1000 components. Fluid Phase Equilibria, 227(2):157–164, January 2005. doi:10.1016/j.fluid.2004.11.002.

[10]

Kevin G Joback. Designing Molecules Possessing Desired Physical Property Values. Thesis (Ph. D.), Massachusetts Institute of Technology, Cambridge, Massachusetts, 1989.

[11]

K.G. Joback and R.C. Reid. ESTIMATION OF PURE-COMPONENT PROPERTIES FROM GROUP-CONTRIBUTIONS. Chemical Engineering Communications, 57(1-6):233–243, July 1987. doi:10.1080/00986448708960487.

Indices and tables