nvalchemi.enhanced_sampling.WalkerIdentityHook#
- class nvalchemi.enhanced_sampling.WalkerIdentityHook(*, steps_per_epoch, exchange=None)[source]#
Stamp walker identity and step counters onto the live batch.
walker_idandthermodynamic_state_idare assigned once and then preserved; the counters are refreshed every step. All five fields are also registered asBaseDynamicsbookkeeping keys, so they survive refill and graduation rather than depending on this hook alone.- Parameters:
steps_per_epoch (int) – Divisor for
sampling_epoch.exchange (ReplicaExchange | None) – Ladder, when replica exchange is configured. Read for the initial assignment and the segment divisor only; attempts are the swap hook’s job.
- next_walker_id#
The identifier the next unstamped graph will receive. Carried in a checkpoint so a resumed run does not reissue identifiers.
- current_batch#
The batch last stamped, which is what
checkpoint()saves when the caller does not name one.
- load_state_dict(state)[source]#
Restore the identifier allocation.
- Parameters:
state (Mapping[str, Any]) – A mapping produced by
state_dict().- Return type:
None
- on_register(workflow)[source]#
Remember the engine the thermodynamic assignment has to drive.
- Parameters:
workflow (Any) – The
BaseDynamicsdoing the registering.- Return type:
None
- stamp(batch, step)[source]#
Write identity and counter fields for step onto batch.
Exposed separately from
__call__()because force priming needs the batch stamped without a hook dispatch behind it.- Parameters:
batch (Batch) – The live batch.
step (int) – The dynamics step the stamp describes.
- Return type:
None