faunus
Public Member Functions | Friends | List of all members
Faunus::move::MoveCollection Class Reference

Class storing a list of MC moves with their probability weights and randomly selecting one. More...

#include <move.h>

Public Member Functions

 MoveCollection (const json &list_of_moves, Space &spc, Energy::Hamiltonian &hamiltonian, Space &old_spc)
 
void addMove (std::shared_ptr< Move > &&move)
 Register new move with correct weight.
 
const BasePointerVector< Move > & getMoves () const
 Get list of moves.
 
auto repeatedStochasticMoves ()
 Generates a range of repeated, randomized move pointers guaranteed to be valid. More...
 
auto constantIntervalMoves (const unsigned int sweep_number=1)
 Range of moves excluded from the sample() algorithm above due to ZERO weight. More...
 

Friends

void to_json (json &j, const MoveCollection &propagator)
 Generate json output.
 

Detailed Description

Class storing a list of MC moves with their probability weights and randomly selecting one.

Member Function Documentation

◆ constantIntervalMoves()

auto Faunus::move::MoveCollection::constantIntervalMoves ( const unsigned int  sweep_number = 1)
inline

Range of moves excluded from the sample() algorithm above due to ZERO weight.

Moves added with zero weight are excluded from the sample() function but can be accessed through this function. This is used to run these moves at a fixed frequency Monte Carlo sweep frequency. Used by e.g. parallel tempering that in the current implementation must be run at fixed intervals due to MPI concurrency.

Parameters
sweep_numberCurrent sweep count to decide if move should be included based on sweep_interval
Returns
Range of valid move pointers to be run at given sweep number, i.e. non-stochastically

◆ repeatedStochasticMoves()

auto Faunus::move::MoveCollection::repeatedStochasticMoves ( )
inline

Generates a range of repeated, randomized move pointers guaranteed to be valid.

All moves with repeat=0 are excluded. Effectively each registered move is called with a probability proportional to it's repeat value. The random picking of moves is repeated $ repeat_i$ times so that running over the range constitutes a complete MC "sweep".

Returns
Range of valid move pointers

The documentation for this class was generated from the following files: