structuretoolkit.build.geometry.merge

Contents

structuretoolkit.build.geometry.merge#

structuretoolkit.build.geometry.merge(structure: Atoms, cutoff: float = 1.8, iterations: int = 10) Atoms[source]#

Merge pairs of atoms that are closer than cutoff by collapsing each pair to their midpoint and deleting one of the two atoms.

The operation is applied repeatedly (up to iterations times) to handle cases where a merge creates new close contacts.

Note

The structure is modified in place. Pass a copy if you need the original to remain unchanged.

Parameters:
  • structure (ase.Atoms) – Structure to modify.

  • cutoff (float) – Distance threshold in Ångström below which two atoms are considered clashing and will be merged. Defaults to 1.8.

  • iterations (int) – Maximum number of recursive merge passes. Defaults to 10.

Returns:

The modified structure with clashing atom pairs replaced by single atoms at their midpoints.

Return type:

ase.Atoms