Added inside_nonperiodic()

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13482 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
athomps
2015-05-18 21:08:06 +00:00
parent d9be5d7d63
commit f110488db0
2 changed files with 37 additions and 0 deletions

View File

@ -617,6 +617,42 @@ int Domain::inside(double* x)
else return 1;
}
/* ----------------------------------------------------------------------
check that point is inside nonperiodic boundaries, in [lo,hi) sense
return 1 if true, 0 if false
------------------------------------------------------------------------- */
int Domain::inside_nonperiodic(double* x)
{
double *lo,*hi,*period;
double delta[3];
if (xperiodic && yperiodic && zperiodic) return 1;
if (triclinic == 0) {
lo = boxlo;
hi = boxhi;
period = prd;
} else {
lo = boxlo_lamda;
hi = boxhi_lamda;
period = prd_lamda;
delta[0] = x[0] - boxlo[0];
delta[1] = x[1] - boxlo[1];
delta[2] = x[2] - boxlo[2];
x[0] = h_inv[0]*delta[0] + h_inv[5]*delta[1] + h_inv[4]*delta[2];
x[1] = h_inv[1]*delta[1] + h_inv[3]*delta[2];
x[2] = h_inv[2]*delta[2];
}
if (!xperiodic && (x[0] < lo[0] || x[0] >= hi[0])) return 0;
if (!yperiodic && (x[1] < lo[1] || x[1] >= hi[1])) return 0;
if (!zperiodic && (x[2] < lo[2] || x[2] >= hi[2])) return 0;
return 1;
}
/* ----------------------------------------------------------------------
warn if image flags of any bonded atoms are inconsistent
could be a problem when using replicate or fix rigid

View File

@ -127,6 +127,7 @@ class Domain : protected Pointers {
virtual void lamda2x(double *, double *);
virtual void x2lamda(double *, double *);
int inside(double *);
int inside_nonperiodic(double *);
void x2lamda(double *, double *, double *, double *);
void bbox(double *, double *, double *, double *);
void box_corners();