mlipops.pairwise_displacements#

mlipops.pairwise_displacements(positions: Tensor, pairs: Tensor, box_vectors: Tensor | None) Tensor#

Compute the displacement between pairs of points, optionally taking periodic boundary conditions into account.

Parameters:
  • positions (torch.Tensor) – a Tensor of shape (n_points, 3) containing the Cartesian coordinates of each point

  • pairs (torch.Tensor) – a Tensor of shape (n_pairs, 2). Each row contains the indices of two points whose displacement should be computed.

  • box_vectors (torch.Tensor | None) – a Tensor of shape (3, 3) containing box vectors defining the periodic box. If None, periodic boundary conditions are not used.

Returns:

a Tensor of shape (n_pairs, 3). Each row contains the displacement between the corresponding pair of points.

Return type:

torch.Tensor