structuretoolkit.build.geometry.repulse#
- structuretoolkit.build.geometry.repulse(structure: Atoms, min_dist: float = 1.5, step_size: float = 0.2, axis: int | None = None, iterations: int = 100, inplace: bool = False) Atoms[source]#
Iteratively displace atoms apart until all interatomic distances exceed a minimum threshold.
For each pair of atoms closer than
min_dist, the atom is displaced away from its nearest neighbour by up tostep_sizealong the direction of the interatomic vector. The loop repeats until all nearest-neighbour distances satisfy the minimum criterion or the iteration limit is reached.- Parameters:
structure (
ase.Atoms) – Structure to modify.min_dist (float) – Minimum interatomic distance (in Å) to enforce between every pair of atoms. Defaults to 1.5.
step_size (float) – Maximum displacement (in Å) applied to a single atom per iteration. Smaller values give smoother convergence but require more iterations. Defaults to 0.2.
axis (int or None) – Cartesian axis index (0, 1, or 2) along which displacements are restricted. When None (default) displacements are applied in all three directions.
iterations (int) – Maximum number of displacement steps before raising a
RuntimeError. Defaults to 100.inplace (bool) – If True, the positions of
structureare modified directly. If False (default), a copy is made and the original is left unchanged.
- Returns:
The structure with adjusted atomic positions. This is the same object as
structurewheninplace=True, or a new copy otherwise.- Return type:
ase.Atoms- Raises:
RuntimeError – If the minimum distance criterion is not satisfied within
iterationssteps.