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

This commit is contained in:
sjplimp 2008-08-20 15:23:21 +00:00
parent 3bb2a936f9
commit 021986ab2b
2 changed files with 32 additions and 2 deletions

View File

@ -35,7 +35,7 @@ enum{ATOM,GROUP,REGION};
enum{TYPE,TYPE_FRACTION,MOLECULE, enum{TYPE,TYPE_FRACTION,MOLECULE,
X,Y,Z,VX,VY,VZ,CHARGE, X,Y,Z,VX,VY,VZ,CHARGE,
DIPOLE,DIPOLE_RANDOM,QUAT,QUAT_RANDOM, DIPOLE,DIPOLE_RANDOM,QUAT,QUAT_RANDOM,
DIAMETER,DENSITY,VOLUME, DIAMETER,DENSITY,VOLUME,IMAGE,
BOND,ANGLE,DIHEDRAL,IMPROPER}; BOND,ANGLE,DIHEDRAL,IMPROPER};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -196,6 +196,23 @@ void Set::command(int narg, char **arg)
error->all("Cannot set this attribute for this atom style"); error->all("Cannot set this attribute for this atom style");
set(VOLUME); set(VOLUME);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"image") == 0) {
if (iarg+4 > narg) error->all("Illegal set command");
ximageflag = yimageflag = zimageflag = 0;
if (strcmp(arg[iarg+1],"NULL") != 0 && domain->xperiodic) {
ximageflag = 1;
ximage = atoi(arg[iarg+1]);
}
if (strcmp(arg[iarg+2],"NULL") != 0 && domain->yperiodic) {
yimageflag = 1;
yimage = atoi(arg[iarg+2]);
}
if (strcmp(arg[iarg+3],"NULL") != 0 && domain->zperiodic) {
zimageflag = 1;
zimage = atoi(arg[iarg+3]);
}
set(IMAGE);
iarg += 4;
} else if (strcmp(arg[iarg],"bond") == 0) { } else if (strcmp(arg[iarg],"bond") == 0) {
if (iarg+2 > narg) error->all("Illegal set command"); if (iarg+2 > narg) error->all("Illegal set command");
ivalue = atoi(arg[iarg+1]); ivalue = atoi(arg[iarg+1]);
@ -354,7 +371,19 @@ void Set::set(int keyword)
} else if (keyword == VOLUME) atom->vfrac[i] = dvalue; } else if (keyword == VOLUME) atom->vfrac[i] = dvalue;
else if (keyword == DIPOLE) { // reset any or all of 3 image flags
else if (keyword == IMAGE) {
int xbox = (atom->image[i] & 1023) - 512;
int ybox = (atom->image[i] >> 10 & 1023) - 512;
int zbox = (atom->image[i] >> 20) - 512;
if (ximageflag) xbox = ximage;
if (yimageflag) ybox = yimage;
if (zimageflag) zbox = zimage;
atom->image[i] = ((zbox + 512 & 1023) << 20) |
((ybox + 512 & 1023) << 10) | (xbox + 512 & 1023);
} else if (keyword == DIPOLE) {
if (atom->dipole[atom->type[i]] > 0.0) { if (atom->dipole[atom->type[i]] > 0.0) {
double **mu = atom->mu; double **mu = atom->mu;
mu[i][0] = xvalue; mu[i][0] = xvalue;

View File

@ -27,6 +27,7 @@ class Set : protected Pointers {
char *id; char *id;
int *select; int *select;
int style,ivalue,newtype,count; int style,ivalue,newtype,count;
int ximage,yimage,zimage,ximageflag,yimageflag,zimageflag;
double dvalue,xvalue,yvalue,zvalue,wvalue,fraction; double dvalue,xvalue,yvalue,zvalue,wvalue,fraction;
double PI; double PI;