xnn.common.data.neighborlist.unique_pairs#

xnn.common.data.neighborlist.unique_pairs(pos, cutoff, cell=None, pbc=None, half=None)[source]#

Every pair within cutoff once, as (i, k, shift) with i < k, sorted by i.

The same pairs as the edges src < dst of build_neighbor_list(), with the displacement pos[k] - pos[i] + shift @ cell. vesin’s half list gives them directly, without the second direction of every pair; without vesin they are filtered from the full list. An atom’s own periodic images are not pairs. In an orthorhombic cell on the GPU (cell_grid()) a grid search finds them instead, sorted by i, with one host read.

Parameters:
  • pos (Tensor) – Cartesian positions of shape (N, 3).

  • cutoff (float) – Neighbor cutoff radius.

  • cell (Tensor, optional) – Lattice vectors as rows, of shape (3, 3).

  • pbc (Tensor, optional) – Boolean periodicity flags of shape (3,).

  • half (tuple, optional) – The half_list() of these positions, when already found.

Returns:

i and k of shape (M,) and the integer image shifts (M, 3).

Return type:

tuple of Tensor