#include <triqs/mc_tools/mc_generic.hpp>


int run (int64_t n_cycles,
int64_t length_cycle,
std::function<bool ()> stop_callback,
bool do_measure,
communicator c = mpi::communicator{})

Generic function to run the Monte-Carlo. Used by both warmup and accumulate.


  • n_cycles Number of QMC cycles
    If negative, the accumulation is done until the stop_callback returns true or signal is received.
  • length_cycle Number of QMC move attempts in one cycle
  • stop_callback A callback function () -> bool. It is called after each cycle
    to and the computation stops when it returns true. Typically used to set up the time limit, cf doc.
  • do_measure Whether or not to accumulate for each measurement
  • c The mpi communicator [optional]. If not provided use the default-constructed one.


0 if the computation has run until the end
1 if it has been stopped by stop_callback
2 if it has been stopped by receiving a signal