Try a (dirty) fix to the i-pi neighbor list update problem
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
#include "update.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -363,10 +364,36 @@ void FixIPI::initial_integrate(int /*vflag*/)
|
||||
// has to be be done before invoking Irregular::migrate_atoms()
|
||||
// since it requires atoms be inside simulation box
|
||||
|
||||
|
||||
if (neighbor->ncalls == 0) {
|
||||
|
||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
if (domain->triclinic) domain->lamda2x(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
if (domain->triclinic) domain->lamda2x(atom->nlocal);
|
||||
} else { // for some reason this fails if it's called on the first step.
|
||||
// "unwraps" the trajectory because we have no guarantee of what has happened
|
||||
// server-side to the atoms folding
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
x[i][0] -= neighbor->xhold[i][0];
|
||||
x[i][1] -= neighbor->xhold[i][1];
|
||||
x[i][2] -= neighbor->xhold[i][2];
|
||||
}
|
||||
}
|
||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
if (domain->triclinic) domain->lamda2x(atom->nlocal);
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
x[i][0] += neighbor->xhold[i][0];
|
||||
x[i][1] += neighbor->xhold[i][1];
|
||||
x[i][2] += neighbor->xhold[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**/
|
||||
|
||||
// move atoms to new processors via irregular()
|
||||
// only needed if migrate_check() says an atom moves to far
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace NeighConst;
|
||||
@ -2384,12 +2385,16 @@ int Neighbor::check_distance()
|
||||
dely = x[i][1] - xhold[i][1];
|
||||
delz = x[i][2] - xhold[i][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
if (rsq > deltasq) flag = 1;
|
||||
if (rsq > deltasq) {
|
||||
std::cout<<"jump: "<< rsq<<std::endl;
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int flagall;
|
||||
MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_MAX,world);
|
||||
if (flagall && ago == MAX(every,delay)) ndanger++;
|
||||
std::cout<<" neigh update flags "<< flagall<< " "<< ago << " "<<ndanger<<std::endl;
|
||||
return flagall;
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,8 @@ class Neighbor : protected Pointers {
|
||||
|
||||
double *bboxlo, *bboxhi; // ptrs to full domain bounding box
|
||||
// different for orthog vs triclinic
|
||||
|
||||
double **xhold; // atom coords at last neighbor build
|
||||
int maxhold; // size of xhold array
|
||||
// exclusion info, used by NeighPair
|
||||
|
||||
int exclude; // 0 if no type/group exclusions, 1 if yes
|
||||
@ -190,8 +191,8 @@ class Neighbor : protected Pointers {
|
||||
|
||||
double triggersq; // trigger = build when atom moves this dist
|
||||
|
||||
double **xhold; // atom coords at last neighbor build
|
||||
int maxhold; // size of xhold array
|
||||
//double **xhold; // atom coords at last neighbor build
|
||||
//int maxhold; // size of xhold array
|
||||
|
||||
int boxcheck; // 1 if need to store box size
|
||||
double boxlo_hold[3], boxhi_hold[3]; // box size at last neighbor build
|
||||
|
||||
Reference in New Issue
Block a user