tfep.utils.geometry.proper_dihedral_angle

tfep.utils.geometry.proper_dihedral_angle(x1, x2, x3)[source]

Compute the proper dihedral angle between the plane x1-x2 and x2-x3.

If both x1, x2, and x3 have multiple vectors, the angles are computed in a batchwise fashion.

In the description of the parameters, we will use the example of four atoms at positions p0, p1, p2, and p3.

Parameters:
  • x1 (torch.Tensor) – The vector p1 - p0 with shape (*, D), where D is the vector dimensionality.

  • x2 (torch.Tensor) – The vector p2 - p1 with shape (*, D), where D is the vector dimensionality.

  • x3 (torch.Tensor) – The vector p3 - p2 with shape (*, D), where D is the vector dimensionality.

Returns:

dihedrals – A tensor of shape (*,). As an example, if all inputs have shape (batch_size, D), then dihedrals has shape (batch_size,) and dihedrals[i] is the angle between the planes x1[i]-x2[i] and x2[i]-x3[i].

Return type:

torch.Tensor