Skip neighbor folding at first call

There may be issues due to the fact that the NL is initialized
with the LAMMPS data file, that does not have to be the same
as the starting config in i-PI
This commit is contained in:
Michele Ceriotti
2024-07-05 09:07:30 +02:00
parent 0d54f99fc0
commit 810698dc07
2 changed files with 9 additions and 1 deletions

View File

@ -188,6 +188,7 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), irregul
master = (comm->me == 0) ? 1 : 0;
inet = 1;
reset_flag = 0;
firsttime = 1;
int iarg = 5;
while (iarg < narg) {
@ -253,6 +254,7 @@ void FixIPI::init()
ipisock = 0;
// TODO: should check for success in socket opening,
// but the current open_socket routine dies brutally if unsuccessful
// tell lammps we have assigned a socket
socketflag = 1;
@ -382,7 +384,11 @@ void FixIPI::initial_integrate(int /*vflag*/)
// snapshot at neighbor list creation, minimizing the
// number of neighbor list updates
auto xhold = neighbor->get_xhold();
if (xhold != NULL) { // don't wrap if xhold is not used in the NL
if (xhold != NULL && !firsttime) {
// don't wrap if xhold is not used in the NL, or the
// first call (because the NL is initialized from the
// data file that might have nothing to do with the
// current structure
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
auto delx = x[i][0] - xhold[i][0];
@ -397,6 +403,7 @@ void FixIPI::initial_integrate(int /*vflag*/)
}
}
}
firsttime = 0;
// check if kspace solver is used
if (reset_flag && kspace_flag) {

View File

@ -42,6 +42,7 @@ class FixIPI : public Fix {
long bsize;
int kspace_flag;
int reset_flag;
int firsttime;
private:
class Irregular *irregular;