kups.application.potential.mliap.local
¶
State-binding constructors for local MLIAP potentials.
These adapters take a :class:~kups.core.lens.Lens into a concrete simulation
state and wire its particles, systems, neighbor list, and model into the
state-agnostic factory in kups.potential.mliap.local.
The model may live on the state (state.local_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. For incremental (probe) updates
with a constant model, the cache is read from a conventional local_mliap_cache
attribute.
IsCachedLocalMLIAPState
¶
Bases: IsLocalMLIAPGraphState, Protocol
:class:IsLocalMLIAPGraphState carrying an incremental-update cache (model passed in).
Source code in src/kups/application/potential/mliap/local.py
IsLocalMLIAPGraphState
¶
Bases: IsState[IsLocalMLIAPGraphParticles, HasCell[AnyPeriodicity]], IsNeighborListState[IsUniversalNeighborlistParams], Protocol
Particles, systems, and neighbor list for a local MLIAP graph (no model).
Source code in src/kups/application/potential/mliap/local.py
IsLocalMLIAPState
¶
Bases: IsLocalMLIAPGraphState, Protocol
:class:IsLocalMLIAPGraphState that also carries the MLIAP model on the state.
Source code in src/kups/application/potential/mliap/local.py
make_local_mliap_from_state(state, probe=None, gradient_lens=EMPTY_LENS, hessian_lens=EMPTY_LENS, hessian_idx_view=EMPTY_LENS, out_idx_view=None, *, parameters=None, neighborlist_factory=AdaptiveNeighborList.from_state)
¶
make_local_mliap_from_state(
state: Lens[
State,
IsLocalMLIAPState[MaybeCached[LocalMLIAPData, Any]],
],
probe: None = None,
gradient_lens: Lens[
LocalMLIAPInput[
State,
IsLocalMLIAPGraphParticles,
HasCell[AnyPeriodicity],
],
Gradient,
] = ...,
hessian_lens: Lens[Gradient, Hessian] = ...,
hessian_idx_view: Lens[State, Hessian] = ...,
out_idx_view: None = None,
*,
parameters: None = None,
neighborlist_factory: NeighborListFactory[
IsLocalMLIAPState[MaybeCached[LocalMLIAPData, Any]]
] = ...,
) -> Potential[State, Gradient, Hessian, Patch[Any]]
make_local_mliap_from_state(
state: Lens[
State,
IsLocalMLIAPState[
HasCache[
LocalMLIAPData,
PotentialOut[Gradient, Hessian],
]
],
],
probe: Probe[
State,
Ptch,
IsGraphProbe[
IsLocalMLIAPGraphParticles, Literal[2]
],
],
gradient_lens: Lens[
LocalMLIAPInput[
State,
IsLocalMLIAPGraphParticles,
HasCell[AnyPeriodicity],
],
Gradient,
] = ...,
hessian_lens: Lens[Gradient, Hessian] = ...,
hessian_idx_view: Lens[State, Hessian] = ...,
out_idx_view: Lens[
State, PotentialOut[Gradient, Hessian]
]
| None = None,
*,
parameters: None = None,
neighborlist_factory: NeighborListFactory[
IsLocalMLIAPState[
HasCache[
LocalMLIAPData,
PotentialOut[Gradient, Hessian],
]
]
] = ...,
) -> Potential[State, Gradient, Hessian, Ptch]
make_local_mliap_from_state(
state: Lens[State, IsLocalMLIAPGraphState],
probe: None = None,
gradient_lens: Lens[
LocalMLIAPInput[
State,
IsLocalMLIAPGraphParticles,
HasCell[AnyPeriodicity],
],
Gradient,
] = ...,
hessian_lens: Lens[Gradient, Hessian] = ...,
hessian_idx_view: Lens[State, Hessian] = ...,
out_idx_view: None = None,
*,
parameters: LocalMLIAPData,
neighborlist_factory: NeighborListFactory[
IsLocalMLIAPGraphState
] = ...,
) -> Potential[State, Gradient, Hessian, Patch[Any]]
make_local_mliap_from_state(
state: Lens[
State,
IsCachedLocalMLIAPState[
PotentialOut[Gradient, Hessian]
],
],
probe: Probe[
State,
Ptch,
IsGraphProbe[
IsLocalMLIAPGraphParticles, Literal[2]
],
],
gradient_lens: Lens[
LocalMLIAPInput[
State,
IsLocalMLIAPGraphParticles,
HasCell[AnyPeriodicity],
],
Gradient,
] = ...,
hessian_lens: Lens[Gradient, Hessian] = ...,
hessian_idx_view: Lens[State, Hessian] = ...,
out_idx_view: Lens[
State, PotentialOut[Gradient, Hessian]
]
| None = None,
*,
parameters: LocalMLIAPData,
neighborlist_factory: NeighborListFactory[
IsCachedLocalMLIAPState[
PotentialOut[Gradient, Hessian]
]
] = ...,
) -> Potential[State, Gradient, Hessian, Ptch]
Create a local MLIAP potential from a typed state, optionally with incremental updates.
Convenience wrapper around
make_local_mliap_potential.
When probe is None, extracts views from a state satisfying
IsLocalMLIAPState.
When probe is provided, additionally wires the PotentialOut cache for
efficient incremental caching across Monte Carlo steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, cell, neighbor list,
and local MLIAP model (when |
required |
probe
|
Any
|
Detects which particles and neighbor-list edges changed since the last
step. |
None
|
gradient_lens
|
Any
|
Specifies which gradients to compute (e.g., forces). |
EMPTY_LENS
|
hessian_lens
|
Any
|
Specifies which Hessians to compute. |
EMPTY_LENS
|
hessian_idx_view
|
Any
|
Index structure for Hessian updates. |
EMPTY_LENS
|
out_idx_view
|
Any
|
Index into the cached output for partial updates. Only used when
|
None
|
parameters
|
LocalMLIAPData | None
|
Constant MLIAP model. When given it is bound with a constant
lens and the state need not carry |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured local MLIAP Potential. |
Source code in src/kups/application/potential/mliap/local.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |