From 7b54985e588e529fa1ca0718afead54a671bcd07 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Mon, 6 Aug 2007 17:09:24 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@776 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/domain.cpp | 22 +++++++++++++++++----- src/domain.h | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/domain.cpp b/src/domain.cpp index ce992bc16c..ed4dc7bc29 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -270,23 +270,27 @@ void Domain::set_local_box() /* ---------------------------------------------------------------------- reset global & local boxes due to global box boundary changes if shrink-wrapped, determine atom extent and reset boxlo/hi - shrink-wrapping only occurs in non-periodic, non-triclinic dims + if shrink-wrapped and triclinic, perform shrink-wrap in box coords ------------------------------------------------------------------------- */ void Domain::reset_box() { if (nonperiodic == 2) { + // convert back to box coords for shrink-wrap operation + + if (triclinic) lamda2x(atom->nlocal); + // compute extent of atoms on this proc double extent[3][2],all[3][2]; extent[2][0] = extent[1][0] = extent[0][0] = BIG; extent[2][1] = extent[1][1] = extent[0][1] = -BIG; - + double **x = atom->x; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { extent[0][0] = MIN(extent[0][0],x[i][0]); extent[0][1] = MAX(extent[0][1],x[i][0]); @@ -306,8 +310,8 @@ void Domain::reset_box() MPI_Allreduce(extent,all,6,MPI_DOUBLE,MPI_MAX,world); // in shrink-wrapped dims, set box by atom extent - // if set, observe min box size settings - + // if minimum set, enforce min box size settings + if (xperiodic == 0) { if (boundary[0][0] == 2) boxlo[0] = -all[0][0] - SMALL; else if (boundary[0][0] == 3) boxlo[0] = MIN(-all[0][0]-SMALL,minxlo); @@ -333,6 +337,14 @@ void Domain::reset_box() set_global_box(); set_local_box(); + + // if shrink-wrapped, convert to lamda coords for new box + // must re-invoke pbc() b/c x2lamda result can be outside 0,1 due to roundoff + + if (nonperiodic == 2 && triclinic) { + x2lamda(atom->nlocal); + pbc(); + } } /* ---------------------------------------------------------------------- diff --git a/src/domain.h b/src/domain.h index 4f31ef57db..07b4d13594 100644 --- a/src/domain.h +++ b/src/domain.h @@ -52,10 +52,10 @@ class Domain : protected Pointers { double boxlo_lamda[3],boxhi_lamda[3]; // lamda box = (0,1) double boxlo_bound[3],boxhi_bound[3]; // bounding box of tilted domain - // orthogonal box + // orthogonal box & triclinic box double minxlo,minxhi; // minimum size of global box double minylo,minyhi; // when shrink-wrapping - double minzlo,minzhi; // no shrink-wrapping for triclinic + double minzlo,minzhi; // tri only possible for non-skew dims // orthogonal box double sublo[3],subhi[3]; // sub-box bounds on this proc