Skip to main content

logo

Open In Colab License Python 3.12+ Docs PyPI version Powered by RDKit

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 tested for Python 3.12, 3.13 and 3.14 on Linux, Windows and Mac OS.

You can access the documentation here: https://ipqa-research.github.io/ugropy/

Try ugropy now

You can try ugropy without installing it by clicking on the Colab badge.

You can install ugropy by:

pip install ugropy

Citing ugropy

ugropy now has an article! If you use ugropy in your research, please cite:

@article{brandolin2025ugropy,
  title={Ugropy: An Extensible Python Package for Thermodynamic Model Functional Group Identification via Mathematical Optimization},
  author={Brandol{\'\i}n, Salvador E and Benelli, Federico E and Magario, Ivana and Scilipoti, Jos{\'e} A},
  journal={Industrial \& Engineering Chemistry Research},
  volume={64},
  number={35},
  pages={17217--17227},
  year={2025},
  publisher={ACS Publications},
  doi = {10.1021/acs.iecr.5c02552}
}

Check the publication here.

Models implemented

Gibbs / EoS models

  • Classic liquid-vapor UNIFAC
  • Predictive Soave-Redlich-Kwong (PSRK)
  • Dortmund (modified UNIFAC)

Property estimators

  • Joback
  • Abdulelah-Gani (beta)

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

Here is a little taste of ugropy, please, check the full tutorial here to see all it has to offer!

Get groups from the molecule's name:

from ugropy import Groups


hexane = Groups("hexane")

print(hexane.unifac.subgroups)
print(hexane.psrk.subgroups)
print(hexane.dortmund.subgroups)
print(hexane.joback.subgroups)
print(hexane.agani.primary.subgroups)
{'CH3': 2, 'CH2': 4}
{'CH3': 2, 'CH2': 4}
{'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.dortmund.subgroups)
print(propanol.joback.subgroups)
print(propanol.agani.primary.subgroups)
{'CH3': 1, 'CH2': 2, 'OH': 1}
{'CH3': 1, 'CH2': 2, 'OH': 1}
{'CH3': 1, 'CH2': 2, 'OH (P)': 1}
{'-CH3': 1, '-CH2-': 2, '-OH (alcohol)': 1}
{'CH3': 1, 'CH2': 2, 'OH': 1}

Estimate properties with the Joback and Abdulelah-Gani models!

limonene = Groups("limonene")

print(limonene.joback.subgroups)
print(f"{limonene.joback.critical_temperature}")
print(f"{limonene.joback.vapor_pressure(176 + 273.15)}")
{'-CH3': 2, '=CH2': 1, '=C<': 1, 'ring-CH2-': 3, 'ring>CH-': 1, 'ring=CH-': 1, 'ring=C<': 1}
657.4486692170663 kelvin
1.0254019428522743 bar
print(limonene.agani.primary.subgroups)
print(limonene.agani.secondary.subgroups)
print(limonene.agani.tertiary.subgroups)
print(f"{limonene.agani.critical_temperature}")
print(limonene.agani.molecular_weight / limonene.agani.liquid_molar_volume)
{'CH3': 2, 'CH2=C': 1, 'CH2 (cyclic)': 3, 'CH (cyclic)': 1, 'CH=C (cyclic)': 1}
{'CH3-CHm=CHn (m,n in 0..2)': 1, '(CHn=C)cyc-CH3 (n in 0..2)': 1, 'CHcyc-C=CHn (n in 1..2)': 1}
{}
640.1457030826214 kelvin
834.8700605718585 gram / liter

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

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

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

ugropy can obtain multiple solutions, even nonoptimal ones if desired. For example:

from ugropy import unifac


solutions = unifac.get_groups(
    "9,10-dihydroanthracene",
    search_multiple_solutions=True,
    search_nonoptimal=True
)

for sol in solutions:
    print(sol.subgroups)
{'ACH': 8, 'AC': 2, 'ACCH2': 2}
{'CH2': 1, 'ACH': 8, 'AC': 3, 'ACCH2': 1}
{'CH2': 2, 'ACH': 8, 'AC': 4}

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 and yaeos API Python subgroups

from ugropy import unifac

names = ["hexane", "ethanol"]

grps = [unifac.get_groups(n) for n in names]

groups_numbers = [g.subgroups_num for g in grps]

print(groups_numbers)
[{1: 2, 2: 4}, {1: 1, 2: 1, 14: 1}]

Metadata

Release files for ugropy 3.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ugropy 3.2.6
File Size Uploaded Provenance Actions
ugropy-3.2.6.tar.gz 101.9 kB Without provenance Details for ugropy-3.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ugropy 3.2.6
File Interpreter ABI Platform Actions
ugropy-3.2.6-py3-none-any.whl Python 3 none any Details for ugropy-3.2.6-py3-none-any.whl

Total release size: 224.8 kB

Release files / ugropy-3.2.6.tar.gz

Download URL ugropy-3.2.6.tar.gz
Size 101.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e7982d8aed2811855e004a83c18344391ac40a8480b6096e1d6db351d74f822f
BLAKE2b-256 checksum
How to use checksums
15f896174f9a3029924411fc48805797c826aa75d6fb77793536176273575f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / ugropy-3.2.6-py3-none-any.whl

Download URL ugropy-3.2.6-py3-none-any.whl
Size 122.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26c9af3b0fd0b93f7b43b70d44ae26aab0f4ece4b522ffa9ab702a81ac11a71b
BLAKE2b-256 checksum
How to use checksums
68bb49d2ba53bf1a972fa87b4ab7d7eac29f77f776be03c73e8b152e83aeac41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for ugropy 3.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page