Fix: Bug in pairwise minimum distance calculation#1
Open
jsukpark wants to merge 1 commit into
Open
Conversation
- Setting `d2_min2` references array `car4`, whose contents change at each `kaux`
- Hence must be updated at `kaux` for-loop level
- This prevented, e.g., quartet (0, 0, 1, 2) of 2x2x2 diamond supercell (up to 2nd nearest neighbor cutoff) from being considered
- Even though all 4 atoms are within the interaction range
- Its permutation (0, 0, 2, 1) is later considered
- But transformation arrays still affected
- Also removed unused local variable `d2_min`
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.
This PR fixes a bug reported in FourPhonon/FourPhonon#72.
Changes
d2_min2was being updated at the wrong for-loop leveld2_min2references arraycar4, whose contents change at eachkauxcar4atkaux == n4equi - 1is currently reflectedd2_min2after every update tocar4This causes, for example, quartet (0, 0, 1, 2) of 2x2x2 diamond supercell (up to 2nd nearest neighbor cutoff) to be skipped, even though all 6 pairwise distances are within the interaction cutoff. Its permutation (0, 0, 2, 1) is later considered and accounted for, but the final number of DFT calculations is still affected.
After this fix, using the unit cell input file
and running
sowcommand for 2x2x2 supercell with considering up to 2nd nearest neighbor cutoff, the total number of DFT calculations needed is reduced from 400 to 360.This PR also removes an unused local variable
d2_min.