Criteria

class Criteria

Determine whether to accept or reject a trial. Stores the total energy based on energy changes from each trial. probability of acceptance.

Subclassed by feasst::AlwaysReject, feasst::CriteriaMayer, feasst::FlatHistogram, feasst::Metropolis

Public Functions

Criteria(std::shared_ptr<Constraint> constraint, const argtype &args = argtype())

Same as above, but also add a constraint.

void add(std::shared_ptr<Constraint> constraint)

Add a constraint.

bool is_allowed(const System &system, const Acceptance &acceptance)

Return whether constraints are statisfied.

virtual void before_attempt(const System &system)

This function is called before a trial attempt.

virtual bool is_accepted(const Acceptance &acceptance_, const System &system, Random *random) = 0

Return whether or not the trial attempt should be accepted.

void set_current_energy(const double energy)

Return whether or not the last trial attempt was accepted.

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

Return the current total energy based on energy changes per trial.

std::string status_header() const

Return the header of the status for periodic output.

std::string status() 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 bool is_complete() const

Return true if completion requirements are met.

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 void set_num_iterations(const int iteration)

Set the number of iterations.

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.

virtual bool is_equal(const Criteria &criteria) const

Same as above but with a default tolerance of NEAR_ZERO.