From 76e7a949bdf61f822e42ef44f1079029e8a1d554 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 5 Feb 2014 17:30:23 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11476 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_langevin.cpp | 1 - src/fix_vector.cpp | 4 -- src/fix_vector.h | 96 -------------------------------------------- src/group.cpp | 69 +++++++++++++++++++++++++++++++ src/group.h | 1 + 5 files changed, 70 insertions(+), 101 deletions(-) diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index d4eb9718a1..bf14e5a54a 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -201,7 +201,6 @@ int FixLangevin::setmask() int mask = 0; mask |= POST_FORCE; mask |= POST_FORCE_RESPA; - mask |= POST_INTEGRATE; mask |= END_OF_STEP; mask |= THERMO_ENERGY; return mask; diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 5e2ae4b562..7ecd49d049 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -11,10 +11,6 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- - Contributing author: Pieter in 't Veld (SNL) -------------------------------------------------------------------------- */ - #include "string.h" #include "fix_vector.h" #include "update.h" diff --git a/src/fix_vector.h b/src/fix_vector.h index 4bfed79e0c..0d3511d695 100644 --- a/src/fix_vector.h +++ b/src/fix_vector.h @@ -20,7 +20,6 @@ FixStyle(vector,FixVector) #ifndef LMP_FIX_VECTOR_H #define LMP_FIX_VECTOR_H -#include "stdio.h" #include "fix.h" namespace LAMMPS_NS { @@ -53,99 +52,4 @@ class FixVector : public Fix { /* ERROR/WARNING messages: -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Compute ID for fix ave/time does not exist - -Self-explanatory. - -E: Fix ID for fix ave/time does not exist - -Self-explanatory. - -E: Invalid fix ave/time off column - -Self-explantory. - -E: Fix ave/time compute does not calculate a scalar - -Self-explantory. - -E: Fix ave/time compute does not calculate a vector - -Self-explantory. - -E: Fix ave/time compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix ave/time compute does not calculate an array - -Self-explanatory. - -E: Fix ave/time compute array is accessed out-of-range - -An index for the array is out of bounds. - -E: Fix ave/time fix does not calculate a scalar - -Self-explanatory. - -E: Fix ave/time fix does not calculate a vector - -Self-explanatory. - -E: Fix ave/time fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix for fix ave/time not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/time -is requesting a value on a non-allowed timestep. - -E: Fix ave/time fix does not calculate an array - -Self-explanatory. - -E: Fix ave/time fix array is accessed out-of-range - -An index for the array is out of bounds. - -E: Variable name for fix ave/time does not exist - -Self-explanatory. - -E: Fix ave/time variable is not equal-style variable - -Self-explanatory. - -E: Fix ave/time cannot use variable with vector mode - -Variables produce scalar values. - -E: Fix ave/time columns are inconsistent lengths - -Self-explanatory. - -E: Fix ave/time cannot set output array intensive/extensive from these inputs - -One of more of the vector inputs has individual elements which are -flagged as intensive or extensive. Such an input cannot be flagged as -all intensive/extensive when turned into an array by fix ave/time. - -E: Cannot open fix ave/time file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Fix ave/time missed timestep - -You cannot reset the timestep to a value beyond where the fix -expects to next perform averaging. - */ diff --git a/src/group.cpp b/src/group.cpp index ce99834a6e..a39f65ca47 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -51,10 +51,12 @@ Group::Group(LAMMPS *lmp) : Pointers(lmp) names = new char*[MAX_GROUP]; bitmask = new int[MAX_GROUP]; inversemask = new int[MAX_GROUP]; + dynamic = new int[MAX_GROUP]; for (int i = 0; i < MAX_GROUP; i++) names[i] = NULL; for (int i = 0; i < MAX_GROUP; i++) bitmask[i] = 1 << i; for (int i = 0; i < MAX_GROUP; i++) inversemask[i] = bitmask[i] ^ ~0; + for (int i = 0; i < MAX_GROUP; i++) dynamic[i] = 0; // create "all" group @@ -75,6 +77,7 @@ Group::~Group() delete [] names; delete [] bitmask; delete [] inversemask; + delete [] dynamic; } /* ---------------------------------------------------------------------- @@ -114,8 +117,17 @@ void Group::assign(int narg, char **arg) int bits = inversemask[igroup]; for (i = 0; i < nlocal; i++) mask[i] &= bits; + if (dynamic[igroup]) { + int n = strlen("GROUP_") + strlen(names[igroup]) + 1; + char *fixID = new char[n]; + sprintf(fixID,"GROUP_%s",names[igroup]); + modify->delete_fix(fixID); + delete [] fixID; + } + delete [] names[igroup]; names[igroup] = NULL; + dynamic[igroup] = 0; ngroup--; return; @@ -156,6 +168,7 @@ void Group::assign(int narg, char **arg) mask[i] |= bit; // style = type, molecule, id + // add to group if atom matches type/molecule/id or condition } else if (strcmp(arg[1],"type") == 0 || strcmp(arg[1],"molecule") == 0 || strcmp(arg[1],"id") == 0) { @@ -296,6 +309,7 @@ void Group::assign(int narg, char **arg) } // style = variable + // add to group if atom-atyle variable is non-zero } else if (strcmp(arg[1],"variable") == 0) { @@ -331,6 +345,8 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); + if (dynamic[jgroup]) + error->all(FLERR,"Cannot subtract groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -367,6 +383,8 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); + if (dynamic[jgroup]) + error->all(FLERR,"Cannot union groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -395,6 +413,8 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); + if (dynamic[jgroup]) + error->all(FLERR,"Cannot intersect groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -413,6 +433,55 @@ void Group::assign(int narg, char **arg) delete [] list; + // style = dynamic + // create a new FixGroup to dynamically determine atoms in group + + } else if (strcmp(arg[1],"dynamic") == 0) { + + if (narg < 4) error->all(FLERR,"Illegal group command"); + + // if group is already dynamic, delete current FixGroup + + if (dynamic[igroup]) { + int n = strlen("GROUP_") + strlen(names[igroup]) + 1; + char *fixID = new char[n]; + sprintf(fixID,"GROUP_%s",names[igroup]); + modify->delete_fix(fixID); + delete [] fixID; + } + + dynamic[igroup] = 1; + + int n = strlen("GROUP_") + strlen(names[igroup]) + 1; + char *fixID = new char[n]; + sprintf(fixID,"GROUP_%s",names[igroup]); + + char **newarg = new char*[narg]; + newarg[0] = fixID; + newarg[1] = arg[2]; + newarg[2] = (char *) "GROUP"; + for (int i = 3; i < narg; i++) newarg[i] = arg[i]; + modify->add_fix(narg,newarg); + delete [] newarg; + delete [] fixID; + + // style = static + // remove dynamic FixGroup if necessary + + } else if (strcmp(arg[1],"static") == 0) { + + if (narg != 2) error->all(FLERR,"Illegal group command"); + + if (dynamic[igroup]) { + int n = strlen("GROUP_") + strlen(names[igroup]) + 1; + char *fixID = new char[n]; + sprintf(fixID,"GROUP_%s",names[igroup]); + modify->delete_fix(fixID); + delete [] fixID; + } + + dynamic[igroup] = 0; + // not a valid group style } else error->all(FLERR,"Illegal group command"); diff --git a/src/group.h b/src/group.h index 31a27932de..842c7146ea 100644 --- a/src/group.h +++ b/src/group.h @@ -25,6 +25,7 @@ class Group : protected Pointers { char **names; // name of each group int *bitmask; // one-bit mask for each group int *inversemask; // inverse mask for each group + int *dynamic; // 1 if dynamic, 0 if not Group(class LAMMPS *); ~Group();