kups.potential.classical.cosine_angle
¶
UFF-style cosine angle bending potential.
Reference: Rappe et al. (1992) "UFF, a Full Periodic Table Force Field" J. Am. Chem. Soc. 114, 10024-10035. DOI: 10.1021/ja00051a040
General form:
where the coefficients are computed from the equilibrium angle \(\theta_0\):
- \(C_2 = \frac{1}{4 \sin^2(\theta_0)}\)
- \(C_1 = -4 C_2 \cos(\theta_0)\)
- \(C_0 = C_2 (2 \cos^2(\theta_0) + 1)\)
For linear angles (\(\theta_0 = 180°\)), the coefficients are singular, so a special form is used: \(U(\theta) = K (1 + \cos\theta)\).
CosineAngleParameters
¶
UFF-style cosine angle potential parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
labels |
tuple[Label, ...]
|
Species labels, shape |
theta0 |
Array
|
Equilibrium angles [radians], shape |
k |
Array
|
Force constants [energy], shape |
linear_tol |
Array
|
Tolerance for detecting linear angles [radians]. |
Source code in src/kups/potential/classical/cosine_angle.py
from_uff(labels, bond_angle, bond_radius, electronegativity, effective_charge, linear_tol=jnp.radians(5))
classmethod
¶
Create angle parameters using UFF formulas.
Computes angle parameters from per-species atomic properties: - \(\theta_0\) from central atom's bond angle - \(K\) from Eq. 13 using bond lengths and effective charges
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
tuple[str, ...]
|
Species labels, shape |
required |
bond_angle
|
Array
|
Natural valence angle [radians], shape |
required |
bond_radius
|
Array
|
Valence bond radii [A], shape |
required |
electronegativity
|
Array
|
GMP electronegativity, shape |
required |
effective_charge
|
Array
|
Effective atomic charge Z*, shape |
required |
linear_tol
|
Array
|
Tolerance for detecting linear angles [radians] |
radians(5)
|
Returns:
| Type | Description |
|---|---|
CosineAngleParameters
|
CosineAngleParameters with full interaction matrices |
Source code in src/kups/potential/classical/cosine_angle.py
IsBondedParticles
¶
Bases: HasPositionsAndLabels, HasSystemIndex, Protocol
Particle data with positions, labels, and system index.
Source code in src/kups/potential/classical/cosine_angle.py
IsCosineAngleState
¶
Bases: Protocol
Protocol for states providing all inputs for the cosine angle potential.
Source code in src/kups/potential/classical/cosine_angle.py
cosine_angle_energy(inp)
¶
Compute UFF-style cosine angle energy for all angles.
Calculates energy using the general cosine form:
For near-linear angles (\(\theta_0\) close to 180deg), uses:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
CosineAngleInput
|
Graph potential input with cosine angle parameters |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch]
|
Total angle energy per system |
Source code in src/kups/potential/classical/cosine_angle.py
make_cosine_angle_from_state(state, probe=None, *, compute_position_and_unitcell_gradients=False)
¶
make_cosine_angle_from_state(
state: Lens[
State,
IsCosineAngleState[
MaybeCached[CosineAngleParameters, Any]
],
],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[
False
] = ...,
) -> Potential[State, EmptyType, EmptyType, Patch]
make_cosine_angle_from_state(
state: Lens[
State,
IsCosineAngleState[
MaybeCached[CosineAngleParameters, Any]
],
],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[True],
) -> Potential[
State, PositionAndUnitCell, EmptyType, Patch
]
make_cosine_angle_from_state(
state: Lens[
State,
IsCosineAngleState[
HasCache[
CosineAngleParameters,
PotentialOut[EmptyType, EmptyType],
]
],
],
probe: Probe[
State,
P,
IsEdgeSetGraphProbe[IsBondedParticles, Literal[3]],
],
*,
compute_position_and_unitcell_gradients: Literal[
False
] = ...,
) -> Potential[State, EmptyType, EmptyType, P]
make_cosine_angle_from_state(
state: Lens[
State,
IsCosineAngleState[
HasCache[
CosineAngleParameters,
PotentialOut[
PositionAndUnitCell, EmptyType
],
]
],
],
probe: Probe[
State,
P,
IsEdgeSetGraphProbe[IsBondedParticles, Literal[3]],
],
*,
compute_position_and_unitcell_gradients: Literal[True],
) -> Potential[State, PositionAndUnitCell, EmptyType, P]
Create a cosine angle potential from a typed state, optionally with incremental updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, unit cell, edges, and parameters. |
required |
probe
|
Any
|
Detects which particles and edges changed since the last step.
If |
None
|
compute_position_and_unitcell_gradients
|
bool
|
When True, computes gradients w.r.t. particle positions and lattice vectors. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured cosine angle Potential. |
Source code in src/kups/potential/classical/cosine_angle.py
make_cosine_angle_potential(particles_view, edges_view, systems_view, parameter_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, out_cache_lens=None)
¶
Create UFF-style cosine angle potential for explicitly defined angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsBondedParticles]]
|
Extracts particle data (positions, species) with system index |
required |
edges_view
|
View[State, Edges[Literal[3]]]
|
Extracts angle connectivity (triplets) |
required |
systems_view
|
View[State, Table[SystemId, HasUnitCell]]
|
Extracts indexed system data (unit cell) |
required |
parameter_view
|
View[State, CosineAngleParameters]
|
Extracts CosineAngleParameters |
required |
probe
|
Probe[State, Ptch, IsEdgeSetGraphProbe[IsBondedParticles, Literal[3]]] | None
|
Probes particle, edge, and capacity changes for incremental updates |
required |
gradient_lens
|
Lens[CosineAngleInput, 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, Ptch]
|
Cosine angle Potential |