MoveKernel

class jaxrens.sampling.move_kernel.MoveKernel(name, build_kernel, kernel_kwargs=<factory>, weight=1.0, step_size=0.1, step_size_max=10.0, min_rate=0.25, max_rate=0.65, extra_state_fields=<factory>, reject_reasons=<factory>, mutates=<factory>)[source]

Bases: object

Describes one move type for the MWG sampler.

Variables:
  • name (str) – Human-readable label (e.g. “random_walk”, “volume”).

  • build_kernel (Callable) – Reference to the module’s build_kernel function. Signature: build_kernel(energy_fn, params, **kernel_kwargs) -> step_fn(rng_key, state, likelihood_constraint) -> (state, MoveInfo)

  • kernel_kwargs (dict[str, Any]) – Extra keyword arguments forwarded to build_kernel (e.g. n_reflect for Galilean, n_atoms for volume).

  • weight (float) – Relative probability of selecting this move type. Weights are normalized to probabilities by the MWG factory.

  • step_size (float) – Per-move step size. Injected into MCState.step_size before calling the move’s step_fn.

  • extra_state_fields (dict[str, tuple[type, Callable]]) –

    Move-specific fields to add to MCState. Keys are field names, values are (type, initializer_fn) tuples. The initializer is called as initializer(positions, types) and must return the initial value for that field. Example for Galilean:

    {"direction": (jnp.ndarray, lambda pos, types: jnp.zeros_like(pos))}
    

    The MWG factory unions extra_state_fields from all descriptors to build the MCState class dynamically.

  • reject_reasons (frozenset[str]) – Set of reject-reason bucket names this move can emit. Valid values: “energy”, “cell”, “prior”. “accepted” (bucket 0) is always relevant and is excluded from this set. Used by the monitor to suppress uninformative zero-columns in the reject breakdown. Default is frozenset({“energy”}) — energy-only rejection.

  • mutates (frozenset[str]) – Set of state aspects this move writes — a subset of {“positions”, “cell”, “types”} (see jaxrens.constraints). A configuration constraint gates this move only when the move mutates an aspect the constraint depends on; the pairing is computed once, statically, in build_mwg. The default is the full aspect set, so a move that forgets to declare its mutations is conservatively gated by every constraint (never silently skipped) rather than bypassing one.

Parameters: