Criteria
-
class Criteria
Determine whether to accept or reject a trial. Stores the total energy based on energy changes from each trial.
Subclassed by feasst::AlwaysReject, feasst::FlatHistogram, feasst::MayerSampling, feasst::Metropolis
Public Functions
Same as above, but also add a constraint.
Add a constraint.
-
bool is_allowed(const System &system, const Acceptance &acceptance)
Return whether constraints are statisfied.
-
virtual bool is_accepted(const System &system, Acceptance *acceptance, Random *random) = 0
Return whether or not the trial attempt should be accepted.
-
bool was_accepted() const
Return whether or not the last trial attempt was accepted.
-
void set_current_energy(const double energy, const int config = 0)
Set the current total energy based on energy changes per trial in order to avoid recomputation of the energy of the entire configuration. For example, Metropolis Monte Carlo trials are concerned with the change in energy, and this variable tracks the total from the changes.
-
double current_energy(const int config = 0) const
Return the current total energy based on energy changes per trial.
-
void set_current_energy_profile(const std::vector<double> &energy, const int config = 0)
Same as above, except for energy profiles instead of total energy.
-
const std::vector<double> ¤t_energy_profile(const int config = 0) const
Return the current energy profile based on energy changes per trial.
-
void update_current_energy(const Acceptance &acceptance)
Update the current energy.
-
std::string status_header(const System &system) const
Return the header of the status for periodic output.
-
std::string status(const bool max_precision) const
Return the brief status for periodic output.
-
virtual std::string write() const
Return a human-readable output of all data (not as brief as status).
-
virtual int phase() const
Return the simulation phase index used to differentiate production and initialization, etc.
-
virtual void increment_phase()
Increment the simulation phase.
-
virtual int num_iterations_to_complete() const
Return the number of iterations for a simulation to be complete. Iterations are defined by the Derived class. For example, one Metropolis iteration is 1000 trials. FlatHistogram iterations depend on the Bias. For TransitionMatrix, one iteration is a sweep.
-
virtual void set_num_iterations_to_complete(const int num)
Set the number of iterations for a simulation to be complete.
-
virtual int num_iterations(const int state = -1) const
Return the current number of iterations.
- param state:
If != -1, return iterations of a particular state (TM/WLTM only).
-
virtual bool is_complete() const
Return true if the number of iterations for completion has been reached.
-
virtual void set_complete()
Set the simulation as complete. Used for post processing.
-
virtual int state() const
Return the state index for multistate simulations (default: 0).
-
virtual int num_states() const
Return the number of states. (default: 1).
-
void set_expanded_state(const int state = 0, const int num = 1)
Set the expanded state.
-
int expanded_state() const
Return the expanded state.
-
int num_expanded_states() const
Return number of expanded states.
-
virtual void update()
Update.
-
virtual bool is_equal(const Criteria &criteria, const double tolerance) const
Return true if equivalent.
Arguments
num_iterations_to_complete: set the number of iterations for a simulation to be considered complete (default: 20).
Constraint: ConstrainNumParticles, AHalfB, etc.