xnn.ffnn.models.geometry.dihedral_cos#

xnn.ffnn.models.geometry.dihedral_cos(data, idx, shifts=None)[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).

  • shifts (Tensor, optional) – The image shifts (3, M, 3) of the three bond vectors (see pair_vectors()), when already found.

Returns:

cos phi of shape (M,).

Return type:

Tensor