nvalchemi.models.pipeline.PipelineGroup#

class nvalchemi.models.pipeline.PipelineGroup(steps, use_autograd=False, derivative_fn=None)[source]#

A group of steps that share a derivative computation strategy.

Steps within a group execute in order (for wiring). Groups execute in declaration order.

steps accepts bare BaseModelMixin instances or PipelineStep wrappers. Bare models are normalized to PipelineStep(model, wire={}) internally.

Parameters:
  • steps (list[BaseModelMixin | PipelineStep]) – Ordered list of models (or wrapped models) in this group.

  • use_autograd (bool) – If True, sub-models produce energies only; the group sums them and calls derivative_fn to compute forces, stresses, and any other requested derivatives from the summed energy. If False (default), each sub-model computes its own outputs and the group sums them directly.

  • derivative_fn (DerivativeFn | None) –

    Custom derivative function called after energy summation in autograd groups. Receives (energy, data, requested) where energy is the summed group energy (on the autograd graph), data is the batch (with positions.requires_grad=True), and requested is the set of output keys that still need to be computed (e.g. {"forces", "stress"}).

    When None (default), the pipeline uses a built-in function that computes forces as -dE/dr and stresses via the affine strain trick (see prepare_strain()).

    Only meaningful when use_autograd=True.