diff --git a/doc/src/Errors_messages.txt b/doc/src/Errors_messages.txt index 7249bfddfd..3475af2226 100644 --- a/doc/src/Errors_messages.txt +++ b/doc/src/Errors_messages.txt @@ -636,12 +636,12 @@ Please ensure reaction map files are properly formatted. :dd {Bond/react: Atom affected by reaction too close to template edge} :dt -This means an atom which changes type during the reaction is too close -to an 'edge' atom defined in the superimpose file. This could cause -incorrect assignment of bonds, angle, etc. Generally, this means you -must include more atoms in your templates, such that there are at -least two atoms between each atom involved in the reaction and an edge -atom. :dd +This means an atom which changes type or connectivity during the +reaction is too close to an 'edge' atom defined in the superimpose +file. This could cause incorrect assignment of bonds, angle, etc. +Generally, this means you must include more atoms in your templates, +such that there are at least two atoms between each atom involved in +the reaction and an edge atom. :dd {Bond/react: Fix bond/react needs ghost atoms from farther away} :dt diff --git a/doc/src/Errors_warnings.txt b/doc/src/Errors_warnings.txt index 164a29e21d..1507d6b22c 100644 --- a/doc/src/Errors_warnings.txt +++ b/doc/src/Errors_warnings.txt @@ -82,10 +82,14 @@ bond/angle/dihedral. LAMMPS computes this by taking the maximum bond length, multiplying by the number of bonds in the interaction (e.g. 3 for a dihedral) and adding a small amount of stretch. :dd -{Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type} :dt +{Bond/react: Atom affected by reaction too close to template edge} :dt -You may want to double-check that all atom types are properly assigned -in the post-reaction template. :dd +This means an atom which changes type or connectivity during the +reaction is too close to an 'edge' atom defined in the superimpose +file. This could cause incorrect assignment of bonds, angle, etc. +Generally, this means you must include more atoms in your templates, +such that there are at least two atoms between each atom involved in +the reaction and an edge atom. :dd {Both groups in compute group/group have a net charge; the Kspace boundary correction to energy will be non-zero} :dt diff --git a/src/USER-MISC/fix_bond_react.cpp b/src/USER-MISC/fix_bond_react.cpp index 7e2a228992..c641912db6 100644 --- a/src/USER-MISC/fix_bond_react.cpp +++ b/src/USER-MISC/fix_bond_react.cpp @@ -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; } diff --git a/src/USER-MISC/fix_bond_react.h b/src/USER-MISC/fix_bond_react.h index 36fc13ae21..1ac8d624a9 100644 --- a/src/USER-MISC/fix_bond_react.h +++ b/src/USER-MISC/fix_bond_react.h @@ -67,6 +67,7 @@ class FixBondReact : public Fix { int *groupbits; int rxnID; // integer ID for identifying current bond/react + char **rxn_name; // name of reaction int *reaction_count; int *reaction_count_total; int nmax; // max num local atoms @@ -213,14 +214,14 @@ E: Bond/react: Unknown section in map file Please ensure reaction map files are properly formatted. -E: Bond/react: Atom affected by reaction too close to template edge +E or W: Bond/react: Atom affected by reaction %s too close to template edge -This means an atom which changes type during the reaction is too close -to an 'edge' atom defined in the superimpose file. This could cause -incorrect assignment of bonds, angle, etc. Generally, this means you -must include more atoms in your templates, such that there are at -least two atoms between each atom involved in the reaction and an edge -atom. +This means an atom which changes type or connectivity during the +reaction is too close to an 'edge' atom defined in the superimpose +file. This could cause incorrect assignment of bonds, angle, etc. +Generally, this means you must include more atoms in your templates, +such that there are at least two atoms between each atom involved in +the reaction and an edge atom. E: Bond/react: Fix bond/react needs ghost atoms from farther away @@ -233,11 +234,6 @@ E: Bond/react: A deleted atom cannot remain bonded to an atom that is not delete Self-explanatory. -W: Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type - -You may want to double-check that all atom types are properly assigned -in the post-reaction template. - E: Bond/react special bond generation overflow The number of special bonds per-atom created by a reaction exceeds the