# Macrostate¶

class Macrostate

The macrostate is the statistical mechanical variable to which we apply bias using flat-histogram methods. Thus, for example, in the grand canonical ensemble with a single component, the macrostate is the number of particles. To apply the flat histogram methods, the macrostate is be broken into a contiguous series of “bins”.

Public Functions

Macrostate(const Histogram &histogram, argtype args = argtype())

args:

• soft_macro_max : optionally, set a soft maximum (default: last histogram bin). These soft limits may be changed during a simulation. Note that this max is a macrostate value, not an integer bin index.

• soft_macro_min : minimum as described above (default: same as histogram). This argument also requires the use of soft_macro_max.

Macrostate(argtype args = argtype())

A flattened version of the above constructor that takes Histogram arguments.

void set(const Histogram histogram)

Set the bins of the macrostate by providing a Histogram. This is required before the macrostate can be used for flat histogram methods. The histogram only serves to determine the bins, and should not be expanded or have values added during the course of the simulation.

const Histogram &histogram() const

Return the histogram.

const int soft_max() const

Return the soft maximum as an integer bin index, not a macrostate.

const int soft_min() const

Return the soft minimum as an integer bin index, not a macrostate.

const int num_macrostates_in_soft_range() const

Return the number of macrostates in the soft range.

virtual double value(const System &system, const Criteria &criteria, const Acceptance &acceptance) const = 0

Return the current value of the macrostate.

int bin(const System &system, const Criteria &criteria, const Acceptance &acceptance) const

Return the current bin of the macrostate.

double value(const int bin) const

Return the value of the bin.

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

Return whether the current system macrostate is within permissible range given by the input histogram.