xnn.ffnn.models.geometry.pair_vectors#

xnn.ffnn.models.geometry.pair_vectors(data, a, b)[source]#

Minimum-image displacement vectors pos[b] - pos[a].

For periodic structures the integer image shift is recomputed from the fractional displacement (rounded, detached), so bonded terms are correct for molecules wrapped across the boundary while gradients still flow to positions and cell.

Parameters:
  • data (AtomicGraph) – The batched graph.

  • a (Tensor) – Atom indices of shape (M,).

  • b (Tensor) – Atom indices of shape (M,).

Returns:

Displacements of shape (M, 3).

Return type:

Tensor