From 2e1b7a0f0e5e587d0835675631bc9bcc39cc8f25 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 May 2012 14:58:24 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8037 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/domain.cpp | 3 ++- src/fix_deform.cpp | 7 +++++-- src/fix_nh.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/domain.cpp b/src/domain.cpp index bc5e283e5f..f38e50ede0 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -758,7 +758,7 @@ void Domain::closest_image(const double * const xi, const double * const xj, /* ---------------------------------------------------------------------- remap the point into the periodic box no matter how far away - adjust image accordingly + adjust 3 image flags encoded in image accordingly resulting coord must satisfy lo <= coord < hi MAX is important since coord - prd < lo can happen when coord = hi for triclinic, point is converted to lamda coords (0-1) before doing remap @@ -849,6 +849,7 @@ void Domain::remap(double *x, int &image) /* ---------------------------------------------------------------------- remap the point into the periodic box no matter how far away + no image flag calculation resulting coord must satisfy lo <= coord < hi MAX is important since coord - prd < lo can happen when coord = hi for triclinic, point is converted to lamda coords (0-1) before remap diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index f6e552d418..2c9edcf7de 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -636,9 +636,11 @@ void FixDeform::init() /* ---------------------------------------------------------------------- box flipped on previous step reset box tilts for flipped config and create new box in domain + image_flip() adjusts image flags due to box shape change induced by flip remap() puts atoms outside the new box back into the new box - image_tilt() adjusts image flags due to box shape change induced by flip perform irregular on atoms in lamda coords to migrate atoms to new procs + important that image_flip comes before remap, since remap may change + image flags to new values, making eqs in doc of Domain:image_flip incorrect ------------------------------------------------------------------------- */ void FixDeform::pre_exchange() @@ -651,11 +653,12 @@ void FixDeform::pre_exchange() domain->set_global_box(); domain->set_local_box(); + domain->image_flip(flipxy,flipxz,flipyz); + double **x = atom->x; int *image = atom->image; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]); - domain->image_flip(flipxy,flipxz,flipyz); domain->x2lamda(atom->nlocal); irregular->migrate_atoms(); diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index d7b3992565..3b79dc87fa 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -2146,9 +2146,11 @@ void FixNH::nh_omega_dot() if xy tilt exceeded, adjust B vector by one A vector check yz first since it may change xz, then xz check comes after if any flip occurs, create new box in domain - remap() puts atoms outside the new box back into the new box image_flip() adjusts image flags due to box shape change induced by flip + remap() puts atoms outside the new box back into the new box perform irregular on atoms in lamda coords to migrate atoms to new procs + important that image_flip comes before remap, since remap may change + image flags to new values, making eqs in doc of Domain:image_flip incorrect ------------------------------------------------------------------------- */ void FixNH::pre_exchange() @@ -2201,11 +2203,12 @@ void FixNH::pre_exchange() domain->set_global_box(); domain->set_local_box(); + domain->image_flip(flipxy,flipxz,flipyz); + double **x = atom->x; int *image = atom->image; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]); - domain->image_flip(flipxy,flipxz,flipyz); domain->x2lamda(atom->nlocal); irregular->migrate_atoms();