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 with RandomMT19937.
-
void resume(const bool silent = false)
Resume processing the above arguments after Checkpointing.
-
void clear_arguments()
Clear arguments;.
Set the random number generator.
-
void seed_random(const int seed)
Seed random number generator.
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.
- param index:
Store different references by index.
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(const int config)
Reinitialize the system. Return total energy.
-
const TrialFactory &trial_factory() const
Return the trials.
-
const AnalyzeFactory &analyze_factory() const
Return the analyzers.
-
const ModifyFactory &modify_factory() const
Return the modifiers.
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.
Attempt one trial, with subsequent analysers and modifiers.
Perform an Action
-
void attempt(const int num_trials = 1)
Attempt a number of Monte Carlo trials.
-
virtual void reset_trial_stats()
Reset trial statistics.
-
virtual void run_until_num_particles(const int num_particles, const int particle_type, const int configuration_index)
Run until a number of particles is reached.
-
void run_until_complete()
Attempt Monte Carlo trials until Criteria returns completion. If available, automatically write checkpoint when complete.
-
virtual void run_until_file_exists(const std::string &file_name)
Attempt Monte Carlo trials until the given file name exists.
-
void set_cycles_to_complete(const int num)
Set the Criteria::cycles_to_complete.
-
bool attempt_trial(const int index)
Attempt trial index without analyzers, modifiers or checkpoints.
-
void set_parse_for_num_configs(const int num)
Set the number of configurations to parse simultaneously.
-
void set_parse_replace(const std::vector<std::vector<std::string>> &replace = {})
Set the parse replacements.
-
void set_replace_with_index(const std::string &str)
Set the parse replacement.
-
void set_timer()
Set the timer.
-
const TimerRDTSC *const timer() const
Return timer.