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

This commit is contained in:
sjplimp
2011-02-15 20:59:48 +00:00
parent ef846b16c1
commit 7814f1cc56
2 changed files with 13 additions and 6 deletions

View File

@ -535,10 +535,12 @@ void FixRigid::init()
} }
// compute masstotal & center-of-mass of each rigid body // compute masstotal & center-of-mass of each rigid body
// error if image flag is not 0 in a non-periodic dim
double **x = atom->x; double **x = atom->x;
int *image = atom->image; int *image = atom->image;
int *periodicity = domain->periodicity;
double xprd = domain->xprd; double xprd = domain->xprd;
double yprd = domain->yprd; double yprd = domain->yprd;
double zprd = domain->zprd; double zprd = domain->zprd;
@ -561,6 +563,11 @@ void FixRigid::init()
if (rmass) massone = rmass[i]; if (rmass) massone = rmass[i];
else massone = mass[type[i]]; else massone = mass[type[i]];
if ((xbox && !periodicity[0]) || (ybox && !periodicity[1]) ||
(zbox && !periodicity[2]))
error->one("Fix rigid atom has non-zero image flag "
"in a non-periodic dimension");
if (triclinic == 0) { if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd; xunwrap = x[i][0] + xbox*xprd;
yunwrap = x[i][1] + ybox*yprd; yunwrap = x[i][1] + ybox*yprd;
@ -576,7 +583,7 @@ void FixRigid::init()
sum[ibody][2] += zunwrap * massone; sum[ibody][2] += zunwrap * massone;
sum[ibody][3] += massone; sum[ibody][3] += massone;
} }
MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world);
for (ibody = 0; ibody < nbody; ibody++) { for (ibody = 0; ibody < nbody; ibody++) {
@ -585,7 +592,7 @@ void FixRigid::init()
xcm[ibody][1] = all[ibody][1]/masstotal[ibody]; xcm[ibody][1] = all[ibody][1]/masstotal[ibody];
xcm[ibody][2] = all[ibody][2]/masstotal[ibody]; xcm[ibody][2] = all[ibody][2]/masstotal[ibody];
} }
// remap the xcm of each body back into simulation box if needed // remap the xcm of each body back into simulation box if needed
// only really necessary the 1st time a run is performed // only really necessary the 1st time a run is performed

View File

@ -184,15 +184,15 @@ void Set::command(int narg, char **arg)
} else if (strcmp(arg[iarg],"image") == 0) { } else if (strcmp(arg[iarg],"image") == 0) {
if (iarg+4 > narg) error->all("Illegal set command"); if (iarg+4 > narg) error->all("Illegal set command");
ximageflag = yimageflag = zimageflag = 0; ximageflag = yimageflag = zimageflag = 0;
if (strcmp(arg[iarg+1],"NULL") != 0 && domain->xperiodic) { if (strcmp(arg[iarg+1],"NULL") != 0) {
ximageflag = 1; ximageflag = 1;
ximage = atoi(arg[iarg+1]); ximage = atoi(arg[iarg+1]);
} }
if (strcmp(arg[iarg+2],"NULL") != 0 && domain->yperiodic) { if (strcmp(arg[iarg+2],"NULL") != 0) {
yimageflag = 1; yimageflag = 1;
yimage = atoi(arg[iarg+2]); yimage = atoi(arg[iarg+2]);
} }
if (strcmp(arg[iarg+3],"NULL") != 0 && domain->zperiodic) { if (strcmp(arg[iarg+3],"NULL") != 0) {
zimageflag = 1; zimageflag = 1;
zimage = atoi(arg[iarg+3]); zimage = atoi(arg[iarg+3]);
} }