kups.potential.classical.harmonic
¶
Harmonic potentials for bonded interactions.
This module provides harmonic bond and angle potentials commonly used in molecular mechanics force fields. These terms maintain molecular geometry and are typically applied to explicitly defined bonds and angles.
Bond potential: \(U(r) = k(r - r_0)^2\) Angle potential: \(U(\theta) = k(\theta - \theta_0)^2\)
HarmonicAngleParameters
¶
Harmonic angle potential parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
labels |
tuple[Label, ...]
|
Species labels, shape |
theta0 |
Array
|
Equilibrium angles [degrees], shape |
k |
Array
|
Force constants [energy/degree²], shape |
Source code in src/kups/potential/classical/harmonic.py
HarmonicBondParameters
¶
Harmonic bond potential parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
labels |
tuple[Label, ...]
|
Species labels, shape |
x0 |
Array
|
Equilibrium bond lengths [Ã…], shape |
k |
Array
|
Force constants [energy/Ų], shape |
Source code in src/kups/potential/classical/harmonic.py
IsBondedParticles
¶
Bases: HasPositionsAndLabels, IsRadiusGraphPoints, Protocol
Particle data with positions, labels, and system index.
Source code in src/kups/potential/classical/harmonic.py
harmonic_angle_energy(inp)
¶
Compute harmonic angle energy for all angles.
Calculates energy as k(θ - θ₀)² for each angle triplet and sums over all systems. Angles are computed in degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
HarmonicAngleInput
|
Graph potential input with harmonic angle parameters |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch[Any]]
|
Total angle energy per system |
Source code in src/kups/potential/classical/harmonic.py
harmonic_bond_energy(inp)
¶
Compute harmonic bond energy for all bonds.
Calculates energy as k(r - r₀)² for each bond and sums over all systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
HarmonicBondInput
|
Graph potential input with harmonic bond parameters |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch[Any]]
|
Total bond energy per system |
Source code in src/kups/potential/classical/harmonic.py
make_harmonic_angle_potential(particles_view, edge_indices_view, systems_view, parameter_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, out_cache_lens=None)
¶
Create harmonic angle potential for explicitly defined angles.
Applies harmonic restraints to specified atom triplets (angles). Angles must be explicitly provided via the input_view edge set as triplets (i-j-k).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsBondedParticles]]
|
Extracts particle data (positions, species) with system index |
required |
edge_indices_view
|
View[State, Index[ParticleId]]
|
Extracts angle connectivity (triplets) |
required |
systems_view
|
View[State, Table[SystemId, HasCell[AnyPeriodicity]]]
|
Extracts indexed system data (cell) |
required |
parameter_view
|
View[State, HarmonicAngleParameters]
|
Extracts HarmonicAngleParameters |
required |
probe
|
Probe[State, P, IsGraphProbe[IsBondedParticles, Literal[3]]] | None
|
Graph probe for incremental particle and neighbor-list updates |
required |
gradient_lens
|
Lens[HarmonicAngleInput, Gradients]
|
Specifies gradients to compute |
required |
hessian_lens
|
Lens[Gradients, Hessians]
|
Specifies Hessians to compute |
required |
hessian_idx_view
|
View[State, Hessians]
|
Hessian index structure |
required |
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Cached output index structure |
None
|
out_cache_lens
|
Lens[State, PotentialOut[Gradients, Hessians]] | None
|
Cache location lens |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, P]
|
Harmonic angle Potential |
Source code in src/kups/potential/classical/harmonic.py
make_harmonic_bond_potential(particles_view, edge_indices_view, systems_view, parameter_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, out_cache_lens=None)
¶
Create harmonic bond potential for explicitly defined bonds.
Applies harmonic restraints to specified atom pairs (bonds). Bonds must be explicitly provided via the input_view edge set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsBondedParticles]]
|
Extracts particle data (positions, species) with system index |
required |
edge_indices_view
|
View[State, Index[ParticleId]]
|
Extracts bond connectivity |
required |
systems_view
|
View[State, Table[SystemId, HasCell[AnyPeriodicity]]]
|
Extracts indexed system data (cell) |
required |
parameter_view
|
View[State, HarmonicBondParameters]
|
Extracts HarmonicBondParameters |
required |
probe
|
Probe[State, P, IsGraphProbe[IsBondedParticles, Literal[2]]] | None
|
Graph probe for incremental particle and neighbor-list updates |
required |
gradient_lens
|
Lens[HarmonicBondInput, Gradients]
|
Specifies gradients to compute |
required |
hessian_lens
|
Lens[Gradients, Hessians]
|
Specifies Hessians to compute |
required |
hessian_idx_view
|
View[State, Hessians]
|
Hessian index structure |
required |
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Cached output index structure |
None
|
out_cache_lens
|
Lens[State, PotentialOut[Gradients, Hessians]] | None
|
Cache location lens |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, P]
|
Harmonic bond Potential |