New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in atom sorting with triclinic boxes #3756
Conversation
Looking at this more, it seems like the "correct" solution would be to bin in lamda coords (similar to PPPM) instead of using a bounding box which has extra volume for a skewed box. However, this would require changing the neigh list binning too so everything matches to maximize cache hits/data locality. |
Though lamda coords with a highly skewed grid could bin up far away atoms in the corners of the skewed bins. I think we should just merge this PR for now. |
I did some testing on this, and verified that you can bin in lambda coords, as you suggest. The key is to define bbox in lamda coords, which are provided by domain->sublo_lamda, etc.:
|
@athomps is this for zero skew? |
This PR fixes the performance regression I saw for ReaxFF in PR #3740 on GPUs. |
I don't think sorting in lamda coords is straightforward to do robustly. This is because the motion of atoms |
I agree with @sjplimp, I think we should just stick with converting the atom positions using |
Yeah, I see. Atoms in the same skewed lamda bin can be arbitrarily far apart. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve.
Summary
Atom sorting for triclinic boxes is currently broken because atom positions are in 0...1 "lamda" coords but the bounding box and binsize are in regular box coords. This makes sorting a no-op for many cases since all atoms end up in the same bin. This PR fixes the issue by temporarily converting the atom positions back to box coords for sorting.
Alternatively the bounding box and binsize could be converted to lambda coords, but that seems more complex and would require many more changes to the code. We could consider this path though if other developers think it is better.
Related Issue(s)
#3740
Author(s)
Stan Moore (SNL)
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
Yes