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

This commit is contained in:
sjplimp
2012-10-12 23:53:08 +00:00
parent 0ac2b54e58
commit 8b2448329b
3 changed files with 125 additions and 1 deletions

View File

@ -66,6 +66,8 @@ void Neighbor::bond_all()
nbondlist++;
}
}
if (cluster_check) bond_check();
}
/* ---------------------------------------------------------------------- */
@ -106,6 +108,33 @@ void Neighbor::bond_partial()
nbondlist++;
}
}
if (cluster_check) bond_check();
}
/* ---------------------------------------------------------------------- */
void Neighbor::bond_check()
{
int i,j;
double dx,dy,dz,dxstart,dystart,dzstart;
double **x = atom->x;
int flag = 0;
for (int m = 0; m < nbondlist; m++) {
i = bondlist[m][0];
j = bondlist[m][1];
dxstart = dx = x[i][0] - x[j][0];
dystart = dy = x[i][1] - x[j][1];
dzstart = dz = x[i][2] - x[j][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
}
int flag_all;
MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world);
if (flag_all) error->all(FLERR,"Bond extent > half of periodic box length");
}
/* ---------------------------------------------------------------------- */
@ -153,6 +182,8 @@ void Neighbor::angle_all()
nanglelist++;
}
}
if (cluster_check) angle_check();
}
/* ---------------------------------------------------------------------- */
@ -201,6 +232,39 @@ void Neighbor::angle_partial()
nanglelist++;
}
}
if (cluster_check) angle_check();
}
/* ---------------------------------------------------------------------- */
void Neighbor::angle_check()
{
int i,j,k;
double dx,dy,dz,dxstart,dystart,dzstart;
double **x = atom->x;
int flag = 0;
for (int m = 0; m < nbondlist; m++) {
i = anglelist[m][0];
j = anglelist[m][1];
k = anglelist[m][1];
dxstart = dx = x[i][0] - x[j][0];
dystart = dy = x[i][1] - x[j][1];
dzstart = dz = x[i][2] - x[j][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
dxstart = dx = x[i][0] - x[k][0];
dystart = dy = x[i][1] - x[k][1];
dzstart = dz = x[i][2] - x[k][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
}
int flag_all;
MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world);
if (flag_all) error->all(FLERR,"Angle extent > half of periodic box length");
}
/* ---------------------------------------------------------------------- */
@ -254,6 +318,8 @@ void Neighbor::dihedral_all()
ndihedrallist++;
}
}
if (cluster_check) dihedral_check(dihedrallist);
}
/* ---------------------------------------------------------------------- */
@ -308,6 +374,46 @@ void Neighbor::dihedral_partial()
ndihedrallist++;
}
}
if (cluster_check) dihedral_check(dihedrallist);
}
/* ---------------------------------------------------------------------- */
void Neighbor::dihedral_check(int **list)
{
int i,j,k,l;
double dx,dy,dz,dxstart,dystart,dzstart;
double **x = atom->x;
int flag = 0;
for (int m = 0; m < nbondlist; m++) {
i = list[m][0];
j = list[m][1];
k = list[m][1];
l = list[m][1];
dxstart = dx = x[i][0] - x[j][0];
dystart = dy = x[i][1] - x[j][1];
dzstart = dz = x[i][2] - x[j][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
dxstart = dx = x[i][0] - x[k][0];
dystart = dy = x[i][1] - x[k][1];
dzstart = dz = x[i][2] - x[k][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
dxstart = dx = x[i][0] - x[l][0];
dystart = dy = x[i][1] - x[l][1];
dzstart = dz = x[i][2] - x[l][2];
domain->minimum_image(dx,dy,dz);
if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1;
}
int flag_all;
MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world);
if (flag_all)
error->all(FLERR,"Dihedral/improper extent > half of periodic box length");
}
/* ---------------------------------------------------------------------- */
@ -346,7 +452,7 @@ void Neighbor::improper_all()
atom1 = domain->closest_image(i,atom1);
atom2 = domain->closest_image(i,atom2);
atom3 = domain->closest_image(i,atom3);
atom4 = domain->closest_image(i,atom4);
atom4 = domain-> closest_image(i,atom4);
if (newton_bond ||
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
if (nimproperlist == maximproper) {
@ -361,6 +467,8 @@ void Neighbor::improper_all()
nimproperlist++;
}
}
if (cluster_check) dihedral_check(improperlist);
}
/* ---------------------------------------------------------------------- */
@ -415,4 +523,6 @@ void Neighbor::improper_partial()
nimproperlist++;
}
}
if (cluster_check) dihedral_check(improperlist);
}