bond/react: better template validity check

now always throws error if a bond type changes, but both of of the involved atoms are too close to edge of template
This commit is contained in:
jrgissing 2018-08-21 02:28:53 -06:00
parent 3aedfbf9d5
commit 95d462e5d3
2 changed files with 42 additions and 6 deletions

View File

@ -125,13 +125,13 @@ template. If both these conditions are met, the reaction site is
modified to match the post-reaction template.
A bonding atom pair will be identified if several conditions are met.
First, a pair of atoms within the specified react-group-ID of type
typei and typej must separated by a distance between {Rmin} and
First, a pair of atoms I,J within the specified react-group-ID of type
itype and jtype must separated by a distance between {Rmin} and
{Rmax}. It is possible that multiple bonding atom pairs are
identified: if the bonding atoms in the pre-reacted template are not
1-2, 1-3, or 1-4 neighbors, the closest bonding atom partner is set as
its bonding partner; otherwise, the farthest potential partner is
chosen. Then, if both an atomi and atomj have each other as their
chosen. Then, if both an atom I and atom J have each other as their
nearest bonding partners, these two atoms are identified as the
bonding atom pair of the reaction site. Once this unique bonding atom
pair is identified for each reaction, there could two or more
@ -323,7 +323,7 @@ bond/break"_fix_bond_break.html, "fix bond/swap"_fix_bond_swap.html,
[Default:]
The option defaults are stabilization = no, stabilize_steps = 60
The option defaults are stabilization = no, prob = 1.0, stabilize_steps = 60
:line

View File

@ -1063,8 +1063,8 @@ void FixBondReact::superimpose_algorithm()
hang_catch++;
// let's go ahead and catch the simplest of hangs
//if (hang_catch > onemol->natoms*4)
if (hang_catch > atom->nlocal*3) {
error->all(FLERR,"Excessive iteration of superimpose algorithm");
if (hang_catch > atom->nlocal*30) {
error->one(FLERR,"Excessive iteration of superimpose algorithm");
}
}
}
@ -1554,6 +1554,42 @@ void FixBondReact::find_landlocked_atoms(int myrxn)
error->one(FLERR,"Atom affected by reaction too close to template edge");
}
// additionally, if a bond changes type, but neither involved atom is landlocked, bad
// would someone want to change an angle type but not bond or atom types? (etc.) ...hopefully not yet
for (int i = 0; i < twomol->natoms; i++) {
if (landlocked_atoms[i][myrxn] == 0) {
int twomol_atomi = i+1;
for (int j = 0; j < twomol->num_bond[i]; j++) {
int twomol_atomj = twomol->bond_atom[i][j];
if (landlocked_atoms[twomol_atomj-1][myrxn] == 0) {
int onemol_atomi = equivalences[i][1][myrxn];
int onemol_batom;
for (int m = 0; m < onemol->num_bond[onemol_atomi-1]; m++) {
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]) {
printf("%d and %d for rxn %d\n",twomol_atomi,twomol_atomj,myrxn);
error->one(FLERR,"Bond type affected by reaction too close to template edge");
}
}
}
if (newton_bond) {
int onemol_atomj = equivalences[twomol_atomj-1][1][myrxn];
for (int m = 0; m < onemol->num_bond[onemol_atomj-1]; m++) {
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]) {
printf("%d and %d for rxn %d\n",twomol_atomi,twomol_atomj,myrxn);
error->one(FLERR,"Bond type affected by reaction too close to template edge");
}
}
}
}
}
}
}
}
// also, if atoms change number of bonds, but aren't landlocked, that could be bad
if (me == 0)
for (int i = 0; i < twomol->natoms; i++) {