Ensemble

class Ensemble

Perform reweighting and ensemble averages using macrostate distributions

Subclassed by feasst::GrandCanonicalEnsemble

Public Functions

Ensemble(const Histogram &macrostates, const LnProbability &ln_prob, const double conjugate = 0.)

Store the original conjugate, macrostate and distribution.

Ensemble(const FlatHistogram &flat_hist)

Same as above, but taken from FlatHistogram.

Ensemble(const Clones &clones)

Same as above, but taken from spliced Clones.

const LnProbability &ln_prob_original() const

Return the stored macrostate distribution from the original simulation.

const LnProbability &ln_prob() const

Return the LnProbability (that may have been reweighted).

const Histogram &macrostates() const

Return the stored Histogram representing the macrostates of the original simulation.

void phase_boundary(const int phase, int *min, int *max) const

Determine min and max macrostate indices for a given phase Return 1 if no phase boundary, or 0 for success.

bool is_phase_boundary() const

Return true if phase boundary is found.

double original_conjugate() const

Return the conjugate thermodynamic variable of the macrostate from the original simulation.

const LnProbability &reweight(const double delta_conjugate)

Store and return a reweighted macrostate distribution due to a change in the conjugate variable. For example, if reweighting in number of particles using the grand canonical ensemble, the change in the thermodynamic conjugate is \(\Delta(\beta\mu)\). If reweighting in potential energy in the microcanonical, the change in the thermodynamic conjugate is \(\Delta(-\beta)\).

double conjugate() const

Return the conjugate variable corresponding to the current (reweighted) macrostate distribution.

double average(const std::vector<double> &macrostate_averages, const int phase = 0) const

Return the ensemble averaged property from a list of properties averaged at each macrostate.

param phase:

Select phase by order of macrostate. Assumes default method of dividing phase boundary.

double average_macrostate(const int phase = 0) const

Return the average macrostate.

param phase:

Select phase by order of macrostate. Assumes default method of dividing phase boundary.

class GrandCanonicalEnsemble : public feasst::Ensemble

Grand canonical ensemble currently implemented for single component systems.

Subclassed by feasst::ExtrapolateBetaGCE

Public Functions

GrandCanonicalEnsemble(const Histogram &macrostates, const LnProbability &ln_prob, const double conjugate = 0.)

Store \(\beta\), \(\mu\) and the original ln_prob_.

double beta_mu() const

Return the conjugate to the macrostate, \(\beta\mu\).

double betaPV(const int phase = 0) const

Return \(\beta PV\), the pressure times volume and inverse temperature. See https://doi.org/10.1063/1.2064628

param phase:

Select phase by order of macrostate. Assumes default method of dividing phase boundary.

class ExtrapolateBetaGCE : public feasst::GrandCanonicalEnsemble

Public Functions

ExtrapolateBetaGCE(const MonteCarlo &monte_carlo, const FlatHistogram &flat_histogram, argtype args = argtype())

Extrapolate the original simulation data to a different \(\beta\). See: https://doi.org/10.1063/1.4975331 Assumes a single component. In this implementation, extrapolation should be done before reweighting because this function changes ln_prob_original, not ln_prob.

args:

  • beta_new: \(\beta\) to extrapolate toward.

  • beta_original: original \(\beta\) of the simulation.

  • order: truncate Taylor series at this order (default: 2).

ExtrapolateBetaGCE(const Clones &clones, argtype args = argtype())

Same as above, but stitched together from parallel Clones.

const std::vector<double> energy() const

Return the new energies based on extrapolation.