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

This commit is contained in:
sjplimp 2016-07-22 22:10:50 +00:00
parent ff10357ef2
commit 0659a1fc5a
2 changed files with 37 additions and 6 deletions

View File

@ -31,6 +31,7 @@ using namespace LAMMPS_NS;
#define DELTA 10000 #define DELTA 10000
enum{DIST,ENG,FORCE,FX,FY,FZ,PN}; enum{DIST,ENG,FORCE,FX,FY,FZ,PN};
enum{TYPE,RADIUS};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -48,7 +49,8 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
pindex = new int[nvalues]; pindex = new int[nvalues];
nvalues = 0; nvalues = 0;
for (int iarg = 3; iarg < narg; iarg++) { int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"dist") == 0) pstyle[nvalues++] = DIST; if (strcmp(arg[iarg],"dist") == 0) pstyle[nvalues++] = DIST;
else if (strcmp(arg[iarg],"eng") == 0) pstyle[nvalues++] = ENG; else if (strcmp(arg[iarg],"eng") == 0) pstyle[nvalues++] = ENG;
else if (strcmp(arg[iarg],"force") == 0) pstyle[nvalues++] = FORCE; else if (strcmp(arg[iarg],"force") == 0) pstyle[nvalues++] = FORCE;
@ -61,9 +63,32 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
"Invalid keyword in compute pair/local command"); "Invalid keyword in compute pair/local command");
pstyle[nvalues] = PN; pstyle[nvalues] = PN;
pindex[nvalues++] = n-1; pindex[nvalues++] = n-1;
} else error->all(FLERR,"Invalid keyword in compute pair/local command");
} else break;
iarg++;
} }
// optional args
cutstyle = TYPE;
while (iarg < narg) {
if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute pair/local command");
if (strcmp(arg[iarg+1],"type") == 0) cutstyle = TYPE;
else if (strcmp(arg[iarg+1],"radius") == 0) cutstyle = RADIUS;
else error->all(FLERR,"Illegal compute pair/local command");
iarg += 2;
} else error->all(FLERR,"Illegal compute pair/local command");
}
// error check
if (cutstyle == RADIUS && !atom->radius_flag)
error->all(FLERR,"Compute pair/local requires atom attribute radius");
// set singleflag if need to call pair->single() // set singleflag if need to call pair->single()
singleflag = 0; singleflag = 0;
@ -140,11 +165,12 @@ int ComputePairLocal::compute_pairs(int flag)
int i,j,m,n,ii,jj,inum,jnum,itype,jtype; int i,j,m,n,ii,jj,inum,jnum,itype,jtype;
tagint itag,jtag; tagint itag,jtag;
double xtmp,ytmp,ztmp,delx,dely,delz; double xtmp,ytmp,ztmp,delx,dely,delz;
double rsq,eng,fpair,factor_coul,factor_lj; double rsq,radsum,eng,fpair,factor_coul,factor_lj;
int *ilist,*jlist,*numneigh,**firstneigh; int *ilist,*jlist,*numneigh,**firstneigh;
double *ptr; double *ptr;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius;
tagint *tag = atom->tag; tagint *tag = atom->tag;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -216,7 +242,13 @@ int ComputePairLocal::compute_pairs(int flag)
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j]; jtype = type[j];
if (rsq >= cutsq[itype][jtype]) continue;
if (cutstyle == TYPE) {
if (rsq >= cutsq[itype][jtype]) continue;
} else {
radsum = radius[i] + radius[j];
if (rsq >= radsum*radsum) continue;
}
if (flag) { if (flag) {
if (singleflag) if (singleflag)

View File

@ -34,8 +34,7 @@ class ComputePairLocal : public Compute {
double memory_usage(); double memory_usage();
private: private:
int nvalues; int nvalues,ncount,cutstyle;
int ncount;
int *pstyle; // style of each requested output int *pstyle; // style of each requested output
int *pindex; // for pI, index of the output (0 to M-1) int *pindex; // for pI, index of the output (0 to M-1)