Clones

class Clones

Container for initializing, running and analyzing groups of FlatHistogram MonteCarlo simulations.

Public Functions

void add(std::shared_ptr<MonteCarlo> mc)

Add a MonteCarlo.

int num() const

Return the number of clones.

const MonteCarlo &clone(const int index) const

Return a read-only clone.

MonteCarlo *get_clone(const int index)

Return a writable clone.

std::vector<std::shared_ptr<MonteCarlo>> get_clones()

Return the clones.

void set(std::shared_ptr<Checkpoint> checkpoint)

Add a checkpoint.

void initialize(const argtype &args = argtype())

Assuming the the first clone is already initialized, run the first clone until it reaches a macrostate the overlaps with the next clone, and exchange this configuration (e.g., bottom up initialization). Repeat until all clones have been initialized.

args:

  • attempt_batch: perform this many attempts in a batch between checking for overlap (default: 1).

  • max_batch: maximum number of batches. Infinite if -1 (default: -1).

void initialize(const int upper_index, const argtype &args = argtype())

Same as above, but for only one overlapping pair of clones, given by upper_index and upper_index - 1.

void run_until_complete(const argtype &args = argtype())

Run until all clones are complete. If OMP is available, run the clones in parallel threads until all clones are complete.

args:

  • omp_batch: If OMP, for each this many steps, check for completion and write aggregate ln_prob (default: 1e6).

  • ln_prob_file: file name of aggregate ln_prob. If empty (default), do not write the file.

void initialize_and_run_until_complete(const argtype &run_args = argtype(), const argtype &init_args = argtype())

Combine the bottom up initialization and run until complete. With OMP, the first clone will run until finding overlap with the second. Once overlap is found, the first and second run in parallel while the second finds overlap with the third. This is repeated until all clones are running in parallel.

void set_num_iterations(const int iterations)

Set the number of Criteria iterations of all clones.

FlatHistogram flat_histogram(const int index) const

Return the FlatHistogram of a given clone index.

LnProbability ln_prob(Histogram *macrostates = NULL, std::vector<double> *multistate_data = NULL, const std::string analyze_name = "", const AnalyzeData &get = AccumulatorAverage()) const

Stitch together and return the LnProbability of all clones.

Parameters
  • macrostates: Optionally return spliced macrostates, if not NULL.

  • multistate_data: Optionally return spliced multistate data, it not NULL.

  • analyze_name: Name of Analyze to extract data.

  • get: Source of data in Analyze

void stitch(Histogram *macrostates = NULL, std::vector<double> *multistate_data = NULL, const std::string analyze_name = "", const AnalyzeData &get = AccumulatorAverage()) const

Same as above, but without ln_prob.

void stitch(std::vector<double> *multistate_data, const std::string analyze_name, const AnalyzeData &get) const

Same as above, but without ln_prob or spliced macrostates.

void serialize(std::ostream &ostr) const

Serialize.

Clones(std::istream &istr)

Deserialize.