xnn.common.data.grid_pairs.grid_pairs#
- xnn.common.data.grid_pairs.grid_pairs(pos, cutoff, lengths, shape, capacity=None, span=1, index_dtype=torch.int64, shift_dtype=torch.int64)[source]#
Every pair within
cutoffonce, as(i, k, shift)withi < k, sorted byi.- Parameters:
pos (Tensor) – Cartesian positions
(N, 3)on the GPU, wrapped into the cell or not.cutoff (float) – Neighbor cutoff radius.
lengths (Tensor) – The edges of the orthorhombic cell
(3,).shape (tuple of int or None) – The cells per axis, from
grid_shape()withspan;Nonesearches without a grid, every atom against those of higher index (a cell too small for one, every edge overcutoff; positions on a GPU, or on the CPU under Triton’s interpreter).capacity (int, optional) – Write the pairs into buffers of this many entries, without reading their number on the host: the entries past it repeat the first pair, and their number comes back on the device (a pair list staged behind a running step).
span (int)
index_dtype (dtype)
shift_dtype (dtype)
- Returns:
tuple of Tensor –
iandk(M,)and the integer image shifts(M, 3), with the displacementpos[k] - pos[i] + shift * lengths; withcapacitythe buffers(capacity,)and the number of pairs(1,)(more than the capacity when they did not fit).span (int, optional) – The cells per cutoff on each axis (a CPU search; 1 on a GPU).
index_dtype, shift_dtype (torch.dtype, optional) – The types of the atom indices and of the shifts (
int64by default).
- Return type: