Class BoltzmannMC

java.lang.Object
ffx.algorithms.mc.BoltzmannMC
All Implemented Interfaces:
MetropolisMC
Direct Known Subclasses:
MolecularMC, MonteCarloOST, RotamerMatrixMC

public abstract class BoltzmannMC extends Object implements MetropolisMC
The BoltzmannMC abstract class is a skeleton for Boltzmann-weighted Metropolis Monte Carlo simulations.
Author:
Michael J. Schnieders, Jacob M. Litman
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Random
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    acceptChance(double invKT, double e1, double e2)
    Boltzmann-weighted acceptance probability
    protected abstract double
    Must return the current energy of the system.
    boolean
    evaluateMove(double e1, double e2)
    Returns true if the move from e1 to e2 is accepted.
    static boolean
    evaluateMove(Random random, double invKT, double e1, double e2)
    Boltzmann-weighted acceptance probability
    boolean
    If last step taken was a success.
    double
    Return starting energy from last attempted step.
    double
    Return trial energy from last attempted step.
    double
    Returns temperature of the Monte Carlo criterion.
    double
    Returns the energy as of the last step taken (not including any extra potential energy adjustments).
    boolean
    mcStep(MCMove move)
    Calculates the current system energy and performs an MCMove.
    boolean
    mcStep(MCMove move, double en1)
    Performs an MCMove.
    boolean
    mcStep(List<MCMove> moves)
    Calculates the current system energy and performs a series of moves sequentially as a single hybrid step.
    boolean
    mcStep(List<MCMove> moves, double en1)
    Performs a series of moves sequentially, as a single hybrid step.
    void
    setPrint(boolean print)
    Sets whether the implementation prints its own messages.
    protected void
    setRandomSeed(int randomSeed)
    Set the random seed.
    void
    setTemperature(double temp)
    Sets temperature of Monte Carlo criterion.
    protected abstract void
    Store the state for reverting a move.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ffx.algorithms.mc.MetropolisMC

    revertStep
  • Field Details

    • random

      protected final Random random
  • Constructor Details

    • BoltzmannMC

      public BoltzmannMC()
  • Method Details

    • acceptChance

      public static double acceptChance(double invKT, double e1, double e2)
      Boltzmann-weighted acceptance probability
      Parameters:
      invKT - 1.0 / (Boltzmann constant * temperature)
      e1 - Energy before move
      e2 - Proposed energy
      Returns:
      Chance of accepting this move
    • evaluateMove

      public static boolean evaluateMove(Random random, double invKT, double e1, double e2)
      Boltzmann-weighted acceptance probability
      Parameters:
      random - Source of randomness
      invKT - 1.0 / (Boltzmann constant * temperature)
      e1 - Energy before move
      e2 - Proposed energy
      Returns:
      Whether to accept the move.
    • evaluateMove

      public boolean evaluateMove(double e1, double e2)
      Returns true if the move from e1 to e2 is accepted. For molecular systems, this will mean accept if e2 is less than e1, or accept with probability of exp(-dU/kbT) if e2 is greater than e1.

      Criterion for accept/reject a move; intended to be used mostly internally.

      Specified by:
      evaluateMove in interface MetropolisMC
      Parameters:
      e1 - Initial energy
      e2 - Trial energy
      Returns:
      If move accepted
    • getAccept

      public boolean getAccept()
      If last step taken was a success.
      Specified by:
      getAccept in interface MetropolisMC
      Returns:
      Acceptance of last move
    • getE1

      public double getE1()
      Return starting energy from last attempted step.
      Specified by:
      getE1 in interface MetropolisMC
      Returns:
      e1
    • getE2

      public double getE2()
      Return trial energy from last attempted step.
      Specified by:
      getE2 in interface MetropolisMC
      Returns:
      e2
    • getTemperature

      public double getTemperature()
      Returns temperature of the Monte Carlo criterion.
      Specified by:
      getTemperature in interface MetropolisMC
      Returns:
      temperature
    • setTemperature

      public void setTemperature(double temp)
      Sets temperature of Monte Carlo criterion.
      Specified by:
      setTemperature in interface MetropolisMC
      Parameters:
      temp - a double.
    • lastEnergy

      public double lastEnergy()
      Returns the energy as of the last step taken (not including any extra potential energy adjustments).
      Specified by:
      lastEnergy in interface MetropolisMC
      Returns:
      Last step's energy
    • mcStep

      public boolean mcStep(MCMove move)
      Calculates the current system energy and performs an MCMove.
      Specified by:
      mcStep in interface MetropolisMC
      Parameters:
      move - MCMove to perform
      Returns:
      If move accepted
    • mcStep

      public boolean mcStep(MCMove move, double en1)
      Performs an MCMove.
      Specified by:
      mcStep in interface MetropolisMC
      Parameters:
      move - MCMove to perform
      en1 - Initial energy
      Returns:
      If move accepted
    • mcStep

      public boolean mcStep(List<MCMove> moves)
      Calculates the current system energy and performs a series of moves sequentially as a single hybrid step.
      Specified by:
      mcStep in interface MetropolisMC
      Parameters:
      moves - MCMoves to perform
      Returns:
      If move/moves accepted
    • mcStep

      public boolean mcStep(List<MCMove> moves, double en1)
      Performs a series of moves sequentially, as a single hybrid step. Should also work with single-member lists.

      Performs a Boltzmann-weighted Monte Carlo step with an arbitrary list of moves and a defined starting energy. The list of MCMoves should be of a type with O(1) element access, as the current implementation utilizes an indexed for loop.

      Specified by:
      mcStep in interface MetropolisMC
      Parameters:
      moves - MCMoves to perform
      en1 - Initial energy
      Returns:
      If move/moves accepted.
    • setPrint

      public void setPrint(boolean print)
      Sets whether the implementation prints its own messages.
      Specified by:
      setPrint in interface MetropolisMC
      Parameters:
      print - Print energies, accept/reject, etc.
    • setRandomSeed

      protected void setRandomSeed(int randomSeed)
      Set the random seed.
      Parameters:
      randomSeed - The seed.
    • currentEnergy

      protected abstract double currentEnergy()
      Must return the current energy of the system.
      Returns:
      Current system energy
    • storeState

      protected abstract void storeState()
      Store the state for reverting a move. Must be properly implemented for revertStep() to function properly; otherwise, the implementation of revertStep() should throw an OperationNotSupportedException.