From ee61fe3043766611ef6974d8987aa1929ebadbe2 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 30 Oct 2013 14:49:31 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10891 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/dump_custom.cpp | 3 ++- src/fix_nve_limit.cpp | 10 ++++++++++ src/set.cpp | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 38ea537281..4e4b4224e4 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -540,7 +540,8 @@ int DumpCustom::count() tagint *image = atom->image; double yprd = domain->yprd; for (i = 0; i < nlocal; i++) - dchoose[i] = x[i][1] + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd; + dchoose[i] = x[i][1] + + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd; ptr = dchoose; nstride = 1; } else if (thresh_array[ithresh] == ZU) { diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 29d287f185..2104d622a3 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -20,6 +20,8 @@ #include "force.h" #include "update.h" #include "respa.h" +#include "modify.h" +#include "comm.h" #include "error.h" using namespace LAMMPS_NS; @@ -65,6 +67,14 @@ void FixNVELimit::init() if (strstr(update->integrate_style,"respa")) step_respa = ((Respa *) update->integrate)->step; + + // warn if using fix shake, which will lead to invalid constraint forces + + for (int i = 0; i < modify->nfix; i++) + if (strcmp(modify->fix[i]->style,"shake") == 0) { + if (comm->me == 0) + error->warning(FLERR,"Should not use fix nve/limit with fix shake"); + } } /* ---------------------------------------------------------------------- diff --git a/src/set.cpp b/src/set.cpp index ffc09194b1..5c0774f6c4 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -674,6 +674,20 @@ void Set::set(int keyword) atom->angmom[i][2] = zvalue; } + // reset any or all of 3 image flags + + else if (keyword == IMAGE) { + int xbox = (atom->image[i] & IMGMASK) - IMGMAX; + int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX; + int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX; + if (ximageflag) xbox = ximage; + if (yimageflag) ybox = yimage; + if (zimageflag) zbox = zimage; + atom->image[i] = ((tagint) (xbox + IMGMAX) & IMGMASK) | + (((tagint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); + } + // set value for custom integer or double vector else if (keyword == INAME) {