git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11476 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2014-02-05 17:30:23 +00:00
parent 30b091db28
commit 76e7a949bd
5 changed files with 70 additions and 101 deletions

View File

@ -201,7 +201,6 @@ int FixLangevin::setmask()
int mask = 0; int mask = 0;
mask |= POST_FORCE; mask |= POST_FORCE;
mask |= POST_FORCE_RESPA; mask |= POST_FORCE_RESPA;
mask |= POST_INTEGRATE;
mask |= END_OF_STEP; mask |= END_OF_STEP;
mask |= THERMO_ENERGY; mask |= THERMO_ENERGY;
return mask; return mask;

View File

@ -11,10 +11,6 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Pieter in 't Veld (SNL)
------------------------------------------------------------------------- */
#include "string.h" #include "string.h"
#include "fix_vector.h" #include "fix_vector.h"
#include "update.h" #include "update.h"

View File

@ -20,7 +20,6 @@ FixStyle(vector,FixVector)
#ifndef LMP_FIX_VECTOR_H #ifndef LMP_FIX_VECTOR_H
#define LMP_FIX_VECTOR_H #define LMP_FIX_VECTOR_H
#include "stdio.h"
#include "fix.h" #include "fix.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -53,99 +52,4 @@ class FixVector : public Fix {
/* ERROR/WARNING messages: /* 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.
*/ */

View File

@ -51,10 +51,12 @@ Group::Group(LAMMPS *lmp) : Pointers(lmp)
names = new char*[MAX_GROUP]; names = new char*[MAX_GROUP];
bitmask = new int[MAX_GROUP]; bitmask = new int[MAX_GROUP];
inversemask = 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++) names[i] = NULL;
for (int i = 0; i < MAX_GROUP; i++) bitmask[i] = 1 << i; 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++) inversemask[i] = bitmask[i] ^ ~0;
for (int i = 0; i < MAX_GROUP; i++) dynamic[i] = 0;
// create "all" group // create "all" group
@ -75,6 +77,7 @@ Group::~Group()
delete [] names; delete [] names;
delete [] bitmask; delete [] bitmask;
delete [] inversemask; delete [] inversemask;
delete [] dynamic;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -114,8 +117,17 @@ void Group::assign(int narg, char **arg)
int bits = inversemask[igroup]; int bits = inversemask[igroup];
for (i = 0; i < nlocal; i++) mask[i] &= bits; 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]; delete [] names[igroup];
names[igroup] = NULL; names[igroup] = NULL;
dynamic[igroup] = 0;
ngroup--; ngroup--;
return; return;
@ -156,6 +168,7 @@ void Group::assign(int narg, char **arg)
mask[i] |= bit; mask[i] |= bit;
// style = type, molecule, id // 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 || } else if (strcmp(arg[1],"type") == 0 || strcmp(arg[1],"molecule") == 0 ||
strcmp(arg[1],"id") == 0) { strcmp(arg[1],"id") == 0) {
@ -296,6 +309,7 @@ void Group::assign(int narg, char **arg)
} }
// style = variable // style = variable
// add to group if atom-atyle variable is non-zero
} else if (strcmp(arg[1],"variable") == 0) { } 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++) { for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]); jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); 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; list[iarg-2] = jgroup;
} }
@ -367,6 +383,8 @@ void Group::assign(int narg, char **arg)
for (int iarg = 2; iarg < narg; iarg++) { for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]); jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); 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; list[iarg-2] = jgroup;
} }
@ -395,6 +413,8 @@ void Group::assign(int narg, char **arg)
for (int iarg = 2; iarg < narg; iarg++) { for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]); jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); 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; list[iarg-2] = jgroup;
} }
@ -413,6 +433,55 @@ void Group::assign(int narg, char **arg)
delete [] list; 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 // not a valid group style
} else error->all(FLERR,"Illegal group command"); } else error->all(FLERR,"Illegal group command");

View File

@ -25,6 +25,7 @@ class Group : protected Pointers {
char **names; // name of each group char **names; // name of each group
int *bitmask; // one-bit mask for each group int *bitmask; // one-bit mask for each group
int *inversemask; // inverse mask for each group int *inversemask; // inverse mask for each group
int *dynamic; // 1 if dynamic, 0 if not
Group(class LAMMPS *); Group(class LAMMPS *);
~Group(); ~Group();