MonteCarlo¶
-
class
MonteCarlo
¶ MonteCarlo contains Trials which perturb the System by generating the probability of acceptance through Criteria that are accepted based on a Random number generator. Between trials, MonteCarlo also contains classes that Analyze or Modify.
Subclassed by feasst::Prefetch
Public Functions
Construct with Random number generator.
-
MonteCarlo
()¶ Construct a MonteCarlo object with RandomMT19937.
Set the random number generator.
-
void
seed_random
(const int seed)¶ Return the random number generator.
Seed random number generator.
-
void
add
(const Configuration &config)¶ The first action with a Monte Carlo object is to set the Configuration.
-
const Configuration &
configuration
(const int index = 0) const¶ The configuration may be accessed read-only.
The second action is to add Potentials.
Set an existing potential.
Add potential to optimized.
Add potential to reference.
Add NeighborCriteria.
The third action is to set the ThermoParams.
-
const ThermoParams &
thermo_params
() const¶ Return the ThermoParams.
-
void
set
(const System &system)¶ Alternatively, the first, second and third actions may be combined by setting the system directly. This must be done before setting Criteria.
-
double
initialize_system
()¶ Reinitialize the system. Return total energy.
The fourth action is to set the Criteria. Configuration and Potentials (or System) must be set first.
-
void
initialize_criteria
()¶ Initialize the criteria. Also initializes system.
The remaining actions can be done in almost any order. Typically, one begins by adding trials. Some Trials are simply TrialFactories containing multiple trials, such as TrialTransfer (factory of TrialAdd and TrialRemove). If a TrialFactory is added, flatten by adding individual trials instead. This means that add(MakeTrialTransfer()) will add both a TrialAdd and TrialRemove with weights equal to TrialFactory weight divided according to the weights of the individual trials. Thus, adding TrialTransfer with a weight of 4 will result in TrialAdd with weight of 2 and TrialRemove with weight of 2.
-
const TrialFactory &
trials
() const¶ Access the trials on a read-only basis.
-
void
initialize_trials
()¶ Initialize trials.
An Analyzer performs some task after a given number of steps, but is read-only on System, Criteria and Trials. At this stage, multistate non-factory classes are converted into factories for each state in criteria.
-
int
num_analyzers
() const¶ Return the number of analyzers.
-
void
initialize_analyzers
()¶ Initialize analyzers.
A Modifier performs some task after a given number of steps, but may change the System, Criteria and Trials.
-
int
num_modifiers
() const¶ Return the number of modifiers.
Add a checkpoint.
-
void
write_checkpoint
() const¶ Write checkpoint file.
-
void
attempt
(const int num_trials = 1)¶ Attempt one trial, with subsequent analysers and modifiers.
Attempt a number of Monte Carlo trials.
-
virtual void
reset_trial_stats
()¶ Reset trial statistics.
-
void
run_until_complete
()¶ Attempt Monte Carlo trials until Criteria returns completion. If available, automatically write checkpoint when complete.
-
bool
attempt_trial
(const int index)¶ Attempt trial index without analyzers, modifiers or checkpoints.