WalkerState¶
- class jaxrens.state.walker.WalkerState(positions, types, energy, cell=None, n_atoms=0)[source]¶
Bases:
objectState of a single walker in configuration space.
JAX-registered pytree. Use .set() for functional updates.
Shape annotations use a variadic batch prefix
*Bso the same annotation covers a single walker (*B = ()), the live population (*B = (K,)), vmapped runs (*B = (P, K)), and pmap+vmap (*B = (G, P, K)).- Variables:
positions (jaxtyping.Float[jaxlib._jax.Array, '*B N 3']) – Cartesian coordinates, shape
(*B, n_atoms, 3).types (jaxtyping.Int[jaxlib._jax.Array, '*B N']) – Integer atom type codes, shape
(*B, n_atoms).energy (jaxtyping.Float[jaxlib._jax.Array, '*B']) – Current potential energy, shape
(*B,).cell (jaxtyping.Float[jaxlib._jax.Array, '*B 3 3'] | None) – Unit cell matrix, shape
(*B, 3, 3)orNonefor non-periodic systems.n_atoms (int) – Number of atoms (compile-time constant).
- Parameters:
positions (Float[jaxlib._jax.Array, '*B N 3'])
types (Int[jaxlib._jax.Array, '*B N'])
energy (Float[jaxlib._jax.Array, '*B'])
cell (Float[jaxlib._jax.Array, '*B 3 3'] | None)
n_atoms (int)
- set(**kwargs)[source]¶
Functional update: return a new WalkerState with specified fields replaced.
- Parameters:
kwargs (Any)
- Return type:
- classmethod from_record(record, *, n_atoms=None)[source]¶
Build a single-walker
WalkerStatefrom a loose serialization dict.The in-memory walker contract is this dataclass; on-disk artifacts and the callback boundary use plain dicts. This classmethod is the single place that maps those loose keys back to the typed form, so callers stop hand-unpacking
walker["positions"]alongsidewalker.positions.The unit cell is read from
cellor its on-disk aliasbox(the extxyz/HDF5 writers emitbox). Arrays are coerced to JAX arrays so the result satisfies the dataclass’s jaxtyped field contract regardless of whether the record carried numpy or jax arrays.Single walker only — for a batched population record use
jaxrens.io.formats.iter_walker_states().- Parameters:
- Return type: