Skip to main content

A Python toolkit for estimating thermodynamic properties

Project description

🧪 PyThermoEst

PyPI Downloads PyPI Python Version License

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.

📦 Installation

pip install pyThermoEst

🚀 Usage

The package exposes convenience helpers in pyThermoEst.app for both calculation workflows. See the examples/ directory for runnable scripts.

🧬 Joback property estimation

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.

from pyThermoEst import joback_calc
from pyThermoEst.models import JobackGroupContributions, GroupUnit

payload = {
    "-CH3": GroupUnit(value=2),
    "=CH- @ring": GroupUnit(value=3),
    "=C< @ring": GroupUnit(value=3),
    "-OH @phenol": GroupUnit(value=1),
}

joback_groups = JobackGroupContributions(**payload)

# or dict with aliases:
# joback_groups = {
#     "-CH3": 2,
#     "=CH- @ring": 3,
#     "=C< @ring": 3,
#     "-OH @phenol": 1,
# }

result = joback_calc(groups=joback_groups, total_atoms_number=18)

# Evaluate a temperature-dependent property, e.g., heat capacity at 273 K
cp_273 = result["heat_capacity"]["value"](273)
print(cp_273)

💧 Zabransky–Ruzicka liquid heat capacity

To compute liquid heat capacity, provide required group contributions and optional correction terms, then call zabransky_ruzicka_calc.

from pyThermoEst import zabransky_ruzicka_calc
from pyThermoEst.models import (
    ZabranskyRuzickaGroupContributions,
    ZabranskyRuzickaGroupContributionsCorrections,
    GroupUnit,
)

payload = {
    "C-(H)3(O)": GroupUnit(value=2),
    "CO-(O)2": GroupUnit(value=1),
    "O-(C)(CO)": GroupUnit(value=2),
}

contributions = ZabranskyRuzickaGroupContributions(**payload)
corrections = ZabranskyRuzickaGroupContributionsCorrections()

# or dicts with aliases:
# contributions = {
#     "C-(H)3(O)": 2,
#     "CO-(O)2": 1,
#     "O-(C)(CO)": 2,
# }

result = zabransky_ruzicka_calc(
    group_contributions=contributions,
    group_corrections=corrections
)
cp_liq_at_300k = result["value"](298.15)
print(cp_liq_at_300k, result["unit"], result["symbol"])

📚 Getting group contribution IDs and names

You can inspect available group contribution identifiers and names for each method:

🧬 Joback group contributions

from pyThermoEst.docs.joback import (
    joback_group_contribution_info,
    joback_group_contribution_names,
    joback_group_contribution_ids
)

# Get all group contribution IDs (aliases)
group_ids = joback_group_contribution_ids()

# Get all group contribution names (field names)
group_names = joback_group_contribution_names()

# Get both names and IDs as tuples
names, ids = joback_group_contribution_info()

💧 Zabransky–Ruzicka group contributions

from pyThermoEst.docs.zabransky_ruzicka import (
    zabransky_ruzicka_group_contribution_info,
    zabransky_ruzicka_group_contribution_names,
    zabransky_ruzicka_group_contribution_ids,
    zabransky_ruzicka_group_correction_info,
    zabransky_ruzicka_group_correction_ids,
    zabransky_ruzicka_group_correction_names
)

# Get group contribution IDs (aliases)
group_ids = zabransky_ruzicka_group_contribution_ids()

# Get group contribution names (field names)
group_names = zabransky_ruzicka_group_contribution_names()

# Get both names and IDs as tuples
names, ids = zabransky_ruzicka_group_contribution_info()

# Get correction term IDs
correction_ids = zabransky_ruzicka_group_correction_ids()

# Get correction term names
correction_names = zabransky_ruzicka_group_correction_names()

# Get both correction names and IDs as tuples
corr_names, corr_ids = zabransky_ruzicka_group_correction_info()

📖 Further examples

  • examples/joback-exp-0.py: Inspect available Joback group IDs and names.
  • examples/joback-exp-1.py: Build Joback group payloads with field names or aliases.
  • examples/joback-exp-2.py: Full Joback calculation including temperature evaluation.
  • examples/zabransky-ruzicka-exp-0.py: Inspect available Zabransky–Ruzicka group IDs, names, and corrections.
  • examples/zabransky-ruzicka-exp-1.py: Zabransky–Ruzicka calculation with optional corrections.

🔧 API reference

  • pyThermoEst.app.joback_calc(groups, total_atoms_number): Runs Joback method and returns calculated properties.
  • pyThermoEst.app.zabransky_ruzicka_calc(group_contributions, group_corrections=None): Returns an equation for liquid heat capacity plus units and symbol metadata.

Each function accepts either the pydantic models or plain dictionaries keyed by group identifiers; aliases are supported for convenience.

📝 License

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.

❓ FAQ

For any question, contact me on LinkedIn

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

pythermoest-0.1.1.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

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

pythermoest-0.1.1-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file pythermoest-0.1.1.tar.gz.

File metadata

  • Download URL: pythermoest-0.1.1.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for pythermoest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1d7cb14c17c474df523e0dee4311af1e5f8fbc84d883614f269560550af495ca
MD5 6c4985d6eacbe45b208c97624d4ae681
BLAKE2b-256 9cc2ecd1e8c3e70c7efc274bdbda6a3b4fe9dd3d31adda2a4b339641f9f0a5b8

See more details on using hashes here.

File details

Details for the file pythermoest-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pythermoest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53ceb4f24a743d940e0abe0806899e854320569159ff7e74bee167e3766791a9
MD5 13dc0a4428e7ed7f96cf5e6e381cc8a6
BLAKE2b-256 cbe40f6f0f2f6cdb444574115b2126cb2c748697e94270a7cfe34a032c8eb0e7

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