From ce62c41252f61751a65a56b8ded8f0a93fd3441d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Thu, 10 Aug 2017 06:47:26 -0400 Subject: [PATCH] when recomputing special bonds, make certain we do not shrink atom->maxspecial and add force->special_extra only once --- src/special.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/special.cpp b/src/special.cpp index 4697fc40a6..381a763dd2 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -561,7 +561,13 @@ void Special::combine() for (j = 0; j < nspecial[i][2]; j++) atom->map_one(onefour[i][j],-1); } - // compute global maxspecial, must be at least 1 + // if atom->maxspecial has been updated before, make certain + // we do not reset it to a smaller value. Since atom->maxspecial + // is initialized to 1, this ensures that it is larger than zero. + + maxspecial = MAX(atom->maxspecial,maxspecial); + + // compute global maxspecial // add in extra factor from special_bonds command // allocate correct special array with same nmax, new maxspecial // previously allocated one must be destroyed @@ -569,7 +575,10 @@ void Special::combine() MPI_Allreduce(&maxspecial,&atom->maxspecial,1,MPI_INT,MPI_MAX,world); atom->maxspecial += force->special_extra; - atom->maxspecial = MAX(atom->maxspecial,1); + + // add force->special_extra only once + + force->special_extra = 0; if (me == 0) { if (screen) -- GitLab