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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
acceptChance
(double invKT, double e1, double e2) Boltzmann-weighted acceptance probabilityprotected 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 probabilityboolean
If last step taken was a success.double
getE1()
Return starting energy from last attempted step.double
getE2()
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
Calculates the current system energy and performs an MCMove.boolean
Performs an MCMove.boolean
Calculates the current system energy and performs a series of moves sequentially as a single hybrid step.boolean
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
-
-
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:
evaluateMove
in interfaceMetropolisMC
- Parameters:
e1
- Initial energye2
- Trial energy- Returns:
- If move accepted
-
getAccept
public boolean getAccept()If last step taken was a success.- Specified by:
getAccept
in interfaceMetropolisMC
- Returns:
- Acceptance of last move
-
getE1
public double getE1()Return starting energy from last attempted step.- Specified by:
getE1
in interfaceMetropolisMC
- Returns:
- e1
-
getE2
public double getE2()Return trial energy from last attempted step.- Specified by:
getE2
in interfaceMetropolisMC
- Returns:
- e2
-
getTemperature
public double getTemperature()Returns temperature of the Monte Carlo criterion.- Specified by:
getTemperature
in interfaceMetropolisMC
- Returns:
- temperature
-
setTemperature
public void setTemperature(double temp) Sets temperature of Monte Carlo criterion.- Specified by:
setTemperature
in 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:
lastEnergy
in interfaceMetropolisMC
- Returns:
- Last step's energy
-
mcStep
Calculates the current system energy and performs an MCMove.- Specified by:
mcStep
in interfaceMetropolisMC
- Parameters:
move
- MCMove to perform- Returns:
- If move accepted
-
mcStep
Performs an MCMove.- Specified by:
mcStep
in 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:
mcStep
in 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:
mcStep
in 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:
setPrint
in 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.
-