mlipops.periodic_displacements#

mlipops.periodic_displacements(displacements: Tensor, box_vectors: Tensor | None) Tensor#

Apply periodic boundary conditions to a 1D to 2D set of displacement vectors.

Parameters:
  • displacements (torch.Tensor) – a Tensor of shape (M, 3) or (M, N, 3) where M and N are arbitrary. Each of the M or M*N displacement vectors should be the difference between a pair of positions in 3D space.

  • 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 and the displacement vectors are returned unchanged.

Returns:

a Tensor of the same shape as displacements. The vectors have been modified to apply periodic boundary conditions.

Return type:

torch.Tensor