get_geometry_from_xyz#

get_geometry_from_xyz(positions, central_idx, r_cut=2.5, tol=15, verbose=False, ignore_scale=False)[source]#

Determine the bonded geometry of a central atom based on atomic positions from xyz coordinates.

Parameters:
  • positions (numpy.ndarray) – Array of atomic positions with shape (N, 3).

  • central_idx (int) – Index of the central atom in the positions array.

  • r_cut (float, optional) – Distance cutoff (in Å) to filter neighboring atoms. Defaults to 2.5.

  • tol (float, optional) – Tolerance for angle comparison in degrees. Defaults to 15.

  • verbose (bool, optional) – If True, prints additional debugging information. Defaults to False.

  • ignore_scale (bool, optional) – If True, ignores the warning when the minimum bond is not between 0.8 and 1.5 Å.

Returns:

The determined geometry of the central atom as a string, or a tuple (geometry, n) where n is the number of neighbors. Returns an empty string if undetermined.

Return type:

str or tuple

Raises:

ValueError – If the minimum bond distance is outside the expected range and ignore_scale is False.

Notes

This function uses heuristics based on pairwise angles between neighboring atoms to classify the geometry.