xnn.ffnn.models.geometry.half_edges#

xnn.ffnn.models.geometry.half_edges(data, excl_index, n, module)[source]#

The neighbor list’s pairs once each, with the exclusions of a bound topology.

The directed list holds every pair in both directions; this keeps src <= dst, so a pair term is evaluated once and its energy split between its two atoms. An atom’s own periodic images (src = dst, a cell shorter than the cutoff) keep both directions at half weight each. The excluded pairs are looked up in the sorted keys of the batch’s exclusions (made once per batch size and device, cached on module).

Parameters:
  • data (AtomicGraph) – The batched graph (copies of one topology of n atoms).

  • excl_index (Tensor) – The excluded pairs (2, E) of one structure.

  • n (int) – Atoms per structure.

  • module (torch.nn.Module) – The model holding the cache.

Returns:

src, dst (P,), the vectors (P, 3) (differentiable in the positions and the cell), their squared lengths (P,), the weights (P,) (one half for an own image, one otherwise), whether each pair is not excluded (P,) and the integer image shifts (P, 3) (None without a cell).

Return type:

tuple of Tensor