linked_cell

torch_sim.transforms.linked_cell(pos, cell, cutoff, num_repeats, self_interaction=False)[source]

Determine the atomic neighborhood of the atoms of a given structure for a particular cutoff using the linked cell algorithm.

This function identifies neighboring atoms within a specified cutoff distance by utilizing the linked cell method. It accounts for periodic boundary conditions (PBC) by replicating the unit cell in all directions as necessary.

Parameters:
  • pos (Tensor) – A tensor of shape [n_atom, 3] representing atomic positions in the unit cell.

  • cell (Tensor) – A tensor of shape [3, 3] representing the unit cell vectors.

  • cutoff (float) – The distance threshold used to determine which atoms are considered neighbors.

  • num_repeats (Tensor) – A tensor indicating the number of unit cell repetitions required in each direction to account for periodic boundary conditions.

  • self_interaction (bool, optional) – If set to True, the original atoms will be included as their own neighbors. Default is False.

Returns:

  • neigh_atom (torch.Tensor): A tensor containing pairs of indices where neigh_atom[0] represents the original atom indices and neigh_atom[1] represents their corresponding neighbor indices.

  • neigh_shift_idx (torch.Tensor): A tensor containing the cell shift indices for each neighbor atom, which are necessary for reconstructing the positions of the neighboring atoms.

Return type:

tuple[Tensor, Tensor]