clarify template error/warning message

This commit is contained in:
jrgissing
2019-06-16 14:47:07 -06:00
parent fd20a0606a
commit 4178c5167b
4 changed files with 36 additions and 29 deletions

View File

@ -157,6 +157,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
// this looks excessive
// the price of vectorization (all reactions in one command)?
memory->create(rxn_name,nreacts,MAXLINE,"bond/react:rxn_name");
memory->create(nevery,nreacts,"bond/react:nevery");
memory->create(cutsq,nreacts,2,"bond/react:cutsq");
memory->create(unreacted_mol,nreacts,"bond/react:unreacted_mol");
@ -207,8 +208,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
iarg++;
iarg++; // read in reaction name here
//for example, rxn_name[rxn] = ...
rxn_name[rxn] = arg[iarg++];
int igroup = group->find(arg[iarg++]);
if (igroup == -1) error->all(FLERR,"Could not find fix group ID");
@ -1720,8 +1720,11 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
// bad molecule templates check
// if atoms change types, but aren't landlocked, that's bad
for (int i = 0; i < twomol->natoms; i++) {
if (twomol->type[i] != onemol->type[equivalences[i][1][myrxn]-1] && landlocked_atoms[i][myrxn] == 0)
error->one(FLERR,"Bond/react: Atom affected by reaction too close to template edge");
if (twomol->type[i] != onemol->type[equivalences[i][1][myrxn]-1] && landlocked_atoms[i][myrxn] == 0) {
char str[128];
snprintf(str,128,"Bond/react: Atom affected by reaction %s too close to template edge",rxn_name[myrxn]);
error->all(FLERR,str);
}
}
// additionally, if a bond changes type, but neither involved atom is landlocked, bad
@ -1737,7 +1740,9 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
onemol_batom = onemol->bond_atom[onemol_atomi-1][m];
if (onemol_batom == equivalences[twomol_atomj-1][1][myrxn]) {
if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomi-1][m]) {
error->one(FLERR,"Bond/react: Bond type affected by reaction too close to template edge");
char str[128];
snprintf(str,128,"Bond/react: Atom affected by reaction %s too close to template edge",rxn_name[myrxn]);
error->all(FLERR,str);
}
}
}
@ -1747,7 +1752,9 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
onemol_batom = onemol->bond_atom[onemol_atomj-1][m];
if (onemol_batom == equivalences[i][1][myrxn]) {
if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomj-1][m]) {
error->one(FLERR,"Bond/react: Bond type affected by reaction too close to template edge");
char str[128];
snprintf(str,128,"Bond/react: Atom affected by reaction %s too close to template edge",rxn_name[myrxn]);
error->all(FLERR,str);
}
}
}
@ -1763,7 +1770,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
int ii = reverse_equiv[i][1][myrxn] - 1;
for (int j = 0; j < twomol_nxspecial[ii][0]; j++) {
if (delete_atoms[equivalences[twomol_xspecial[ii][j]-1][1][myrxn]-1][myrxn] == 0) {
error->one(FLERR,"Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted");
error->all(FLERR,"Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted");
}
}
}
@ -1774,7 +1781,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
for (int i = 0; i < twomol->natoms; i++) {
if (twomol_nxspecial[i][0] != onemol_nxspecial[equivalences[i][1][myrxn]-1][0] && landlocked_atoms[i][myrxn] == 0) {
char str[128];
sprintf(str,"Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type",myrxn+1);
snprintf(str,128,"Bond/react: Atom affected by reaction %s too close to template edge",rxn_name[myrxn]);
error->warning(FLERR,str);
break;
}