CollectionMatrixSplice

class CollectionMatrixSplice

Container for holding a group of FlatHistogram MonteCarlo simulations where each of the collection matricies can be spliced together.

Beware attempting to splice windows with different move sets (trials/weights). This can cause issues in the calculation of ln_prob.

Adjust bounds based on the number of iterations. Thus, iteratively give a window with less iterations macrostates from a window with more iterations, while possible. Left and right most windows can completely abandon completed macrostates. Also, left and right most don’t lose macrostates if the entire window has already reached its completion criteria.

Public Functions

CollectionMatrixSplice(argtype args = argtype())

args:

  • min_window_size: minimum size of window boundaries during adjustment. If -1, do not adjust window boundaries (default: 2).

  • hours_per: hours per bounds adjustment, checkpoint and writing the combined ln_prob (default: 0.01).

  • ln_prob_file: file name for the combined ln_prob, if not empty (default: empty).

  • ln_prob_file_append: if true, append to ln_prob_file (default: false).

  • num_adjust_per_write: number of adjustments per writing of ln_prob (default: 1)

  • bounds_file: file name for periodic output of bounds, if not empty (default: empty).

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

Add a MonteCarlo.

void set_size(const int size)

Set size.

void set(const int index, std::shared_ptr<MonteCarlo> mc)

Set 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)

Set the Checkpoint.

const FlatHistogram &flat_histogram(const int index) const

Return the FlatHistogram of a given clone index.

const CollectionMatrix &collection_matrix(const int index) const

Return the CollectionMatrix of a given clone index.

void adjust_bounds()

Loop through all clones and swap bounds based on number of interations.

void write_bounds(const bool header = false)

Write the bounds to file, if not empty.

Parameters
  • header: optionally, print the header.

bool are_all_complete() const

Return true if all clones are complete.

void run(const double hours)

Run for a number of hours.

void run_until_all_are_complete()

Run until all are complete.

CollectionMatrix collection_matrix() const

Return the complete collection matrix.

LnProbability ln_prob() const

Return the complete probability distribution.

void serialize(std::ostream &ostr) const

Serialize.

CollectionMatrixSplice(std::istream &istr)

Deserialize.

void write(const std::string &file_name) const

write to file