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.In a periodic cell every image within the bond cutoff is considered, for any (also unreduced) cell: a pair can only be that close when each fractional component of its displacement lies within
cutoff / h_iof a lattice plane (h_ithe spacing of the planes along axisi), so the distances of the few pairs passing that test are minimized over their candidate images.- 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 withi < j, sorted.- Return type:
- Raises:
KeyError – If an atomic number has no tabulated covalent radius.