From fd5b627cf03b60d25476d04b1e2ca1454f7446da Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 2 May 2014 15:49:01 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11887 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/compute.cpp | 1 + src/compute.h | 8 ++++---- src/fix.cpp | 1 + src/fix.h | 1 + src/group.cpp | 4 ++-- src/modify.cpp | 17 +++++++++++++++++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/compute.cpp b/src/compute.cpp index f9a95e8d10..9367983656 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -68,6 +68,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) timeflag = 0; comm_forward = comm_reverse = 0; + dynamic_group_allow = 1; cudable = 0; invoked_scalar = invoked_vector = invoked_array = -1; diff --git a/src/compute.h b/src/compute.h index 2433e3ddb6..ee0b9e36a6 100644 --- a/src/compute.h +++ b/src/compute.h @@ -20,7 +20,6 @@ namespace LAMMPS_NS { class Compute : protected Pointers { public: - char *id,*style; int igroup,groupbit; @@ -75,13 +74,14 @@ class Compute : protected Pointers { double dof; // degrees-of-freedom for temperature - int comm_forward; // size of forward communication (0 if none) - int comm_reverse; // size of reverse communication (0 if none) + int comm_forward; // size of forward communication (0 if none) + int comm_reverse; // size of reverse communication (0 if none) + int dynamic_group_allow; // 1 if can be used with dynamic group, else 0 unsigned int datamask; unsigned int datamask_ext; - int cudable; // 1 if compute is CUDA-enabled + int cudable; // 1 if compute is CUDA-enabled Compute(class LAMMPS *, int, char **); virtual ~Compute(); diff --git a/src/fix.cpp b/src/fix.cpp index e4b7e0d411..e904809a1b 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -58,6 +58,7 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) create_attribute = 0; restart_pbc = 0; wd_header = wd_section = 0; + dynamic_group_allow = 0; cudable_comm = 0; scalar_flag = vector_flag = array_flag = 0; diff --git a/src/fix.h b/src/fix.h index 92f377ff5a..550d487ae8 100644 --- a/src/fix.h +++ b/src/fix.h @@ -46,6 +46,7 @@ class Fix : protected Pointers { // so write_restart must remap to PBC int wd_header; // # of header values fix writes to data file int wd_section; // # of sections fix writes to data file + int dynamic_group_allow; // 1 if can be used with dynamic group, else 0 int cudable_comm; // 1 if fix has CUDA-enabled communication int scalar_flag; // 0/1 if compute_scalar() function exists diff --git a/src/group.cpp b/src/group.cpp index 17a79fefb1..080b5c23af 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -500,8 +500,8 @@ void Group::assign(int narg, char **arg) if (me == 0) { if (dynamic[igroup]) { - if (screen) fprintf(screen,"dynamic group %s\n",names[igroup]); - if (logfile) fprintf(logfile,"dynamic group %s\n",names[igroup]); + if (screen) fprintf(screen,"dynamic group %s defined\n",names[igroup]); + if (logfile) fprintf(logfile,"dynamic group %s defined\n",names[igroup]); } else { if (screen) fprintf(screen,"%.15g atoms in group %s\n",all,names[igroup]); diff --git a/src/modify.cpp b/src/modify.cpp index 75f23f89b0..c454ff928c 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -217,6 +217,23 @@ void Modify::init() } addstep_compute_all(update->ntimestep); + // error if any fix or compute is using a dynamic group when not allowed + + for (i = 0; i < nfix; i++) + if (!fix[i]->dynamic_group_allow && group->dynamic[fix[i]->igroup]) { + char str[128]; + sprintf(str,"Fix %s does not allow use of dynamic group",fix[i]->id); + error->all(FLERR,str); + } + + for (i = 0; i < ncompute; i++) + if (!compute[i]->dynamic_group_allow && + group->dynamic[compute[i]->igroup]) { + char str[128]; + sprintf(str,"Compute %s does not allow use of dynamic group",fix[i]->id); + error->all(FLERR,str); + } + // warn if any particle is time integrated more than once int nlocal = atom->nlocal;