xnn.ffnn.models.geometry.dihedral_cos_sin#

xnn.ffnn.models.geometry.dihedral_cos_sin(data, idx, vectors=None, shifts=None)[source]#

Cosine and sine of the signed dihedral angle over each atom quadruple.

The same plane-normal construction as dihedral_cos() (phi = 0 at cis), plus the sine from the triple product of the two normals with the central bond, so terms with a phase (cos(n phi - gamma), the AMBER torsion) can be formed from cos phi and sin phi by multiple-angle recurrences without arccos / atan2.

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

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

  • vectors (callable, optional) – vectors(a, b) returns the bond vectors; pair_vectors() by default.

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

Returns:

(cos phi, sin phi), each of shape (M,); the sign of phi follows the IUPAC convention (positive for a clockwise rotation of the far bond when looking along the central bond).

Return type:

tuple of Tensor