mod free_energy¶
- module free_energy¶
Free-energy estimators (Bennett’s BAR + descendants).
BarEstimator: Bennett’s acceptance-ratio estimator for the free-energy differenceDelta F = F_B - F_Abetween two ensembles. The inputs use reduced energy differences, with inverse-temperature factors supplied for the two ensembles.Pure observable: takes the two energy series and returns
(Delta F, sigma^2). No kernel perturbation. The estimator is exposed as an observable so kernels can compare ensembles without changing the proposal or acceptance machinery.Structs and Unions
- struct BarEstimator¶
Bennett 1976 self-consistent free-energy estimator.
Given samples from ensembles
AandB,du_aisU_B - U_Aat points sampled from A, whiledu_bisU_B - U_Aat points sampled from B. The implementation multiplies these bybeta_aandbeta_b, respectively. This raw-difference representation is exact for a shared energy scale; for arbitrary reduced potentials, callers must construct the reduced differences themselves because this API cannot encode both cross energies. The BAR estimate solves the equality between the two Fermi sums, whereC = Delta F + log(N_A / N_B).- du_a: Vec<f64>¶
Samples of
U_B - U_Aevaluated at points drawn from A.
- du_b: Vec<f64>¶
Samples of
U_B - U_Aevaluated at points drawn from B.
- beta_a: f64¶
Inverse temperature multiplying the A-side difference.
- beta_b: f64¶
Inverse temperature multiplying the B-side difference.
Implementations
- impl BarEstimator¶
Functions
- fn new(du_a: Vec<f64>, du_b: Vec<f64>, beta_a: f64, beta_b: f64) -> Self¶
Constructs from cross-energy lists and inverse temperatures.
- fn solve(&self) -> (f64, f64)¶
Solves the BAR self-consistency by bisection. Returns the root
Cand the correspondingDelta F = C - log(N_A / N_B).
- fn variance(&self) -> f64¶
Asymptotic variance of the BAR estimator (Shirts/Chodera 2008). Returns the sample variance of
Delta F.