Merge pull request #3756 from stanmoore1/triclinic_sort
Fix bug in atom sorting with triclinic boxes
This commit is contained in:
@ -165,8 +165,11 @@ void AtomKokkos::sort()
|
|||||||
|
|
||||||
if (nlocal == nmax) avec->grow(0);
|
if (nlocal == nmax) avec->grow(0);
|
||||||
|
|
||||||
|
// for triclinic, atoms must be in box coords (not lamda) to match bbox
|
||||||
|
|
||||||
|
if (domain->triclinic) domain->lamda2x(nlocal);
|
||||||
|
|
||||||
sync(Host, ALL_MASK);
|
sync(Host, ALL_MASK);
|
||||||
modified(Host, ALL_MASK);
|
|
||||||
|
|
||||||
// bin atoms in reverse order so linked list will be in forward order
|
// bin atoms in reverse order so linked list will be in forward order
|
||||||
|
|
||||||
@ -233,6 +236,12 @@ void AtomKokkos::sort()
|
|||||||
//int flagall;
|
//int flagall;
|
||||||
//MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
|
//MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
|
||||||
//if (flagall) errorX->all(FLERR,"Atom sort did not operate correctly");
|
//if (flagall) errorX->all(FLERR,"Atom sort did not operate correctly");
|
||||||
|
|
||||||
|
modified(Host, ALL_MASK);
|
||||||
|
|
||||||
|
// convert back to lamda coords
|
||||||
|
|
||||||
|
if (domain->triclinic) domain->x2lamda(nlocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -2271,6 +2271,10 @@ void Atom::sort()
|
|||||||
|
|
||||||
for (i = 0; i < nbins; i++) binhead[i] = -1;
|
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--) {
|
for (i = nlocal-1; i >= 0; i--) {
|
||||||
ix = static_cast<int> ((x[i][0]-bboxlo[0])*bininvx);
|
ix = static_cast<int> ((x[i][0]-bboxlo[0])*bininvx);
|
||||||
iy = static_cast<int> ((x[i][1]-bboxlo[1])*bininvy);
|
iy = static_cast<int> ((x[i][1]-bboxlo[1])*bininvy);
|
||||||
@ -2286,6 +2290,10 @@ void Atom::sort()
|
|||||||
binhead[ibin] = i;
|
binhead[ibin] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert back to lamda coords
|
||||||
|
|
||||||
|
if (domain->triclinic) domain->x2lamda(nlocal);
|
||||||
|
|
||||||
// permute = desired permutation of atoms
|
// permute = desired permutation of atoms
|
||||||
// permute[I] = J means Ith new atom will be Jth old atom
|
// permute[I] = J means Ith new atom will be Jth old atom
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user