nvalchemi.models.base.ModelConfig#
- class nvalchemi.models.base.ModelConfig(*, outputs=<factory>, autograd_outputs=<factory>, autograd_inputs=<factory>, required_inputs=<factory>, optional_inputs=<factory>, supports_pbc=False, needs_pbc=False, neighbor_config=None, active_outputs=None, gradient_keys=<factory>)[source]#
Unified model configuration combining capability declaration and runtime control.
A
ModelConfighas two kinds of fields:Capability fields (frozen at construction) describe what the model checkpoint can do. These use
frozensetto signal immutability. They are set once by the wrapper’s__init__and should not be changed at runtime.Runtime fields (mutable) control what the model should compute on each forward pass. These can be changed freely by the user.
outputsandrequired_inputsuse free-form strings so new properties can be added without modifying this class. Well-known output keys:energy,forces,stresses,hessians,dipoles,charges,embeddings.- Parameters:
outputs (frozenset[str])
autograd_outputs (frozenset[str])
autograd_inputs (frozenset[str])
required_inputs (frozenset[str])
optional_inputs (frozenset[str])
supports_pbc (bool)
needs_pbc (bool)
neighbor_config (NeighborConfig | None)
active_outputs (set[str] | None)
gradient_keys (set[str])
- outputs#
All properties the model can produce (frozen).
- Type:
frozenset[str]
- autograd_outputs#
Subset of
outputscomputed via autograd (frozen).- Type:
frozenset[str]
- autograd_inputs#
Input keys needing
requires_grad_(True)for autograd (frozen).- Type:
frozenset[str]
- required_inputs#
Extra inputs beyond
{positions, atomic_numbers}that the model requires (frozen).- Type:
frozenset[str]
- optional_inputs#
Extra inputs the model can optionally use if present (frozen).
- Type:
frozenset[str]
- supports_pbc#
Whether the model supports periodic boundary conditions (frozen).
- Type:
bool
- needs_pbc#
Whether the model requires PBC inputs (frozen).
- Type:
bool
- neighbor_config#
Neighbor list requirements (frozen).
- Type:
NeighborConfig | None
- active_outputs#
Properties to compute this run (mutable). Defaults to
outputsif not explicitly set.- Type:
set[str]
- gradient_keys#
Extra input keys to enable gradients for beyond those implied by
autograd_inputs(mutable).- Type:
set[str]
- model_config = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property needs_neighborlist: bool#
Truewhen the model requires a neighbor list.- Type:
Convenience accessor