nvalchemi.dynamics.hooks.ConvergedSnapshotHook#
- class nvalchemi.dynamics.hooks.ConvergedSnapshotHook(sink, frequency=1)[source]#
Write only newly converged samples to a
DataSink.Fires at
ON_CONVERGEand uses the converged sample indices (available viadynamics._last_converged) to build a boolean mask passed toDataSink.write(). Only samples that just satisfied the convergence criterion are written — samples that converged on earlier steps are not re-written.This is the recommended hook for persisting optimized structures to Zarr in a
FusedStagepipeline, where multiple relaxations run concurrently and structures converge at different steps.- Parameters:
Examples
>>> from nvalchemi.dynamics.hooks import ConvergedSnapshotHook >>> from nvalchemi.dynamics.sinks import ZarrData >>> sink = ZarrData(store="converged.zarr", capacity=100_000) >>> hook = ConvergedSnapshotHook(sink=sink) >>> dynamics.register_hook(hook)
Methods
__init__(sink[, frequency])