Skip to main content

Get UNIFAC functional groups of PubChem compounds or SMILES representation.

Project description

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.

Try ugropy now

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

Models supported v2.0.0

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

Writers

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

Refereces

[1] http://www.ddbst.com/published-parameters-unifac.html

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

[3] Joback, K. G. (1989). Designing molecules possessing desired physical property values [Thesis (Ph. D.), Massachusetts Institute of Technology]. https://dspace.mit.edu/handle/1721.1/14191

[4] Bondi, A. (1966). Estimation of Heat Capacity of Liquids. Industrial & Engineering Chemistry Fundamentals, 5(4), 442–449. https://doi.org/10.1021/i160020a001

[5] Rowlinson, J. S., & Swinton, F. (2013). Liquids and liquid mixtures: Butterworths monographs in chemistry. Butterworth-Heinemann

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ugropy-2.0.0.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ugropy-2.0.0-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file ugropy-2.0.0.tar.gz.

File metadata

  • Download URL: ugropy-2.0.0.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for ugropy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e729d04c5100d9a967e3558c513f433e288983cc912c97beebc8b16d66044af1
MD5 da8285111e402538da74d9bec16b5be1
BLAKE2b-256 f86f6bfbdeea1ce1a609135e3647b45f61509faca57c028b78d08e24e68a6245

See more details on using hashes here.

File details

Details for the file ugropy-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ugropy-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 51.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for ugropy-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a16ebc6d30e05f4f40a681116ec82ac8574e7a6e88df4a96b17ed20a8ee2cf7
MD5 846225df06720b1fcae09c688d3ed7b7
BLAKE2b-256 f7eebffc269f626ba2f329ad4f3b6de69377a383a7c7f895ca836615b5cfa3a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page