From a4d56b56abf695fae64d36cc9a8ab76fb66b66f4 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Thu, 27 Apr 2023 10:27:38 -0600 Subject: [PATCH] Fix bug in atom sorting with triclinic boxes --- src/atom.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/atom.cpp b/src/atom.cpp index 87be0fa4b0..3f2f4550e9 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2271,6 +2271,10 @@ void Atom::sort() for (i = 0; i < nbins; i++) binhead[i] = -1; + // for triclinic, atoms must be in box coords (not lamda) to match bbox + + if (domain->triclinic) domain->lamda2x(nlocal); + for (i = nlocal-1; i >= 0; i--) { ix = static_cast ((x[i][0]-bboxlo[0])*bininvx); iy = static_cast ((x[i][1]-bboxlo[1])*bininvy); @@ -2286,6 +2290,10 @@ void Atom::sort() binhead[ibin] = i; } + // convert back to lamda coords + + if (domain->triclinic) domain->x2lamda(nlocal); + // permute = desired permutation of atoms // permute[I] = J means Ith new atom will be Jth old atom