nvalchemi.dynamics.DynamicsStage#

class nvalchemi.dynamics.DynamicsStage(*values)[source]#

Enumeration of lifecycle stages where dynamics hooks can fire.

Each stage corresponds to a specific point in batch admission or a step, allowing hooks to be triggered before or after key operations.

ON_ADMISSION#

Fired once when a batch enters the dynamics engine, before the first step. Fired again after a new run or managed batch replacement.

Type:

int

BEFORE_STEP#

Fired at the beginning of a step, after any one-time model-output priming.

Type:

int

BEFORE_PRE_UPDATE#

Fired before the pre_update (first half of integrator) is called.

Type:

int

AFTER_PRE_UPDATE#

Fired after the pre_update completes.

Type:

int

BEFORE_COMPUTE#

Fired before the model forward pass (force/energy computation).

Type:

int

AFTER_COMPUTE#

Fired after the model forward pass completes.

Type:

int

BEFORE_POST_UPDATE#

Fired before the post_update (second half of integrator) is called.

Type:

int

AFTER_POST_UPDATE#

Fired after the post_update completes.

Type:

int

AFTER_STEP#

Fired at the very end of a step, after all operations.

Type:

int

ON_CONVERGE#

Fired when a convergence criterion is met (e.g., for optimizers).

Type:

int

ON_GRADUATE#

Fired after ON_CONVERGE to report the graphs that graduated during this step. A graph graduates on the step its status reaches exit_status, whether a convergence criterion, a step budget, or another hook changed it, at whichever stage of the step the change was made: the mask compares the status at step start with the status at dispatch. ctx.graduated_mask marks those graphs. The stage is dispatched on every step on which a hook is registered for it and the batch carries a status column, regardless of the hook’s frequency, because checking the mask first would synchronize with the host. The mask may therefore be all False, so a hook must read it rather than assume a graph graduated. Both BaseDynamics and FusedStage dispatch it. A FusedStage dispatches it on each sub-stage first, for the graphs that sub-stage owned, and then at the fused level.

Type:

int