Skip to content

Check each atom pair against its own distance tolerance - #340

Merged
qzhu2017 merged 1 commit into
MaterSim:masterfrom
kazeevn:fix/cross-species-distance-tolerance
Sep 9, 2026
Merged

Check each atom pair against its own distance tolerance#340
qzhu2017 merged 1 commit into
MaterSim:masterfrom
kazeevn:fix/cross-species-distance-tolerance

Conversation

@kazeevn

@kazeevn kazeevn commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #339

random_crystal._set_ion_wyckoffs computed a single tolerance, the like-like one of the species it was about to place, and check_wp applied it to every pair, including pairs with the species already placed.

With Tol_matrix(prototype="atomic") the pair tolerance is f * (r_A + r_B), so f * 2 * r_new is wrong for every pair of unlike species. It is too small when the species being placed is the smaller of the two, which lets the two overlap, and too large when it is the larger, which rejects legal structures. For Cs and O at f=1.3 the pair tolerance is 2.04 A, while placing O against Cs applied 0.91 A and placing Cs against O applied 3.17 A. Because the species are placed one at a time, which of the two errors a structure gets depended on the order species was given in.

check_wp now looks the tolerance up per pair from self.tol_matrix, falling back to the passed-in value for a pair with no tabulated radius. The like-like tolerance is still the right one for short_distances and merge, which stay within a single orbit of a single species, so those are unchanged.

`random_crystal._set_ion_wyckoffs` computed a single tolerance, the
like-like one of the species it was about to place, and `check_wp`
applied it to every pair, including pairs with the species already
placed.

With `Tol_matrix(prototype="atomic")` the pair tolerance is
`f * (r_A + r_B)`, so `f * 2 * r_new` is wrong for every pair of unlike
species. It is too small when the species being placed is the smaller
of the two, which lets the two overlap, and too large when it is the
larger, which rejects legal structures. For Cs and O at f=1.3 the pair
tolerance is 2.04 A, while placing O against Cs applied 0.91 A and
placing Cs against O applied 3.17 A. Because the species are placed one
at a time, which of the two errors a structure gets depended on the
order `species` was given in.

`check_wp` now looks the tolerance up per pair from `self.tol_matrix`,
falling back to the passed-in value for a pair with no tabulated radius.
The like-like tolerance is still the right one for `short_distances` and
`merge`, which stay within a single orbit of a single species, so those
are unchanged.

Measured over 400 Wyckoff site sets in space groups 1-230, the share of
generated structures containing a pair closer than the tolerance they
were generated under drops from 0.200 to 0.005, and generation gets
about twice as fast, because the over-strict half of the error no longer
makes the sampler retry.
@qzhu2017
qzhu2017 merged commit 530e125 into MaterSim:master Sep 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

random_crystal applies wrong distance tolerance to different-specie WPs

2 participants