Skip to main content

Module wolff

Module wolff 

Source
Expand description

Wolff (1989) single-cluster Monte-Carlo update for the ferromagnetic Ising model.

Where Swendsen-Wang (see super::swendsen_wang) partitions the entire lattice into clusters every sweep, Wolff grows and flips a single cluster seeded at a random site. This is often more efficient per unit work near criticality because the algorithm preferentially builds large clusters (the probability of seeding inside a big cluster is proportional to its size), and a single flood-fill touches only the spins it actually flips.

One update proceeds as:

  1. Seed. Pick a site k uniformly at random; remember its spin value s_seed.
  2. Grow. Flood-fill (stack / BFS) from k. For each aligned neighbour j (s_j == s_seed) not yet in the cluster, add it with probability p = 1 − exp(−2 β J).
  3. Flip. Flip the whole grown cluster unconditionally.

Because the seed cluster is always flipped (not with probability ½), the single-cluster move still satisfies detailed balance — the asymmetry in the proposal is exactly cancelled by the Fortuin-Kasteleyn bond weights. The chain is ergodic: over enough updates it visits both +M and −M ordered states, decorrelating the global magnetisation far faster than single-spin Metropolis near T_c.

Spins are i8 values in {−1, +1}. Square lattices (open or periodic) and general graphs are both supported; the geometry and validation helpers are shared with super::swendsen_wang.

Structs§

Wolff
Wolff single-cluster sampler.
WolffConfig
Configuration for a Wolff sampler.