# FlatHistogram¶

class FlatHistogram : public feasst::Criteria

Flat histogram acceptance criteria uses a bias to improve sampling and attempt to recover the free energy of the system as a function of the give macrostate.

The Macrostate must be defined before the bias.

Public Functions

FlatHistogram(std::shared_ptr<Macrostate> macrostate, std::shared_ptr<Bias> bias)

Construct with a macrostate and a bias.

FlatHistogram(argtype args)

This is a flattened constructor which takes arguments for macrostate, the macrostate histogram and the bias, as well as the following two arguments.

args:

FlatHistogram(std::shared_ptr<Macrostate> macrostate, std::shared_ptr<Bias> bias, std::shared_ptr<Constraint> constraint)

Same as above, but with an added Constraint.

const Macrostate &macrostate() const

Return the macrostate.

const Bias &bias() const

Return the bias.

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.

void set_num_iterations_to_complete(const int num)

Set the number of iterations for a simulation to be complete.

int num_iterations() const

Return the current number of iterations.

bool is_complete() const

Return true if the number of iterations for completion has been reached.

void before_attempt(const System &system)

This function is called before a trial attempt.

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

Return whether or not the trial attempt should be accepted.

std::string write() const

Return a human-readable output of all data (not as brief as status).

int phase() const

Return the simulation phase index used to differentiate production and initialization, etc.

void increment_phase()

Increment the simulation phase.

int state() const

Return the state. Return -1 if state is not determined.

int num_states() const

Return the number of states. (default: 1).

void set_ln_prob(const LnProbability &ln_prob)

Set the macrostate probability distribution.

const LnProbability &ln_prob() const

Return the macrostate probability distribution.

void update()

Update.