wrap_positions

torch_sim.transforms.wrap_positions(positions, cell, *, pbc=True, center=(0.5, 0.5, 0.5), pretty_translation=False, eps=1e-7)[source]

ASE wrap_positions in pytorch.

Wrap atomic positions to unit cell.

Parameters:
  • positions (Tensor) – Atomic positions [N, 3].

  • cell (Tensor) – Unit cell matrix [3, 3].

  • pbc (Union[bool, list[bool], Tensor]) – Whether to apply periodic boundary conditions.

  • center (Tuple[float, float, float]) – Center of the cell as (x,y,z) tuple, defaults to (0.5, 0.5, 0.5).

  • pretty_translation (bool) – Whether to minimize the spread of fractional coordinates.

  • eps (float) – Small number to handle edge cases in wrapping.

Returns:

Wrapped positions in Cartesian coordinates [N, 3].

Return type:

Tensor