XRENSSwap

class jaxrens.sampling.moves.replica_exchange.XRENSSwap(n_species)[source]

Bases: SwapKernel

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

The walker entering run r gets its types morphed to run r’s target_composition and its energy re-evaluated by the backend under run r’s remaining ensemble params, so the result is directly in run r’s frame.

Two backend energy evaluations per attempted swap.

Parameters:

n_species (int) – Number of species labels; must match the width of every target_composition.

propose(walker_i, walker_j, params_i, params_j, rng_key, backend)[source]

Build the walkers that would enter runs i and j.

Parameters:
  • walker_i (SwapWalker) – Walker picked from run i, energy in run i’s frame.

  • walker_j (SwapWalker) – Walker picked from run j, energy in run j’s frame.

  • params_i (dict[str, Any]) – Run i’s ensemble params (keys from param_keys).

  • params_j (dict[str, Any]) – Run j’s ensemble params.

  • rng_key (Key[jaxlib._jax.Array, '']) – PRNG key for kernels that need randomness.

  • backend (Any) – Energy backend, for kernels that re-evaluate energies.

Returns:

into_i is built from walker_j and carries its energy in run i’s frame; into_j symmetrically.

Return type:

(into_i, into_j)