From 32b967ed9c2871507291d5c85ab80baaa42d104e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Jun 2017 16:26:49 -0400 Subject: [PATCH] add rigid body overlap warnings to change_box and delete_atoms --- src/change_box.cpp | 3 +++ src/delete_atoms.cpp | 21 +++++++++++++++------ src/displace_atoms.cpp | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/change_box.cpp b/src/change_box.cpp index add1fe1d0a..c6ec078a01 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -316,6 +316,9 @@ void ChangeBox::command(int narg, char **arg) } else if (ops[m].style == REMAP) { + if (modify->check_rigid_group_overlap(groupbit)) + error->warning(FLERR,"Attempting to remap atoms in rigid bodies"); + // convert atoms to lamda coords, using last box state // convert atoms back to box coords, using current box state // save current box state diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 116c2a2f1e..85bd6f88dd 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -69,6 +69,15 @@ void DeleteAtoms::command(int narg, char **arg) else if (strcmp(arg[0],"porosity") == 0) delete_porosity(narg,arg); else error->all(FLERR,"Illegal delete_atoms command"); + if (allflag) { + int igroup = group->find("all"); + if ((igroup >= 0) && modify->check_rigid_group_overlap(group->bitmask[igroup])) + error->warning(FLERR,"Attempting to delete atoms in rigid bodies"); + } else { + if (modify->check_rigid_list_overlap(dlist)) + error->warning(FLERR,"Attempting to delete atoms in rigid bodies"); + } + // if allflag = 1, just reset atom->nlocal // else delete atoms one by one @@ -89,16 +98,16 @@ void DeleteAtoms::command(int narg, char **arg) int i = 0; while (i < nlocal) { if (dlist[i]) { - avec->copy(nlocal-1,i,1); - dlist[i] = dlist[nlocal-1]; - nlocal--; + avec->copy(nlocal-1,i,1); + dlist[i] = dlist[nlocal-1]; + nlocal--; } else i++; } - + atom->nlocal = nlocal; memory->destroy(dlist); } - + // if non-molecular system and compress flag set, // reset atom tags to be contiguous // set all atom IDs to 0, call tag_extend() @@ -201,7 +210,7 @@ void DeleteAtoms::delete_group(int narg, char **arg) allflag = 1; return; } - + // allocate and initialize deletion list int nlocal = atom->nlocal; diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 9efb9c8f65..a9aa5cf855 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -76,7 +76,7 @@ void DisplaceAtoms::command(int narg, char **arg) groupbit = group->bitmask[igroup]; if (modify->check_rigid_group_overlap(groupbit)) - error->warning(FLERR,"Displacing atoms in rigid bodies"); + error->warning(FLERR,"Attempting to displace atoms in rigid bodies"); int style = -1; if (strcmp(arg[1],"move") == 0) style = MOVE;