Estimators
Estimator implementations live in the alchemrs::estimators module.
The CLI currently exposes TI, BAR, MBAR, IEXP, DEXP, and NES. The library and Python bindings additionally expose UWHAM and ATM.
Shared assumptions
For UNkMatrix-based estimators, the current implementation assumes:
- consistent lambda-vector dimensionality across windows
- consistent evaluated-state grids across windows
sampled_stateis set and present inevaluated_states- state temperatures are consistent across all windows
lambda_labels, when present, are consistent across windows
If those invariants are violated, the estimators fail early.
TI
Types:
TiEstimatorTiFitTiOptionsIntegrationMethod::{Trapezoidal, Simpson, CubicSpline, Pchip, Akima, GaussianQuadrature}recommend_ti_method(...)TiMethodRecommendationTiMethodAssessmentTiMethodRecommendationOptions
Input:
- slice of
DhdlSeries
Behavior:
- sorts windows by lambda
- computes the mean
dH/dlambdafor each window - integrates across lambda using trapezoidal, Simpson, a natural cubic spline, PCHIP, Akima interpolation, or Gaussian quadrature
fit(...)returnsTiFitresult()materializes theFreeEnergyEstimate
Current uncertainty behavior:
- trapezoidal mode reports an uncertainty estimate
- Simpson mode reports an uncertainty estimate by propagating the Simpson-rule weights through the per-window SEMs
- cubic-spline mode reports an uncertainty estimate by propagating the implied spline-integration weights through the per-window SEMs
- PCHIP and Akima report an uncertainty estimate by numerically differentiating the integrated result with respect to the window means and propagating the per-window SEMs through that Jacobian
- Gaussian quadrature reports an uncertainty estimate from the quadrature weights and per-window SEMs
Interpolation references:
Pchipfollows the piecewise-cubic Hermite shape-preserving literature of Fritsch and Carlson, Monotone Piecewise Cubic Interpolation, SIAM Journal on Numerical Analysis 17(2), 1980, DOI: https://doi.org/10.1137/0717021, and Fritsch and Butland, A Method for Constructing Local Monotone Piecewise Cubic Interpolants, SIAM Journal on Scientific and Statistical Computing 5(2), 1984, DOI: https://doi.org/10.1137/0905021Akimafollows Akima, A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures, Journal of the ACM 17(4), 1970, DOI: https://doi.org/10.1145/321607.321609
Gaussian quadrature behavior:
- only supports one-dimensional lambda schedules
- only supports Gauss-Legendre schedules with
1..=16sampled windows - validates that the sampled lambdas match the supported quadrature nodes
- reports the free energy over the full
[0, 1]interval, soresult().from_state()islambda=0andresult().to_state()islambda=1even though the sampled windows are interior quadrature nodes
Method recommendation:
recommend_ti_method(...)lives inalchemrs::analysis- evaluates all currently supported TI methods on the same preprocessed
DhdlSeries - combines method eligibility, TI schedule diagnostics, monotonicity, and cross-method spread
- returns the recommended
IntegrationMethodplus per-method assessments and a human-readable rationale
BAR
Types:
BarEstimatorBarFitBarOptionsBarMethod::{FalsePosition, SelfConsistentIteration, Bisection}
Input:
- slice of
UNkMatrix
Behavior:
- expects windows mapped to sampled states on one evaluated-state grid
- computes work values between adjacent states
fit(...)returnsBarFitresult()materializes the full pairwiseDeltaFMatrix- preserves
lambda_labels()from the input windows when available
Uncertainty behavior:
- adjacent BAR uncertainties come from the BAR implicit-root equation via a delta-method linearization of the Fermi weights
- cumulative non-adjacent uncertainties include the neighboring-edge covariance induced by the shared intermediate window rather than assuming adjacent BAR edges are independent
MBAR
Types:
MbarEstimatorMbarOptions
Important options:
max_iterationstoleranceinitial_f_kparallelsolver
Default solver:
MbarSolver::Lbfgs- falls back to fixed-point automatically when the evaluated grid contains states with zero sampled counts, because the LBFGS objective requires positive sampled counts
- use
MbarSolver::FixedPointwhen reproducing older fixed-point results or comparing solver behavior
The MBAR L-BFGS solver path is inspired by the large-scale MBAR/UWHAM convex
optimization approach described by Ding, Vilseck, and Brooks in "Fast Solver for
Large Scale Multistate Bennett Acceptance Ratio Equations", Journal of Chemical
Theory and Computation 15, 799-802 (2019),
doi:10.1021/acs.jctc.8b01010.
UwhamEstimator has a separate solver implementation; its Newton and L-BFGS
backends are documented in the UWHAM section below.
Input:
- slice of
UNkMatrix
Behavior:
- combines windows into a shared reduced-energy representation
- solves for free energies iteratively
- returns an
MbarFitthat can derive aDeltaFMatrix, overlap diagnostics, and MBAR log weights without resolving the same window set - preserves
lambda_labels()from the input windows when available
Typical usage:
fit(...).result()fit(...).result_with_uncertainty()fit(...).overlap_matrix()fit(...).overlap_scalar()
The analysis layer uses MBAR-derived log weights to compute overlap diagnostics.
UWHAM
Types:
UwhamEstimatorUwhamFitUwhamOptionsUwhamSolver
Important options:
max_iterationstoleranceparallelsolver
Solver behavior:
UwhamSolver::Newtonis the default.UwhamSolver::Lbfgsis available as an experimental comparison backend.- Current synthetic benchmarks show the Newton backend remains faster for the tested UWHAM workloads, so L-BFGS is not the default.
Input:
- slice of
UNkMatrix
Behavior:
- pools all windows into log unnormalized densities (
log_q) - accepts positive infinity in
u_nkby mapping it to negative infinity inlog_q - solves the UWHAM equations on the pooled observations
fit(...)returnsUwhamFitresult()materializes aDeltaFMatrixresult_with_uncertainty()uses the analytical UWHAM covarianceweights(),covariance(), andvariances()expose fitted internals without rerunning the solvewrite_reference_inputs(...)exportslogQ.csv,size.csv,delta_f.csv,ze.csv, and metadata for cross-checking against external UWHAM implementations
ATM
Types:
AtmEstimatorAtmFitAtmOptionsAtmUncertaintyMethod::{Analytical, Bootstrap { .. }, None}AtmBindingEstimate
Input:
fit(...):AtmLogQMatrixfit_leg(...),estimate_leg(...),estimate_binding(...):AtmSampleSet
Behavior:
- converts ATM schedule/sample data into pooled
log_q - delegates the core statistical solve to the UWHAM implementation
result()onAtmFitreturns aDeltaFMatrixacross all ATM schedule statesleg_result()andestimate_leg(...)collapse that fit to one endpoint-to-endpointFreeEnergyEstimateestimate_binding(...),estimate_rbfe(...), andestimate_abfe(...)combine two opposite-direction legs and propagate leg uncertainties in quadrature- preserves ATM-derived lambda component labels when available
Uncertainty behavior:
Analyticaluses UWHAM covariance on the fitted legBootstrap { n_bootstrap, seed }is only available when starting fromAtmSampleSetNonesuppresses uncertainty reporting
IEXP and DEXP
Several different free energy methods utilize perturbation to estimate free energy differences, but when people say Free Energy Perturbation (FEP) they are typically referring to an exponential averaging scheme based on perturbing potential energies from one lambda state to another. This perturbation can take place in either the forward or the reverse direction. In accordance with Klimovich, Shirts, and Mobley's 2016 Guidelines for the analysis of free energy calculations, we define iexp as insertion exponential averaging, typically proceeding in the direction of decreasing entropy, and dexp as deletion exponential averaging, typically proceeding in the direction of increasing entropy.
Types:
IexpEstimatorIexpFitIexpOptions
Input:
- slice of
UNkMatrix
Behavior:
- computes pairwise adjacent exponential averaging along the lambda schedule
fit(...)returnsIexpFitresult()materializes the full pairwiseDeltaFMatrixresult_with_uncertainty()includes delta-method uncertainty estimates from the exponential weightsexp(-W)using an unbiased finite-sample variance- preserves
lambda_labels()from the input windows when available
CLI direction conventions:
iexpreports the forward directiondexpreports the reverse direction
DEXP is not a separate estimator type in the library; it is a CLI convention over the same estimator results.
NES
Types:
NesEstimatorNesFitNesOptions
Input:
- slice of
SwitchingTrajectory
Behavior:
- expects all trajectories to share the same initial and final states
- applies the Jarzynski equality to the reduced switching work values
fit(...)returnsNesFitresult()materializes a scalarFreeEnergyEstimate
Uncertainty behavior:
- analytic uncertainty is the default and is computed from the trajectory-level Jarzynski weights
exp(-W)with an unbiased finite-sample variance estimate - setting
NesOptions { n_bootstrap: N, .. }withN > 0switches to bootstrap uncertainty across trajectories
Parsing / workflow expectations:
- the intended CLI input is one AMBER nonequilibrium switching trajectory per file
- each trajectory contributes one reduced work value
- when present, the retained
lambda_pathanddvdl_pathsupport NES advisor diagnostics, but the estimator itself only needs the reduced work
Parallel execution
Some estimators support a parallel option and use Rayon-backed parallel loops internally to speed up calculations.
Common API shape
The estimator interfaces follow one shared pattern:
fit(...) -> Fitestimate(...) -> primary resultFit::result() -> primary result
Estimators with an explicit uncertainty split also expose estimate_with_uncertainty() and Fit::result_with_uncertainty().
ATM extends that shape with:
fit_leg(...)estimate_leg(...)estimate_binding(...)estimate_rbfe(...)estimate_abfe(...)