|
faunus
|
Class to handle Monte Carlo moves. More...
#include <montecarlo.h>
Classes | |
| struct | State |
| Class to describe a system state. More... | |
Public Member Functions | |
| MetropolisMonteCarlo (const json &j) | |
| Energy::Hamiltonian & | getHamiltonian () |
| Get Hamiltonian of accepted (default) state. | |
| Space & | getSpace () |
| Access to space in accepted (default) state. | |
| Space & | getTrialSpace () |
| Access to trial space. | |
| double | relativeEnergyDrift () |
| Relative energy drift from initial configuration. More... | |
| void | sweep () |
| Perform all moves (stochastic and static) More... | |
| void | restore (const json &j) |
| Restores system from previously store json object. More... | |
| ~MetropolisMonteCarlo () | |
| Required due to unique_ptr to incomplete type. | |
Static Public Member Functions | |
| static bool | metropolisCriterion (double energy_change) |
| Metropolis criterion. More... | |
Friends | |
| void | to_json (json &, const MetropolisMonteCarlo &) |
| Write information to JSON object. | |
Class to handle Monte Carlo moves.
This class maintains a list of MC moves and takes care of randomly selecting a move; perform the move; decides if the move is accepted; and checks if there is a drift in the potential energy.
The moves always operate on a trial state (new_state). If accepted, the changes will be copied into the old_state. The state here refers to the particle states (positions etc.), the simulation geometry (size, volume), and the state of the Hamiltonian (wave-vectors for Ewald etc.).
|
static |
Metropolis criterion.
| energy_change | Energy change, (new minus old) in units of kT |
| double Faunus::MetropolisMonteCarlo::relativeEnergyDrift | ( | ) |
Relative energy drift from initial configuration.
This is a powerful test that compares the final energy with the initial energy plus the accumulated list of changes.
Ideally this difference should be very small. If a MC move improperly captures the resulting energy change, a large drift will usually appear. This test has a minimal computational overhead as only the initial and final energies need to be calculated; the accumulated change is sampled during simulation for free.
| void Faunus::MetropolisMonteCarlo::restore | ( | const json & | j | ) |
Restores system from previously store json object.
| void Faunus::MetropolisMonteCarlo::sweep | ( | ) |
Perform all moves (stochastic and static)
This "sweeps" over all registered MC moves respecting, with the probability of picking a move given by Movebase::weight.
First stochastic moves are randomly picked and, if needed, repeated (randomly). Next, static moves are performed. Currently static moves are defined by setting weight=0.
weight to mark as move as static is ugly
1.8.13