xnn.gnn.models.gemnet.reverse_edges#

xnn.gnn.models.gemnet.reverse_edges(edge_index, edge_vec)[source]#

The index of the reverse a -> c of every directed edge c -> a.

The reverse of an edge connects the same atoms the other way with the exactly negated edge vector, so periodic images are told apart.

Parameters:
  • edge_index (Tensor) – Edge index of shape (2, E) (row 0 source, row 1 destination).

  • edge_vec (Tensor) – Edge vectors x_dst - x_src (cell shifts included), shape (E, 3).

Returns:

rev of shape (E,).

Return type:

Tensor

Raises:

RuntimeError – If the edge list is not closed under reversal.