Package ffx.algorithms.mc
Class BoltzmannMC
java.lang.Object
ffx.algorithms.mc.BoltzmannMC
- All Implemented Interfaces:
MetropolisMC
- Direct Known Subclasses:
MolecularMC,MonteCarloOST,RotamerMatrixMC
The BoltzmannMC abstract class is a skeleton for Boltzmann-weighted Metropolis Monte Carlo
simulations.
- Author:
- Michael J. Schnieders, Jacob M. Litman
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleacceptChance(double invKT, double e1, double e2) Boltzmann-weighted acceptance probabilityprotected abstract doubleMust return the current energy of the system.booleanevaluateMove(double e1, double e2) Returns true if the move from e1 to e2 is accepted.static booleanevaluateMove(Random random, double invKT, double e1, double e2) Boltzmann-weighted acceptance probabilitybooleanIf last step taken was a success.doublegetE1()Return starting energy from last attempted step.doublegetE2()Return trial energy from last attempted step.doubleReturns temperature of the Monte Carlo criterion.doubleReturns the energy as of the last step taken (not including any extra potential energy adjustments).booleanCalculates the current system energy and performs an MCMove.booleanPerforms an MCMove.booleanCalculates the current system energy and performs a series of moves sequentially as a single hybrid step.booleanPerforms a series of moves sequentially, as a single hybrid step.voidsetPrint(boolean print) Sets whether the implementation prints its own messages.protected voidsetRandomSeed(int randomSeed) Set the random seed.voidsetTemperature(double temp) Sets temperature of Monte Carlo criterion.protected abstract voidStore the state for reverting a move.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ffx.algorithms.mc.MetropolisMC
revertStep
-
Field Details
-
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 movee2- Proposed energy- Returns:
- Chance of accepting this move
-
evaluateMove
Boltzmann-weighted acceptance probability- Parameters:
random- Source of randomnessinvKT- 1.0 / (Boltzmann constant * temperature)e1- Energy before movee2- 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:
evaluateMovein interfaceMetropolisMC- Parameters:
e1- Initial energye2- Trial energy- Returns:
- If move accepted
-
getAccept
public boolean getAccept()If last step taken was a success.- Specified by:
getAcceptin interfaceMetropolisMC- Returns:
- Acceptance of last move
-
getE1
public double getE1()Return starting energy from last attempted step.- Specified by:
getE1in interfaceMetropolisMC- Returns:
- e1
-
getE2
public double getE2()Return trial energy from last attempted step.- Specified by:
getE2in interfaceMetropolisMC- Returns:
- e2
-
getTemperature
public double getTemperature()Returns temperature of the Monte Carlo criterion.- Specified by:
getTemperaturein interfaceMetropolisMC- Returns:
- temperature
-
setTemperature
public void setTemperature(double temp) Sets temperature of Monte Carlo criterion.- Specified by:
setTemperaturein interfaceMetropolisMC- 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:
lastEnergyin interfaceMetropolisMC- Returns:
- Last step's energy
-
mcStep
Calculates the current system energy and performs an MCMove.- Specified by:
mcStepin interfaceMetropolisMC- Parameters:
move- MCMove to perform- Returns:
- If move accepted
-
mcStep
Performs an MCMove.- Specified by:
mcStepin interfaceMetropolisMC- Parameters:
move- MCMove to performen1- Initial energy- Returns:
- If move accepted
-
mcStep
Calculates the current system energy and performs a series of moves sequentially as a single hybrid step.- Specified by:
mcStepin interfaceMetropolisMC- Parameters:
moves- MCMoves to perform- Returns:
- If move/moves accepted
-
mcStep
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:
mcStepin interfaceMetropolisMC- Parameters:
moves- MCMoves to performen1- Initial energy- Returns:
- If move/moves accepted.
-
setPrint
public void setPrint(boolean print) Sets whether the implementation prints its own messages.- Specified by:
setPrintin interfaceMetropolisMC- 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.
-