Skip to main content

pyglenn — Thermochemical Properties Calculator

CI Docs License: MIT

Computes Cp(T), H°(T), S°(T) from NASA polynomial coefficients stored in a SQLite database, converted from FORTRAN thermo.inp files.

Author: Dr. Reginaldo G. Leão Jr. — prof.reginaldo.leao@gmail.com

📖 Documentation: profleao.github.io/pyglenn

Features

  • Parse NASA-format thermo.inp (FORTRAN Appendix C) → SQLite3 database
  • Query species by name, phase, molecular weight
  • Calculate Cp(T), H°(T), S°(T) at any valid temperature
  • Enthalpy of formation lookup
  • Enthalpy change between two temperatures
  • Command-line interface
  • ~2030 species, 3772 temperature intervals

Installation

From PyPI (pip)

pip install pyglenn

From source

git clone https://github.com/ProfLeao/pyglenn.git
cd pyglenn
pip install .

Conda

conda install conda-forge::pyglenn

Quick Start

The database is bundled with the package — no manual build step needed.

Python API

from pyglenn import ThermochemicalCalculator

# No need to specify a DB file — uses the bundled thermo.db
calc = ThermochemicalCalculator()
calc.connect()

# Find O2 (exact match — returns only O2, not Be3N2 or Al2O2)
species = calc.get_available_species('O2', exact_match=True)
o2 = species[0]

# Calculate properties at 1000 K
props = calc.calculate_properties(o2['id'], 1000.0)
print(f"Cp = {props['cp']:.2f} J/(mol·K)")
print(f"H° = {props['h_relative']:.1f} J/mol")
print(f"S° = {props['s']:.3f} J/(mol·K)")

calc.close()

Or use the context manager for automatic cleanup:

from pyglenn import ThermochemicalCalculator

with ThermochemicalCalculator() as calc:
    # exact_match=True guarantees the correct species (case-insensitive)
    species = calc.get_available_species('CH4', exact_match=True)
    props = calc.calculate_properties(species[0]['id'], 500.0)
    print(f"Cp = {props['cp']:.2f} J/(mol·K)")

CLI

pyglenn query -s O2

Rebuilding the database

Only needed if the database is corrupted or you modify thermo.inp manually:

pyglenn build -i thermo.inp -o thermo.db

Database Structure

Table Description
species Chemical species (name, formula, phase, MW, ΔH°f)
temperature_intervals Valid T ranges per species
coefficients NASA-7 polynomial coefficients (a1–a7, b1, b2)
file_metadata Global file metadata

Citing

If you use pyglenn in your research, please cite it as:

@software{goncalves_leao_junior_2026_21324586,
  author    = {Gonçalves Leão Junior, Reginaldo},
  title     = {pyglenn: A Python Toolkit for Thermochemical
               Properties Calculation from NASA Polynomials},
  month     = jul,
  year      = 2026,
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.21324586},
  url       = {https://doi.org/10.5281/zenodo.21324586},
}

Requirements

  • Python ≥ 3.9
  • SQLite3 (stdlib)

License

MIT — see LICENSE file.

Metadata

Release files for pyglenn 0.1.12

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

Source distribution (sdist)

Source distribution for pyglenn 0.1.12
File Size Uploaded
pyglenn-0.1.12.tar.gz 770.1 kB Details

Built distribution (wheel)

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

Total release size: 1.5 MB

Release files / pyglenn-0.1.12.tar.gz

Download URL pyglenn-0.1.12.tar.gz
Size 770.1 kB
Tags Source
SHA-256 checksum
How to use checksums
627b43071954b6c9a84d80fce617785062b075145d47641306d2dd5e8c1130cf
BLAKE2b-256 checksum
How to use checksums
9aa9bcc9ef772c4333444692473c5ab4f42d602940f6b7affe5ac3dec79f5868
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyglenn-0.1.12-py3-none-any.whl

Download URL pyglenn-0.1.12-py3-none-any.whl
Size 775.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2669612fba9b14199771ff44cd6a7bab37668fe42bbb657cd8e43f5f2a0897fd
BLAKE2b-256 checksum
How to use checksums
63c62ad706e0619ebe2c4face72ef2c6241fd6b505791e6e8f0ecbc48f3b509e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
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