Class Zwanzig

All Implemented Interfaces:
BootstrappableEstimator, StatisticalEstimator

public class Zwanzig extends SequentialEstimator implements BootstrappableEstimator
The Zwanzig class implements exponential averaging/free energy perturbation using the Zwanzig relationship, in either the forwards or backwards direction (not both).
Since:
1.0
Author:
Michael J. Schnieders, Jacob M. Litman
  • Field Details

  • Constructor Details

    • Zwanzig

      public Zwanzig(double[] lambdaValues, double[][] energiesLow, double[][] energiesAt, double[][] energiesHigh, double[] temperature, Zwanzig.Directionality directionality)
      Estimates a free energy using the Zwanzig relationship. The temperature array can be of length 1 if all elements are meant to be the same temperature.

      The first dimension of the energies arrays corresponds to the lambda values/windows. The second dimension (can be of uneven length) corresponds to potential energies of snapshots sampled from that lambda value, calculated either at that lambda value, the lambda value below, or the lambda value above. The arrays energiesLow[0] and energiesHigh[n-1] is expected to be all NaN.

      Parameters:
      lambdaValues - Values of lambda dynamics was run at.
      energiesLow - Potential energies of trajectory L at lambda L-dL. Ignored for forwards FEP.
      energiesAt - Potential energies of trajectory L at lambda L.
      energiesHigh - Potential energies of trajectory L at lambda L+dL. Ignored for backwards FEP.
      temperature - Temperature each lambda window was run at (single-element indicates identical temperatures).
      directionality - Forwards vs. backwards FEP.
  • Method Details

    • copyEstimator

      public Zwanzig copyEstimator()
      Return a copy of this Estimator. Each implementation should specify its own type as the return type. Intended to make parallelization of bootstrapping easy.
      Specified by:
      copyEstimator in interface BootstrappableEstimator
      Returns:
      A copy of this Estimator.
    • estimateDG

      public final void estimateDG(boolean randomSamples)
      Re-calculates free energy and enthalpy.
      Specified by:
      estimateDG in interface BootstrappableEstimator
      Parameters:
      randomSamples - Whether to draw random samples with replacement (one bootstrap trial).
    • estimateDG

      public final void estimateDG()
      Re-calculates free energy and enthalpy without bootstrapping.
      Specified by:
      estimateDG in interface BootstrappableEstimator
    • getBinEnergies

      public double[] getBinEnergies()
      Gets the free energy change per bin/window.
      Specified by:
      getBinEnergies in interface StatisticalEstimator
      Returns:
      Individual bin/window free energy changes.
    • getBinUncertainties

      public double[] getBinUncertainties()
      Gets the uncertainty in free energy associated with each bin/window.
      Specified by:
      getBinUncertainties in interface StatisticalEstimator
      Returns:
      Individual bin/window uncertainties.
    • getFreeEnergy

      public double getFreeEnergy()
      Returns the estimated free energy (usually in kcal/mol).
      Specified by:
      getFreeEnergy in interface StatisticalEstimator
      Returns:
      Free energy estimate.
    • getUncertainty

      public double getUncertainty()
      Returns the uncertainty in the free energy estimate.
      Specified by:
      getUncertainty in interface StatisticalEstimator
      Returns:
      Uncertainty in the free energy estimate.
    • numberOfBins

      public int numberOfBins()
      Returns the number of windows (BAR, etc), bins (WHAM, etc), or other sub-values used to compute free energy.
      Specified by:
      numberOfBins in interface StatisticalEstimator
      Returns:
      Total number of sub-values used to compute free energy.
    • getBinEnthalpies

      public double[] getBinEnthalpies()
      Gets the enthalpy per bin/window.
      Specified by:
      getBinEnthalpies in interface StatisticalEstimator
      Returns:
      Individual bin/window enthalpy.