Merge branch 'develop' into mixing-info

This commit is contained in:
Axel Kohlmeyer
2021-11-22 14:58:19 -05:00
4 changed files with 44 additions and 9 deletions

View File

@ -34,7 +34,7 @@ using namespace LAMMPS_NS;
#define DELTA 10000
#define EPSILON 1.0e-12
enum{DIST,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE};
enum{DIST,DX,DY,DZ,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE};
/* ---------------------------------------------------------------------- */
@ -63,6 +63,9 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
int iarg;
for (iarg = 3; iarg < narg; iarg++) {
if (strcmp(arg[iarg],"dist") == 0) bstyle[nvalues++] = DIST;
else if (strcmp(arg[iarg],"dx") == 0) bstyle[nvalues++] = DX;
else if (strcmp(arg[iarg],"dy") == 0) bstyle[nvalues++] = DY;
else if (strcmp(arg[iarg],"dz") == 0) bstyle[nvalues++] = DZ;
else if (strcmp(arg[iarg],"engpot") == 0) bstyle[nvalues++] = ENGPOT;
else if (strcmp(arg[iarg],"force") == 0) bstyle[nvalues++] = FORCE;
else if (strcmp(arg[iarg],"fx") == 0) bstyle[nvalues++] = FX;
@ -384,11 +387,23 @@ int ComputeBondLocal::compute_bonds(int flag)
if (dstr) input->variable->internal_set(dvar,sqrt(rsq));
}
// to make sure dx, dy and dz are always from the lower to the higher id
double directionCorrection = tag[atom1] > tag[atom2] ? -1.0 : 1.0;
for (int n = 0; n < nvalues; n++) {
switch (bstyle[n]) {
case DIST:
ptr[n] = sqrt(rsq);
break;
case DX:
ptr[n] = dx*directionCorrection;
break;
case DY:
ptr[n] = dy*directionCorrection;
break;
case DZ:
ptr[n] = dz*directionCorrection;
break;
case ENGPOT:
ptr[n] = engpot;
break;

View File

@ -31,7 +31,7 @@ using namespace LAMMPS_NS;
#define DELTA 10000
enum{DIST,ENG,FORCE,FX,FY,FZ,PN};
enum{DIST,ENG,FORCE,FX,FY,FZ,PN,DX,DY,DZ};
enum{TYPE,RADIUS};
/* ---------------------------------------------------------------------- */
@ -56,6 +56,9 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg],"fx") == 0) pstyle[nvalues++] = FX;
else if (strcmp(arg[iarg],"fy") == 0) pstyle[nvalues++] = FY;
else if (strcmp(arg[iarg],"fz") == 0) pstyle[nvalues++] = FZ;
else if (strcmp(arg[iarg],"dx") == 0) pstyle[nvalues++] = DX;
else if (strcmp(arg[iarg],"dy") == 0) pstyle[nvalues++] = DY;
else if (strcmp(arg[iarg],"dz") == 0) pstyle[nvalues++] = DZ;
else if (arg[iarg][0] == 'p') {
int n = atoi(&arg[iarg][1]);
if (n <= 0) error->all(FLERR,
@ -92,7 +95,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
singleflag = 0;
for (int i = 0; i < nvalues; i++)
if (pstyle[i] != DIST) singleflag = 1;
if (pstyle[i] != DIST && pstyle[i] != DX && pstyle[i] != DY && pstyle[i] != DZ) singleflag = 1;
if (nvalues == 1) size_local_cols = 0;
else size_local_cols = nvalues;
@ -264,11 +267,20 @@ int ComputePairLocal::compute_pairs(int flag)
if (nvalues == 1) ptr = &vlocal[m];
else ptr = alocal[m];
// to make sure dx, dy and dz are always from the lower to the higher id
double directionCorrection = itag > jtag ? -1.0 : 1.0;
for (n = 0; n < nvalues; n++) {
switch (pstyle[n]) {
case DIST:
ptr[n] = sqrt(rsq);
break;
case DX:
ptr[n] = delx*directionCorrection;
case DY:
ptr[n] = dely*directionCorrection;
case DZ:
ptr[n] = delz*directionCorrection;
case ENG:
ptr[n] = eng;
break;