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

    • directionality

      public final Zwanzig.Directionality directionality
      Directionality of the Zwanzig estimation (forwards perturbation or backwards perturbation).
  • Constructor Details

    • Zwanzig

      public Zwanzig(double[] lambdaValues, double[][] eLambdaMinusdL, double[][] eLambda, double[][] eLambdaPlusdL, 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 eLambdaMinusdL[0] and eLambdaPlusdL[n-1] is expected to be all NaN.

      Parameters:
      lambdaValues - Lambda values for the samples.
      eLambdaMinusdL - Potential energies of state L at lambda L-dL. Ignored for forwards FEP.
      eLambda - Potential energies of state L at lambda L.
      eLambdaPlusdL - Potential energies of state 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
    • getTotalFreeEnergyDifference

      public double getTotalFreeEnergyDifference()
      Returns the total free energy difference between the first and last state.
      Specified by:
      getTotalFreeEnergyDifference in interface StatisticalEstimator
      Returns:
      Total free energy difference estimate.
    • getFreeEnergyDifferences

      public double[] getFreeEnergyDifferences()
      Gets the free energy difference between each pair of states.
      Specified by:
      getFreeEnergyDifferences in interface StatisticalEstimator
      Returns:
      Array of free energy differences between states.
    • getTotalFEDifferenceUncertainty

      public double getTotalFEDifferenceUncertainty()
      Returns the total uncertainty in the computed free energy difference between the first and last state.
      Specified by:
      getTotalFEDifferenceUncertainty in interface StatisticalEstimator
      Returns:
      Total uncertainty in the free energy difference.
    • getFEDifferenceUncertainties

      public double[] getFEDifferenceUncertainties()
      Gets the uncertainty in free energy difference between each pair of states.
      Specified by:
      getFEDifferenceUncertainties in interface StatisticalEstimator
      Returns:
      Array of uncertainties in the free energy differences.
    • getNumberOfBins

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

      public double getTotalEnthalpyDifference()
      Gets the total enthalpy difference between the first and last state.
      Specified by:
      getTotalEnthalpyDifference in interface StatisticalEstimator
      Returns:
      The enthalpy difference between each pair of states.
    • getEnthalpyDifferences

      public double[] getEnthalpyDifferences()
      Gets the enthalpy change between each pair of states.
      Specified by:
      getEnthalpyDifferences in interface StatisticalEstimator
      Returns:
      The enthalpy difference between each pair of states.