From 0e511f16197669b79a2034678b8d3817f5ccb030 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 4 Apr 2008 23:17:45 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1718 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_nve_noforce.cpp | 2 ++ src/fix_nve_sphere.cpp | 2 ++ src/modify.cpp | 29 ++++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index 618daadb8a..0945030093 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -27,6 +27,8 @@ FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 3) error->all("Illegal fix nve/noforce command"); + + time_integrate = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_nve_sphere.cpp b/src/fix_nve_sphere.cpp index 65dfd19963..f960aef846 100644 --- a/src/fix_nve_sphere.cpp +++ b/src/fix_nve_sphere.cpp @@ -35,6 +35,8 @@ FixNVESphere::FixNVESphere(LAMMPS *lmp, int narg, char **arg) : { if (narg < 3) error->all("Illegal fix nve/sphere command"); + time_integrate = 1; + // process extra keywords extra = NONE; diff --git a/src/modify.cpp b/src/modify.cpp index 20ab5e9324..515ca4dc5c 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -125,7 +125,7 @@ Modify::~Modify() void Modify::init() { - int i; + int i,j; // delete storage of restart info since it is not valid after 1st run @@ -165,6 +165,33 @@ void Modify::init() for (i = 0; i < ncompute; i++) compute[i]->init(); modify->addstep_compute_all(update->ntimestep); + + // warn if any particle is time integrated more than once + + int nlocal = atom->nlocal; + int *mask = atom->mask; + + int *flag = new int[nlocal]; + for (i = 0; i < nlocal; i++) flag[i] = 0; + + int groupbit; + for (i = 0; i < nfix; i++) { + if (fix[i]->time_integrate == 0) continue; + groupbit = fix[i]->groupbit; + for (j = 0; j < nlocal; j++) + if (mask[j] & groupbit) flag[j]++; + } + + int check = 0; + for (i = 0; i < nlocal; i++) + if (flag[i] > 1) check = 1; + + delete [] flag; + + int checkall; + MPI_Allreduce(&check,&checkall,1,MPI_INT,MPI_SUM,world); + if (comm->me == 0 && checkall) + error->warning("One or more atoms are time integrated more than once"); } /* ----------------------------------------------------------------------