Skip to main content

chemistrykit

Package PyPI version Python versions
Quality License CI Coverage Coverage (manual)
Documentation Docs
Code style Ruff
Downloads Downloads Downloads/Month
Community GitHub Stars GitHub Forks Contributors Last Commit

A unified numerical toolkit for computational chemistry, spanning the field end to end: Arrhenius kinetics and oscillating reaction networks, Huckel aromaticity and variational quantum chemistry, Nernst cells and Butler-Volmer electrochemistry, NMR multiplets and Franck-Condon spectra, crystal lattice energies and powder XRD, polymer chain statistics and photochemical quenching -- with each domain's docs tracing the field's own foundational breakthroughs in chronological, pedagogical order, every historical milestone linked directly to the runnable code that reproduces it. Pure-numerical throughout -- no cheminformatics dependencies (no RDKit/ASE/PySCF/OpenMM) -- sharing common ODE integrators, chemical constants, and a consistent NumPy-based API. Conventionally imported as ck. chemistrykit clones the architecture and engineering conventions of the sibling project physicskit (pk).

All 14 domains from chemistrykit-spec.md's build plan are implemented -- see Subpackages for the full list, or browse the docs at https://chemistrykit.readthedocs.io.

Install

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Quick start

import chemistrykit as ck
import numpy as np

# Closed-form first-order decay and its half-life
rate_law = ck.kinetics.FirstOrder(k=0.1, C0=1.0)
print(rate_law.half_life())  # ln(2) / k

# A general stoichiometric reaction network: A -> B -> C
network = ck.kinetics.StoichiometricNetwork.consecutive(k1=1.0, k2=0.3, A0=1.0)
result = network.integrate((0.0, 10.0), dt=1e-3, method="rk4")
print(result.concentration("B")[-1])

Subpackages

Domain subpackages, each with runnable examples linked below:

  • chemistrykit.kinetics -- reaction kinetics: integrated rate laws and half-lives, the Arrhenius equation and activation-energy fitting, Michaelis-Menten enzyme kinetics with Lineweaver-Burk linearization and inhibition, a general stoichiometry-matrix reaction-network engine (parallel/consecutive/reversible/steady-state-approximation chains), and the Brusselator oscillating reaction network.
  • chemistrykit.thermo -- chemical thermodynamics: equations of state (ideal gas, van der Waals, Redlich-Kwong), Clausius-Clapeyron phase boundaries, reaction equilibrium (Kp/Kc, van't Hoff, and a Gibbs-energy-minimization equilibrium-composition solver), and Raoult's/Henry's law mixtures with colligative properties.
  • chemistrykit.solutions -- solution chemistry: pH/pOH and weak acid/base equilibria with Henderson-Hasselbalch buffers, acid-base titration curves, Ksp solubility equilibria and the common-ion effect, and Debye-Huckel activity coefficients.
  • chemistrykit.md -- molecular dynamics and force fields: the Lennard-Jones fluid in reduced units (periodic boundary conditions, a Verlet neighbor list, pressure, g(r)), Morse/Buckingham/harmonic bonded potentials, and velocity-rescaling/Nose-Hoover thermostats.
  • chemistrykit.statmech -- statistical mechanics of molecules: translational/rotational/vibrational partition functions and their thermodynamic functions, the Maxwell-Boltzmann speed distribution, and a canonical-ensemble lattice-gas adsorption model.
  • chemistrykit.quantum -- quantum chemistry: particle-in-a-box models (with the free-electron model of conjugated-dye color); the quantum harmonic oscillator vs. the exact Morse potential; the rigid rotor; hydrogen-like orbitals; Huckel molecular-orbital theory and its 4n+2 aromaticity rule; a minimal variational treatment of H2+; and Rayleigh-Schrodinger perturbation theory for the anharmonic oscillator.
  • chemistrykit.spectro -- spectroscopy: the Beer-Lambert absorbance law and its stray-light deviation from linearity; rigid-rotor rotational spectra with isotope shifts; harmonic vs. Morse vibrational band positions plus a Wilson GF-matrix triatomic normal-mode calculation; Franck-Condon vibronic progressions; and a first-order NMR multiplet simulator.
  • chemistrykit.structure -- molecular structure and bonding: a lightweight Molecule container; VSEPR geometry prediction with real 3D coordinate generation; point-group determination from 3D coordinates and character tables; bond order from the Pauling length correlation and Huckel-theory MO coefficients; and formal-charge/oxidation-state assignment from a Lewis structure.
  • chemistrykit.electrochem -- electrochemistry: the Nernst equation for standard and concentration cells with Debye-Huckel activity corrections; a curated standard-reduction-potential table with redox-couple balancing; Butler-Volmer electrode kinetics and Tafel-plot linearization; galvanic vs. electrolytic cells and Faraday's laws of electrolysis; and a simplified constant-current battery discharge model with Peukert's-law rate dependence.
  • chemistrykit.photochem -- photochemistry: Jablonski-diagram excited-state kinetics built on chemistrykit.kinetics's reaction-network engine; fluorescence/phosphorescence quantum yields and the photochemical quantum yield via Beer-Lambert; Stern-Volmer quenching with a static-vs-dynamic diagnostic; and photostationary-state kinetics for a two-state photoswitch.
  • chemistrykit.surface -- surface chemistry and catalysis: Langmuir, Freundlich, and BET adsorption isotherms with their standard linearizations for fitting parameters from data; Langmuir-Hinshelwood single- and dual-site surface-reaction kinetics; and a turnover-frequency/rate-enhancement catalysis model built on chemistrykit.kinetics's Arrhenius equation.
  • chemistrykit.polymer -- polymer chemistry: ideal random-walk chain statistics and the Flory exponent for real chains under theta/good/poor solvent conditions; molecular-weight-distribution statistics and the closed-form Flory-Schulz distribution; step-growth kinetics via the Carothers equation; and chain-growth/free-radical polymerization kinetics built on chemistrykit.kinetics's reaction-network engine.
  • chemistrykit.crystal -- crystallography and solid-state chemistry: the 7 crystal systems and general unit-cell volume; hard-sphere packing (packing fraction, coordination number) for SC/BCC/FCC/HCP lattices; ionic-crystal lattice energy via the Born-Lande and Kapustinskii equations, backed by a genuinely converging (Evjen-method) numerical Madelung constant; Bragg's law and powder-XRD peak positions with structure factors and systematic absences; and Schottky/Frenkel point-defect equilibrium.
  • chemistrykit.analytical -- analytical chemistry: redox and complexometric (EDTA) titration-curve simulation with equivalence-point detection, alongside chemistrykit.solutions's acid-base titrations; chromatographic plate theory and the van Deemter equation (resolution, selectivity); linear-regression calibration curves with IUPAC-convention limits of detection/quantitation; and propagation-of-uncertainty formulas plus Dixon's Q-test for outlier rejection.

Shared infrastructure, used across the subpackages above rather than standalone toolkits:

  • chemistrykit.constants -- chemical constants (R, NA, k_B, Faraday's constant, ...) from scipy.constants, plus a small built-in periodic-table data table and a few well-defined unit conversions.
  • chemistrykit.integrators -- shared numerical ODE integrators (RK4, leapfrog, Yoshida4, adaptive Dormand-Prince) used across the other subpackages.

Test

Tests live alongside each subpackage, at chemistrykit/<name>/tests/.

pytest                                              # everything
pytest chemistrykit/kinetics/tests                  # a single subpackage

# docstring examples, across every subpackage:
MPLBACKEND=Agg pytest --doctest-modules chemistrykit \
    --ignore-glob="*/tests/*"

Both commands, plus ruff check/ruff format --check, run in CI on every PR (.github/workflows/ci.yml) across Python 3.9-3.12 on Linux and macOS. See CONTRIBUTING.md before opening a PR.

Coverage

MPLBACKEND=Agg pytest -q --cov=chemistrykit --cov-report=term

774 tests, 96% line coverage overall. Per-subpackage coverage:

Subpackage Coverage Subpackage Coverage
analytical 99% solutions 99%
crystal 99% spectro 99%
electrochem 99% statmech 99%
kinetics 93% structure 98%
md 89% surface 99%
photochem 95% thermo 99%
polymer 99% integrators 47%
quantum 98% constants 84%

visualizers/ modules are smoke-tested only (correct return type/shape, or that anim.save() succeeds) rather than covered line-by-line, per the testing convention in CLAUDE.md. integrators sits lower because several of its fixed-step/adaptive methods aren't exercised directly by its own tests, only indirectly through the subpackages (kinetics, md) that call into it; constants includes a few rarely-used unit-conversion helpers not hit by any test.

Docs

Built docs are hosted at https://cpoli.github.io/chemistrykit/, served from the gh-pages branch. To build locally:

pip install -e ".[docs]"
cd docs && make html

Citation

If you use chemistrykit in your research, please cite it — see CITATION.cff.

Contributing

See CONTRIBUTING.md. Please note that this project follows the Contributor Covenant.

License

MIT -- see LICENSE.

Release files for chemistrykit 0.1.0

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

Source distribution (sdist)

Source distribution for chemistrykit 0.1.0
File Size Uploaded
chemistrykit-0.1.0.tar.gz 312.4 kB Details

Built distribution (wheel)

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

Total release size: 729.2 kB

Release files / chemistrykit-0.1.0.tar.gz

Download URL chemistrykit-0.1.0.tar.gz
Size 312.4 kB
Tags Source
SHA-256 checksum
How to use checksums
972706ada13938849617e313e8c211a484b6fdf69ec9f51cffe3a1b7f8f668d9
BLAKE2b-256 checksum
How to use checksums
354f5bed50463494f0ea74494a60749913e6896ba629b1d249b477ef32759bbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / chemistrykit-0.1.0-py3-none-any.whl

Download URL chemistrykit-0.1.0-py3-none-any.whl
Size 416.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cec47fbe009a20e8626c05b201d951a9e6bd840d358c3b7c0bac01a92f5d9d19
BLAKE2b-256 checksum
How to use checksums
c0419733ad8277c5e08dd44ed0100d4c1e9279b14275640529322232e5d77b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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