build_kernel¶
- jaxrens.sampling.moves.galilean.build_kernel(backend, n_reflect=5, perturb_angle=0.1, use_forces=True, species=None, direction_field='direction', refresh_direction=False)[source]¶
Build a Galilean Monte Carlo move kernel.
- Parameters:
backend (Any) – EnergyBackend instance.
n_reflect (int) – Number of trajectory steps (with reflections).
perturb_angle (float) – Angle (radians) to perturb direction between moves.
use_forces (bool) – If True, reflect using gradient (forces). If False, use random reflection (cheaper but less efficient).
species (tuple[int, ...] | None) – Type codes this move may displace; every other atom is held fixed for the whole trajectory.
None(the default) moves all atoms. See the module docstring.refresh_direction (bool) – If True, draw a fresh random direction on every call instead of perturbing the stored one, so persistence is limited to the
n_reflectsteps of one trajectory. Both settings leave the uniform distribution invariant; the flag only trades GMC’s cross-call momentum for faster decorrelation.direction_field (str) – Name of the MCState field holding this move’s persistent direction. Species-scoped moves must each use a distinct field:
build_mwgunionsextra_state_fieldsby name, so two scoped moves sharing"direction"would zero out each other’s persistence on every call — destroying the very thing GMC relies on.
- Returns:
(rng_key, state, Emax) -> (new_state, MoveInfo)
- Return type:
step function
Note
A scoped move whose species is absent from a given walker degenerates to a no-op that always “accepts” (the identity move trivially satisfies detailed balance, but its acceptance rate carries no information, so its adapted step size is meaningless). The resolver rejects species absent from the system; this can still arise per-walker under composition-changing ensembles (semi-grand, alchemical moves).