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

This commit is contained in:
sjplimp
2012-04-19 18:51:49 +00:00
parent 95970d4dce
commit e0198e0247
2 changed files with 10 additions and 28 deletions

View File

@ -653,19 +653,19 @@ void Domain::minimum_image(double *delta)
}
/* ----------------------------------------------------------------------
find Xj image = periodic image of Xj that is closest to Xi
for triclinic, also add/subtract tilt factors in other dims as needed
find and return Xj image = periodic image of Xj that is closest to Xi
for triclinic, add/subtract tilt factors in other dims as needed
------------------------------------------------------------------------- */
void Domain::closest_image(const double * const xi,
const double * const xj,
void Domain::closest_image(const double * const xi, const double * const xj,
double * const xjimage)
{
double dx,dy,dz;
double dx = xj[0] - xi[0];
double dy = xj[1] - xi[1];
double dz = xj[2] - xi[2];
if (triclinic == 0) {
if (xperiodic) {
dx = xj[0] - xi[0];
if (dx < 0.0) {
while (dx < 0.0) dx += xprd;
if (dx > xprd_half) dx -= xprd;
@ -673,10 +673,8 @@ void Domain::closest_image(const double * const xi,
while (dx > 0.0) dx -= xprd;
if (dx < -xprd_half) dx += xprd;
}
xjimage[0] = xi[0] + dx;
}
if (yperiodic) {
dy = xj[1] - xi[1];
if (dy < 0.0) {
while (dy < 0.0) dy += yprd;
if (dy > yprd_half) dy -= yprd;
@ -684,10 +682,8 @@ void Domain::closest_image(const double * const xi,
while (dy > 0.0) dy -= yprd;
if (dy < -yprd_half) dy += yprd;
}
xjimage[1] = xi[1] + dy;
}
if (zperiodic) {
dz = xj[2] - xi[2];
if (dz < 0.0) {
while (dz < 0.0) dz += zprd;
if (dz > zprd_half) dz -= zprd;
@ -695,14 +691,9 @@ void Domain::closest_image(const double * const xi,
while (dz > 0.0) dz -= zprd;
if (dz < -zprd_half) dz += zprd;
}
xjimage[2] = xi[2] + dz;
}
} else {
dx = xj[0] - xi[0];
dy = xj[1] - xi[1];
dz = xj[2] - xi[2];
if (zperiodic) {
if (dz < 0.0) {
while (dz < 0.0) {
@ -758,11 +749,11 @@ void Domain::closest_image(const double * const xi,
if (dx < -xprd_half) dx += xprd;
}
}
xjimage[0] = xi[0] + dx;
xjimage[1] = xi[1] + dy;
xjimage[2] = xi[2] + dz;
}
xjimage[0] = xi[0] + dx;
xjimage[1] = xi[1] + dy;
xjimage[2] = xi[2] + dz;
}
/* ----------------------------------------------------------------------

View File

@ -313,15 +313,6 @@ Lattice::~Lattice()
int Lattice::orthogonal()
{
double a = orientx[0]*orienty[0] + orientx[1]*orienty[1] +
orientx[2]*orienty[2];
double b = orienty[0]*orientz[0] + orienty[1]*orientz[1] +
orienty[2]*orientz[2];
double c = orientx[0]*orientz[0] + orientx[1]*orientz[1] +
orientx[2]*orientz[2];
printf("ABC %g %g %g\n",a,b,c);
if (orientx[0]*orienty[0] + orientx[1]*orienty[1] +
orientx[2]*orienty[2]) return 0;
if (orienty[0]*orientz[0] + orienty[1]*orientz[1] +