pymbar
Python implementation of the multistate Bennett acceptance ratio (MBAR) method
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 pymbaruv
uv add pymbarpoetry
poetry add pymbarInstalling 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
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
alchemlybalchemlyb parses molecular dynamics simulation…
permissive · top 15,000 on PyPI
chempropChemprop trains and deploys message passing…
permissive · top 15,000 on PyPI
primer3-pyprimer3-py wraps the Primer3 library to provide…
copyleft · top 15,000 on PyPI
MDAnalysisMDAnalysis reads and analyzes molecular…
copyleft · top 15,000 on PyPI
nutpienutpie provides a fast NUTS sampler for…
permissive · top 15,000 on PyPI
numpyroNumPyro is a probabilistic programming library…
permissive · top 15,000 on PyPI
chemicalsRetrieves and calculates chemical properties…
permissive · top 15,000 on PyPI
pystanPyStan provides a Python interface to Stan for…
permissive · top 5,000 on PyPI
pdb2pqrPDB2PQR prepares protein structures from PDB…
permissive · top 15,000 on PyPI
emceeemcee implements affine-invariant ensemble…
permissive · top 5,000 on PyPI