Check each atom pair against its own distance tolerance - #340
Merged
qzhu2017 merged 1 commit intoSep 9, 2026
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #339
random_crystal._set_ion_wyckoffscomputed a single tolerance, the like-like one of the species it was about to place, andcheck_wpapplied it to every pair, including pairs with the species already placed.With
Tol_matrix(prototype="atomic")the pair tolerance isf * (r_A + r_B), sof * 2 * r_newis 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 orderspecieswas given in.check_wpnow looks the tolerance up per pair fromself.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 forshort_distancesandmerge, which stay within a single orbit of a single species, so those are unchanged.