From ce9d85d11c8b8d60c6c4eb3e675a4395be1a7cf9 Mon Sep 17 00:00:00 2001 From: tomswinburne Date: Wed, 18 Nov 2020 13:19:16 +0100 Subject: [PATCH 1/2] pbc correction --- src/REPLICA/neb.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index f785168a10..191a692023 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -490,9 +490,13 @@ void NEB::readfile(char *file, int flag) x[m][1] += fraction*dely; x[m][2] += fraction*delz; } else { - x[m][0] = xx; - x[m][1] = yy; - x[m][2] = zz; + delx = xx - x[m][0]; + dely = yy - x[m][1]; + delz = zz - x[m][2]; + domain->minimum_image(delx,dely,delz); + x[m][0] += delx; + x[m][1] += dely; + x[m][2] += delz; } } From dde42a5bd015c833c2c8404191636cc73c7f5d3b Mon Sep 17 00:00:00 2001 From: tomswinburne Date: Thu, 26 Nov 2020 16:10:58 +0100 Subject: [PATCH 2/2] updated pbc correction --- src/REPLICA/neb.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 191a692023..6f58d933a5 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -69,9 +69,7 @@ NEB::NEB(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in, MPI_Comm_rank(world,&me); // generate linear interpolate replica - double fraction = ireplica/(nreplica-1.0); - double **x = atom->x; int nlocal = atom->nlocal; @@ -465,13 +463,12 @@ void NEB::readfile(char *file, int flag) // adjust atom coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas // for flag = 1, replace existing coord with new coord - // ignore image flags of final x - // for interpolation: - // new x is displacement from old x via minimum image convention - // if final x is across periodic boundary: - // new x may be outside box - // will be remapped back into box when simulation starts - // its image flags will then be adjusted + // ignore image flags of replica x + // displacement from first replica is via minimum image convention + // if x of some replica is across periodic boundary: + // new x may be outside box + // will be remapped back into box when simulation starts + // its image flags will then be adjusted tag = ATOTAGINT(values[0]); m = atom->map(tag); @@ -481,19 +478,17 @@ void NEB::readfile(char *file, int flag) yy = atof(values[2]); zz = atof(values[3]); + delx = xx - x[m][0]; + dely = yy - x[m][1]; + delz = zz - x[m][2]; + + domain->minimum_image(delx,dely,delz); + if (flag == 0) { - delx = xx - x[m][0]; - dely = yy - x[m][1]; - delz = zz - x[m][2]; - domain->minimum_image(delx,dely,delz); x[m][0] += fraction*delx; x[m][1] += fraction*dely; x[m][2] += fraction*delz; } else { - delx = xx - x[m][0]; - dely = yy - x[m][1]; - delz = zz - x[m][2]; - domain->minimum_image(delx,dely,delz); x[m][0] += delx; x[m][1] += dely; x[m][2] += delz;