kups.application.potential.mliap.torch
¶
State-binding constructors for torch MLFF potentials.
These adapters take a :class:~kups.core.lens.Lens into a concrete simulation
state and wire its particles, systems, neighbor list, and torch MLFF model into
the state-agnostic factories in
kups.potential.mliap.torch.interface.
The model may live on the state (state.torch_mliap_model) or be passed
directly via parameters=; in the latter case it is bound with a constant
lens and the state need not carry a model field.
IsTorchMliapGraphState
¶
Bases: IsState[IsTorchMliapParticles, HasCell[AnyPeriodicity]], IsNeighborListState[IsUniversalNeighborlistParams], Protocol
Particles, systems, and neighbor list for a torch MLFF graph (no model).
Source code in src/kups/application/potential/mliap/torch.py
IsTorchMliapState
¶
Bases: IsTorchMliapGraphState, Protocol
:class:IsTorchMliapGraphState that also carries the model on the state.
Source code in src/kups/application/potential/mliap/torch.py
make_torch_mliap_from_state(state, *, parameters=None, gradient=None, neighborlist_factory=AdaptiveNeighborList.from_state)
¶
make_torch_mliap_from_state(
state: Lens[State, IsTorchMliapState],
*,
parameters: None = None,
gradient: None = None,
neighborlist_factory: NeighborListFactory[
IsTorchMliapState
] = ...,
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
make_torch_mliap_from_state(
state: Lens[State, IsTorchMliapState],
*,
parameters: None = None,
gradient: Lens[Geometry, PositionsAndCell],
neighborlist_factory: NeighborListFactory[
IsTorchMliapState
] = ...,
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
Create a torch MLFF potential from a typed state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into a sub-state providing particles, systems, and neighbor
list (plus |
required |
parameters
|
TorchMliap | None
|
Constant torch MLFF model. When given it is bound with a
constant lens and the state need not carry |
None
|
gradient
|
Lens[Geometry, PositionsAndCell] | None
|
Relaxation filter |
None
|
neighborlist_factory
|
NeighborListFactory[Any]
|
Neighbor list factory. |
from_state
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured torch MLFF |