skillfed

pymbar

Python implementation of the multistate Bennett acceptance ratio (MBAR) method

pymbar v4.0.3 125.5K downloads/30d#11,814 on PyPI313
Permissive license MIT AGING released

What it is and what it does

pymbar is a Python library that implements the multistate Bennett acceptance ratio method, a statistical technique for analyzing molecular simulation data. It takes reduced potential matrices from equilibrium samples across multiple thermodynamic states and computes free energy differences between those states along with their uncertainties. The package also estimates expectation values for observables across all states, providing covariance matrices for error propagation.

The library is designed for computational chemistry and molecular dynamics workflows. It accepts reduced potential data (typically from molecular simulations), initializes an MBAR object, and provides methods to compute free energy differences and expectations with associated standard errors. It depends on numpy, scipy, and numexpr for numerical computation, and optionally uses JAX for acceleration if available.

Use it for:

  • Computing free energy differences between ligand-bound and unbound protein states in drug discovery
  • Analyzing alchemical transformation simulations to estimate binding affinities
  • Estimating thermodynamic properties and their uncertainties from parallel tempering or replica exchange simulations
  • Extracting equilibrium averages and covariance information from multi-state sampling experiments
  • Validating molecular simulation convergence by computing free energy estimates across different equilibration lengths

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pymbar implements the multistate Bennett acceptance ratio (MBAR) method to estimate free energy differences and expectation values from equilibrium samples across multiple thermodynamic states.

Yes, if you work with molecular simulations and need to analyze multi-state equilibrium data. The package is stable, has no known vulnerabilities, installs easily, and is widely used in computational chemistry. The aging maintenance status (876 days since release) is not a blocker—the last commit is recent and the core algorithm is mature—but verify that it meets your specific simulation software's version requirements before committing to a large analysis pipeline.

Install

pymbar on PyPI

pip

pip install pymbar

uv

uv add pymbar

poetry

poetry add pymbar

Installing pymbar

Before you install

Low friction install with pure Python wheels. The package is aging (876 days since last release) but remains actively maintained; last commit was 2026-02-12. Depends only on numpy, scipy, and numexpr—all stable, widely-available libraries.

License in practice

MIT license is permissive; you can use, modify, and distribute pymbar with minimal restrictions, making it suitable for both academic and commercial projects.

Quickstart

pip install pymbar

from pymbar import MBAR, testsystems

# Load test data: reduced potentials u_kn and sample counts N_k
x_n, u_kn, N_k, s_n = testsystems.HarmonicOscillatorsTestCase().sample()

# Initialize MBAR and compute free energy differences
mbar = MBAR(u_kn, N_k)
results = mbar.compute_free_energy_differences()

Requires Python >= 3.6. JAX acceleration is optional; the non-JAX version runs without it but may be slower. If using JAX, pymbar will enable 64-bit mode, which may conflict with other JAX code in the same process that requires 32-bit precision.

Verify before relying

  • Whether JAX acceleration is automatically enabled or requires explicit installation of the pymbar[jax] extra
  • Performance characteristics when analyzing large datasets or high-dimensional systems
  • Compatibility with recent versions of JAX given the 64-bit precision requirement mentioned in the description

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, scipy, numexpr
Maintenance aging — 876 days since the last release
Last repo commit
First released
Downloads 125,476/month — #11,814 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymbar-4.0.3-py3-none-any.whl

Keywords: molecular mechanics, forcefield, Bayesian parameterization

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

free energy calculationMBAR multistate Bennettthermodynamic analysismolecular simulation analysisequilibrium samplingfree energy differencesreduced potential analysis
molecular-dynamicsfree-energystatistical-analysis

More Scientific/Engineering packages