kups.application.potential.classical.harmonic
¶
State-binding constructors for harmonic bonded potentials.
These adapters take a :class:~kups.core.lens.Lens into a concrete simulation
state and wire its particles, systems, bond/angle indices, and parameters into
the state-agnostic factories in
kups.potential.classical.harmonic.
Parameters may live on the state (state.harmonic_bond_parameters /
state.harmonic_angle_parameters) or be passed directly via parameters=;
in the latter case they are bound with a constant lens and the state need not
carry a parameter field. For incremental (probe) updates with constant
parameters, the cache is read from a conventional harmonic_bond_cache /
harmonic_angle_cache attribute.
IsCachedHarmonicAngleState
¶
Bases: IsHarmonicAngleGraphState, Protocol
:class:IsHarmonicAngleGraphState carrying an incremental-update cache (params passed in).
Source code in src/kups/application/potential/classical/harmonic.py
IsCachedHarmonicBondState
¶
Bases: IsHarmonicBondGraphState, Protocol
:class:IsHarmonicBondGraphState carrying an incremental-update cache (params passed in).
Source code in src/kups/application/potential/classical/harmonic.py
IsHarmonicAngleGraphState
¶
Bases: HasBondedParticlesAndSystems, Protocol
Particles, systems, and angle indices for a harmonic angle graph (no parameters).
Source code in src/kups/application/potential/classical/harmonic.py
IsHarmonicAngleState
¶
Bases: IsHarmonicAngleGraphState, Protocol
:class:IsHarmonicAngleGraphState that also carries angle parameters on the state.
Source code in src/kups/application/potential/classical/harmonic.py
IsHarmonicBondGraphState
¶
Bases: HasBondedParticlesAndSystems, Protocol
Particles, systems, and bond indices for a harmonic bond graph (no parameters).
Source code in src/kups/application/potential/classical/harmonic.py
IsHarmonicBondState
¶
Bases: IsHarmonicBondGraphState, Protocol
:class:IsHarmonicBondGraphState that also carries bond parameters on the state.
Source code in src/kups/application/potential/classical/harmonic.py
make_harmonic_angle_from_state(state, probe=None, *, parameters=None, gradient=None)
¶
make_harmonic_angle_from_state(
state: Lens[
State,
IsHarmonicAngleState[
MaybeCached[HarmonicAngleParameters, Any]
],
],
probe: None = None,
*,
parameters: None = None,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, Patch[Any]]
make_harmonic_angle_from_state(
state: Lens[
State,
IsHarmonicAngleState[
MaybeCached[HarmonicAngleParameters, Any]
],
],
probe: None = None,
*,
parameters: None = None,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
make_harmonic_angle_from_state(
state: Lens[
State,
IsHarmonicAngleState[
HasCache[
HarmonicAngleParameters,
PotentialOut[EmptyType, EmptyType],
]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[3]],
],
*,
parameters: None = None,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, P]
make_harmonic_angle_from_state(
state: Lens[
State,
IsHarmonicAngleState[
HasCache[
HarmonicAngleParameters,
PotentialOut[PositionsAndCell, EmptyType],
]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[3]],
],
*,
parameters: None = None,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[State, PositionsAndCell, EmptyType, P]
make_harmonic_angle_from_state(
state: Lens[State, IsHarmonicAngleGraphState],
probe: None = None,
*,
parameters: HarmonicAngleParameters,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, Patch[Any]]
make_harmonic_angle_from_state(
state: Lens[State, IsHarmonicAngleGraphState],
probe: None = None,
*,
parameters: HarmonicAngleParameters,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
make_harmonic_angle_from_state(
state: Lens[
State,
IsCachedHarmonicAngleState[
PotentialOut[EmptyType, EmptyType]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[3]],
],
*,
parameters: HarmonicAngleParameters,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, P]
make_harmonic_angle_from_state(
state: Lens[
State,
IsCachedHarmonicAngleState[
PotentialOut[PositionsAndCell, EmptyType]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[3]],
],
*,
parameters: HarmonicAngleParameters,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[State, PositionsAndCell, EmptyType, P]
Create a harmonic angle potential, optionally with incremental updates.
Convenience wrapper around
make_harmonic_angle_potential.
When probe is None, builds a plain potential from
IsHarmonicAngleState.
When a probe is provided, builds an incrementally-updated potential from
a state with HasCache-wrapped parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, cell, and angle
indices (plus |
required |
probe
|
Any
|
If provided, detects particle changes and supplies the before/after fixed-edge neighbor lists for incremental updates. Those neighbor lists carry any required update capacity. |
None
|
parameters
|
HarmonicAngleParameters | None
|
Constant harmonic angle parameters. When given they are
bound with a constant lens and the state need not carry
|
None
|
gradient
|
Lens[Geometry, PositionsAndCell] | None
|
Relaxation filter |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured harmonic angle Potential. |
Source code in src/kups/application/potential/classical/harmonic.py
make_harmonic_bond_from_state(state, probe=None, *, parameters=None, gradient=None)
¶
make_harmonic_bond_from_state(
state: Lens[
State,
IsHarmonicBondState[
MaybeCached[HarmonicBondParameters, Any]
],
],
probe: None = None,
*,
parameters: None = None,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, Patch[Any]]
make_harmonic_bond_from_state(
state: Lens[
State,
IsHarmonicBondState[
MaybeCached[HarmonicBondParameters, Any]
],
],
probe: None = None,
*,
parameters: None = None,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
make_harmonic_bond_from_state(
state: Lens[
State,
IsHarmonicBondState[
HasCache[
HarmonicBondParameters,
PotentialOut[EmptyType, EmptyType],
]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[2]],
],
*,
parameters: None = None,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, P]
make_harmonic_bond_from_state(
state: Lens[
State,
IsHarmonicBondState[
HasCache[
HarmonicBondParameters,
PotentialOut[PositionsAndCell, EmptyType],
]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[2]],
],
*,
parameters: None = None,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[State, PositionsAndCell, EmptyType, P]
make_harmonic_bond_from_state(
state: Lens[State, IsHarmonicBondGraphState],
probe: None = None,
*,
parameters: HarmonicBondParameters,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, Patch[Any]]
make_harmonic_bond_from_state(
state: Lens[State, IsHarmonicBondGraphState],
probe: None = None,
*,
parameters: HarmonicBondParameters,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[
State, PositionsAndCell, EmptyType, Patch[Any]
]
make_harmonic_bond_from_state(
state: Lens[
State,
IsCachedHarmonicBondState[
PotentialOut[EmptyType, EmptyType]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[2]],
],
*,
parameters: HarmonicBondParameters,
gradient: None = None,
) -> Potential[State, EmptyType, EmptyType, P]
make_harmonic_bond_from_state(
state: Lens[
State,
IsCachedHarmonicBondState[
PotentialOut[PositionsAndCell, EmptyType]
],
],
probe: Probe[
State,
P,
IsGraphProbe[IsBondedParticles, Literal[2]],
],
*,
parameters: HarmonicBondParameters,
gradient: Lens[Geometry, PositionsAndCell],
) -> Potential[State, PositionsAndCell, EmptyType, P]
Create a harmonic bond potential, optionally with incremental updates.
Convenience wrapper around
make_harmonic_bond_potential.
When probe is None, builds a plain potential from
IsHarmonicBondState.
When a probe is provided, builds an incrementally-updated potential from
a state with HasCache-wrapped parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, cell, and bond
indices (plus |
required |
probe
|
Any
|
If provided, detects particle changes and supplies the before/after fixed-edge neighbor lists for incremental updates. Those neighbor lists carry any required update capacity. |
None
|
parameters
|
HarmonicBondParameters | None
|
Constant harmonic bond parameters. When given they are bound
with a constant lens and the state need not carry
|
None
|
gradient
|
Lens[Geometry, PositionsAndCell] | None
|
Relaxation filter |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured harmonic bond Potential. |