xnn.ffnn.models.geometry.dihedral_cos#

xnn.ffnn.models.geometry.dihedral_cos(data, idx)[source]#

Cosine of the dihedral angle over each atom quadruple.

Uses the plane-normal formula with phi = 0 at cis. Only cos phi is returned; periodic torsion terms are even in phi, so the multiple angles come from Chebyshev identities and no arccos/atan2 (whose derivatives are singular at planar geometries) enters the graph.

Parameters:
  • data (AtomicGraph) – The batched graph.

  • idx (Tensor) – Atom indices of shape (4, M).

Returns:

cos phi of shape (M,).

Return type:

Tensor