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

This commit is contained in:
sjplimp
2012-08-28 15:07:23 +00:00
parent 664b3aff1d
commit 8a97b39ea3
2 changed files with 118 additions and 90 deletions

View File

@ -25,7 +25,10 @@
#include "fix.h"
#include "compute.h"
#include "output.h"
#include "input.h"
#include "variable.h"
#include "dump.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -241,6 +244,29 @@ void Group::assign(int narg, char **arg)
delete [] list;
// style = variable
} else if (strcmp(arg[1],"variable") == 0) {
int ivar = input->variable->find(arg[2]);
if (ivar < 0) error->all(FLERR,"Variable name for group does not exist");
if (!input->variable->atomstyle(ivar))
error->all(FLERR,"Variable for group is invalid style");
double *aflag;
// aflag = evaluation of per-atom variable
memory->create(aflag,nlocal,"group:aflag");
input->variable->compute_atom(ivar,0,aflag,1,0);
// add to group if per-atom variable evaluated to non-zero
for (i = 0; i < nlocal; i++)
if (aflag[i] != 0.0) mask[i] |= bit;
memory->destroy(aflag);
// style = subtract
} else if (strcmp(arg[1],"subtract") == 0) {