support atom style variables for assigning image flags with the set command

This commit is contained in:
Axel Kohlmeyer
2017-05-30 21:52:32 -04:00
parent 5c6f63d8b4
commit 167a51538e
2 changed files with 10 additions and 3 deletions

View File

@ -80,6 +80,7 @@ keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \
value can be an atom-style variable (see below) value can be an atom-style variable (see below)
{image} nx ny nz {image} nx ny nz
nx,ny,nz = which periodic image of the simulation box the atom is in nx,ny,nz = which periodic image of the simulation box the atom is in
any of nx,ny,nz can be an atom-style variable (see below)
{bond} value = bond type for all bonds between selected atoms {bond} value = bond type for all bonds between selected atoms
{angle} value = angle type for all angles between selected atoms {angle} value = angle type for all angles between selected atoms
{dihedral} value = dihedral type for all dihedrals between selected atoms {dihedral} value = dihedral type for all dihedrals between selected atoms

View File

@ -327,15 +327,18 @@ void Set::command(int narg, char **arg)
ximageflag = yimageflag = zimageflag = 0; ximageflag = yimageflag = zimageflag = 0;
if (strcmp(arg[iarg+1],"NULL") != 0) { if (strcmp(arg[iarg+1],"NULL") != 0) {
ximageflag = 1; ximageflag = 1;
ximage = force->inumeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
else ximage = force->inumeric(FLERR,arg[iarg+1]);
} }
if (strcmp(arg[iarg+2],"NULL") != 0) { if (strcmp(arg[iarg+2],"NULL") != 0) {
yimageflag = 1; yimageflag = 1;
yimage = force->inumeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
else yimage = force->inumeric(FLERR,arg[iarg+2]);
} }
if (strcmp(arg[iarg+3],"NULL") != 0) { if (strcmp(arg[iarg+3],"NULL") != 0) {
zimageflag = 1; zimageflag = 1;
zimage = force->inumeric(FLERR,arg[iarg+3]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
else zimage = force->inumeric(FLERR,arg[iarg+3]);
} }
if (ximageflag && ximage && !domain->xperiodic) if (ximageflag && ximage && !domain->xperiodic)
error->all(FLERR, error->all(FLERR,
@ -789,6 +792,9 @@ void Set::set(int keyword)
int xbox = (atom->image[i] & IMGMASK) - IMGMAX; int xbox = (atom->image[i] & IMGMASK) - IMGMAX;
int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX; int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX; int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX;
if (varflag1) ximage = static_cast<int>(xvalue);
if (varflag2) yimage = static_cast<int>(yvalue);
if (varflag3) zimage = static_cast<int>(zvalue);
if (ximageflag) xbox = ximage; if (ximageflag) xbox = ximage;
if (yimageflag) ybox = yimage; if (yimageflag) ybox = yimage;
if (zimageflag) zbox = zimage; if (zimageflag) zbox = zimage;