restore original coeff() code with one modification. now setflag is only set for pairs of types that both are mapped to elements (and thus not NULL)

This commit is contained in:
Axel Kohlmeyer 2019-05-11 17:04:57 -04:00
parent c581e9349a
commit 8eeb92b82b
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 10 additions and 16 deletions

View File

@ -226,10 +226,9 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg)
error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate();
// insure I,J args are * *
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
int ilo,ihi,jlo,jhi;
force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi);
force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi);
// read args that map atom types to elements in potential file
// map[i] = which element the Ith atom type is, -1 if NULL
@ -262,23 +261,18 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg)
read_file(arg[2]);
// clear setflag since coeff() called once with I,J = * *
n = atom->ntypes;
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
setflag[i][j] = 0;
// set setflag i,j for type pairs where both are mapped to elements
// set setflag only for i,j pairs where both are mapped to elements
int count = 0;
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
if (map[i] >= 0 && map[j] >= 0) {
setflag[i][j] = 1;
for (int i = ilo; i <= ihi; i++) {
for (int j = MAX(jlo,i); j <= jhi; j++) {
if ((map[i] >=0) && (map[j] >= 0)) {
cut[i][j] = cut_global;
setflag[i][j] = 1;
count++;
}
}
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
}