xnn.ffnn.models.topology.guess_bonds#

xnn.ffnn.models.topology.guess_bonds(positions, atomic_numbers, cell=None, scale=1.2)[source]#

Guess covalent bonds from interatomic distances.

Two atoms are bonded when their (minimum-image) distance is below scale * (r_cov_a + r_cov_b) with the Cordero covalent radii. This is the standard structure-to-topology heuristic; inspect the result for unusual geometries.

Parameters:
  • positions (array_like) – Cartesian positions of shape (N, 3) in Angstrom.

  • atomic_numbers (array_like) – Atomic numbers of shape (N,).

  • cell (array_like, optional) – Lattice vectors as rows, shape (3, 3); when given, distances use the minimum-image convention.

  • scale (float, optional) – Multiplier on the covalent-radius sum, by default 1.2.

Returns:

Bonds as (i, j) index pairs with i < j, sorted.

Return type:

list of tuple of int

Raises:

KeyError – If an atomic number has no tabulated covalent radius.