Constructing a System & Running Wolff

This class and associated member functions are defined in the header file lib/wolff.hpp.

template\<R_t, X_t, G_t = graph\<>> system

The core of the library lies in the system class and its member functions. Here, the state of your model is stored and cluster flip Monte Carlo can be carried out in various ways.

Note that the member objects and functions described here will change when compiled with certain compiler flags active, as described in Compile Options.

unsigned system::nv

Stores the number of ordinary sites in the model.

unsigned system::ne

Stores the number of ordinary bonds in the model.

G_t system::G

Stores the graph describing the lattice, including the ghost site. See Graphs for details on this class. The template parameter has a default option corresponding to a graph type with no special vertex or edge properties.

double system::T

Stores the temperature of the model.

std::vector<X_t> system::s

The \(i\text{th}\) component stores the spin state of site \(i\).

R_t system::s0

Stores the state of the ghost site.

std::function<double(const X_t&, const X_t&)> system::Z

The function that returns the coupling between neighboring sites.

std::function<double(const X_t&)> system::B

The function that returns the coupling to the field.

system::system(G_t G, double T, std::function<double(const X_t&, const X_t&)> Z, std::function<double(const X_t&)> B)

The constructor for systems.

Parameters
  • G_t G – A lattice graph without the ghost spin added.

  • double T – The temperature.

  • std::function<double(const X_t&, const X_t&)> Z – The bond coupling.

  • std::function<double(const X_t&)> B – The field coupling.

The states of the spins and ghost site are initialized using the default constructors for X_t and R_t, respectively. nv and ne are taken directly from G, after which the ghost site is added to G.

system::flip_cluster(const G_t::vertex &v0, const R_t &r, std::mt19937 &rng, measurement<R_t, X_t, G_t> &A)

Performs one Wolff cluster flip to the system.

Parameters
  • const G_t::vertex& v0 – The vertex of the seed site.

  • const R_t& r – The transformation by which the cluster is flipped.

  • std::mt19937& rng – A random number generator.

  • measurement<R_t, X_t, G_t>& A – Object whose class inherits measurement and provides relevant measurement hooks.

system::run_wolff(unsigned N, std::function<R_t(std::mt19937&, const system<R_t, X_t, G_t>&, const G_t::vertex&)> r_gen, measurement<R_t, X_t, G_t> &A, std::mt19937 &rng, )

Performs N Wolff cluster flips to the system.

Parameters
  • unsigned N – Number of clusters to flip.

  • std::function <R_t(std::mt19937&, const system<R_t, X_t, G_t>&, const G_t::vertex&>)> r_gen – Generator of transformations for the cluster flips.

  • measurement<R_t, X_t, G_t>& A – Object whose class inherits measurement and provides relevant measurement hooks.

  • std::mt19937& rng – A random number generator.