Free Energy Calculations

Estimates of free energy from work measurements.

All works and free energies are in multiples of kT. (i.e. nats)

Free Energy Estimates

thermoflow.free_energy_bar(work_f: ArrayLike, work_r: ArrayLike, weights_f: ArrayLike | None = None, weights_r: ArrayLike | None = None, uncertainty_method: str = 'BAR') Tuple[Array, Array]

Estimate a free energy difference using the Bennett Acceptance Ratio method (BAR).

Three methods for estimating the error are provided. The original ‘BAR’ method [1], which underestimates the error if the posterior is not Gaussian (this happens when there is little overlap between the forward and negative reverse work distributions and therefore the uncertainties are large); the ‘MBAR’ [3] approach which is optimal in the large sample limit, but overestimates the error when the posteriors are not Gaussian, and ‘logistic’, which is the MBAR error, but with a correction for non-overlapping work distributions.

Parameters:
  • work_f – Measurements of work from forward protocol.

  • work_r – Measurements of work from reverse protocol.

  • weights_f – Optional weights for forward works

  • weights_r – Optional weights for reverse works

  • uncertainty_method – Method to calculate errors (“BAR” [1], “MBAR”[3], or “Logistic”[4])

Returns:

Estimated free energy difference, and the estimated error

Refs:

???, ???, ???, ???

thermoflow.free_energy_bayesian(work_f: ArrayLike, work_r: ArrayLike) Tuple[Array, Array]

Bayesian free energy estimate

Parameters:
  • work_f – Measurements of work from forward protocol.

  • work_r – Measurements of work from reverse protocol.

Returns:

Posterior mean estimate of the free energy difference, and the estimated error

thermoflow.free_energy_logmeanexp(work_f: ArrayLike) Array

Calculate the free energy difference from a series of work measurements using the Jarzynski equality.

(Note that we can’t calculate an accurate error bounds for Jarzynski estimate using measurements from only a single protocol directions.)

Parameters:

work_f – Array of shape [N]

Returns:

Delta free energy

Ref:

TODO

thermoflow.free_energy_logmeanexp_gaussian(work_f: ArrayLike) Array

Calculate the free energy difference from a series of work measurements under the assumption that the work distributions is Gaussian.

Parameters:

work_f – Array of shape [N]

Returns:

Delta free energy

Ref:

TODO

Free Energy Estimates for symmetric protocols

thermoflow.free_energy_symmetric_bar(work_ab: ArrayLike, work_bc: ArrayLike, uncertainty_method: str = 'BAR') Tuple[Array, Array]

BAR for symmetric periodic protocols.

Parameters:
  • work_ab – Measurements of work from first half of protocol.

  • work_bc – Measurements of work from mirror image second half of protocol.

  • uncertainty_method – Method to calculate errors (BAR, MBAR, or Logistic)

Returns:

Estimated free energy difference to the middle point of the protocol, and an estimated error

thermoflow.free_energy_symmetric_bidirectional(work_ab: ArrayLike, work_bc: ArrayLike) Array

The bidirectional Minh-Chodera free energy estimate specialized to a symmetric protocol.

Delta F = (2/N) sum (e^W_ab + e^-W_bc)^-1)

Parameters:
  • work_ab – Measurements of work from first half of protocol.

  • work_bc – Measurements of work from mirror image second half of protocol.

Returns:

Estimate of the free energy