@@ -13,17 +13,40 @@ def repulse(
1313 iterations : int = 100 ,
1414 inplace = False ,
1515):
16- """Displace atoms to avoid minimum overlap.
16+ """Iteratively displace atoms apart until all interatomic distances exceed a minimum threshold.
17+
18+ For each pair of atoms closer than ``min_dist``, the atom is displaced away from its nearest
19+ neighbour by up to ``step_size`` along the direction of the interatomic vector. The loop
20+ repeats until all nearest-neighbour distances satisfy the minimum criterion or the iteration
21+ limit is reached.
1722
1823 Args:
1924 structure (:class:`ase.Atoms`):
20- structure to modify
25+ Structure to modify.
2126 min_dist (float):
22- Minimum distance to enforce between atoms
27+ Minimum interatomic distance (in Å) to enforce between every pair of atoms.
28+ Defaults to 1.5.
2329 step_size (float):
24- Maximum distance to displace atoms in one step
30+ Maximum displacement (in Å) applied to a single atom per iteration.
31+ Smaller values give smoother convergence but require more iterations.
32+ Defaults to 0.2.
33+ axis (int or None):
34+ Cartesian axis index (0, 1, or 2) along which displacements are restricted.
35+ When *None* (default) displacements are applied in all three directions.
2536 iterations (int):
26- Maximum number of displacements made before giving up
37+ Maximum number of displacement steps before raising a :class:`RuntimeError`.
38+ Defaults to 100.
39+ inplace (bool):
40+ If *True*, the positions of ``structure`` are modified directly.
41+ If *False* (default), a copy is made and the original is left unchanged.
42+
43+ Returns:
44+ :class:`ase.Atoms`: The structure with adjusted atomic positions. This is the
45+ same object as ``structure`` when ``inplace=True``, or a new copy otherwise.
46+
47+ Raises:
48+ RuntimeError: If the minimum distance criterion is not satisfied within
49+ ``iterations`` steps.
2750 """
2851 if not inplace :
2952 structure = structure .copy ()
0 commit comments