jaxrens.sampling.moves.replica_exchange

Replica exchange moves across parallel NS runs.

Unlike standard moves that operate on a single walker, replica exchange swaps walkers between different parallel runs (across the P dimension). This improves mixing when runs have different energy constraints.

Structure:

One driver, replica_exchange_step(), runs the swap schedule (even/odd neighbour pairs, one random walker per run, per-pair statistics) for every flavor. The flavor-specific part is a SwapKernel, whose only job is SwapKernel.propose(): given one walker from each run of a pair, build the walker that would enter each run, with its energy expressed in that run’s ensemble. Acceptance is then the same for every flavor: each incoming walker must lie below the receiving run’s Emax.

Kernels:

EnsembleSwap covers pressure RE and semi-grand (μ) RE. The walkers trade runs unchanged and their stored energies are re-based to the receiving run’s pressure and chemical potentials (zero backend calls). XRENSSwap morphs the incoming walker’s types to the receiving run’s target composition and re-evaluates its energy (two backend calls).

Use make_swap_kernel() to build the kernel for an InterREConfig.

Functions

get_swap_pairs

Get non-overlapping swap pairs for replica exchange.

make_swap_kernel

Build the swap kernel for an InterREConfig.

replica_exchange_step

Run inter-replica swaps across R parallel runs.

Classes

EnsembleSwap

Pressure / semi-grand RE: walkers trade runs, energies are re-based.

SwapKernel

One flavor of inter-RE swap.

SwapWalker

The part of a walker that moves between runs in a swap.

XRENSSwap

Composition-swap RE: morph types to the receiving run, re-evaluate.