From 59971d161674c23109464b21779683cf66da52a5 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 7 May 2014 16:25:27 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11938 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom_vec.cpp | 14 +++++++++++++- src/atom_vec.h | 1 + src/atom_vec_body.cpp | 4 +--- src/atom_vec_ellipsoid.cpp | 4 +--- src/atom_vec_line.cpp | 3 +-- src/atom_vec_tri.cpp | 3 +-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 4825056f75..0fd8043d85 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -22,6 +22,7 @@ using namespace LAMMPS_NS; #define DELTA 16384 +#define DELTA_BONUS 8192 /* ---------------------------------------------------------------------- */ @@ -84,7 +85,7 @@ void AtomVec::init() } /* ---------------------------------------------------------------------- - grow nmax + grow nmax so it is a multiple of DELTA ------------------------------------------------------------------------- */ void AtomVec::grow_nmax() @@ -93,6 +94,17 @@ void AtomVec::grow_nmax() nmax += DELTA; } +/* ---------------------------------------------------------------------- + grow nmax_bonus so it is a multiple of DELTA_BONUS +------------------------------------------------------------------------- */ + +int AtomVec::grow_nmax_bonus(int nmax_bonus) +{ + nmax_bonus = nmax_bonus/DELTA_BONUS * DELTA_BONUS; + nmax_bonus += DELTA_BONUS; + return nmax_bonus; +} + /* ---------------------------------------------------------------------- unpack one line from Velocities section of data file ------------------------------------------------------------------------- */ diff --git a/src/atom_vec.h b/src/atom_vec.h index a6d188d74b..8e9bb0f518 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -140,6 +140,7 @@ class AtomVec : protected Pointers { }; void grow_nmax(); + int grow_nmax_bonus(int); }; } diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 6876e13327..d407d5e8c8 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -28,8 +28,6 @@ using namespace LAMMPS_NS; -#define DELTA_BONUS 8192 - /* ---------------------------------------------------------------------- */ AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp) @@ -159,7 +157,7 @@ void AtomVecBody::grow_reset() void AtomVecBody::grow_bonus() { - nmax_bonus += DELTA_BONUS; + nmax_bonus = grow_nmax_bonus(nmax_bonus); if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT) error->one(FLERR,"Per-processor system is too big"); diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 317a47ed1f..81e4fbee20 100755 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -31,8 +31,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA_BONUS 8192 - /* ---------------------------------------------------------------------- */ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp) @@ -114,7 +112,7 @@ void AtomVecEllipsoid::grow_reset() void AtomVecEllipsoid::grow_bonus() { - nmax_bonus += DELTA_BONUS; + nmax_bonus = grow_nmax_bonus(nmax_bonus); if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT) error->one(FLERR,"Per-processor system is too big"); diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index d203ff8f75..6760589ecb 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -26,7 +26,6 @@ using namespace LAMMPS_NS; -#define DELTA_BONUS 10000 #define EPSILON 0.001 /* ---------------------------------------------------------------------- */ @@ -123,7 +122,7 @@ void AtomVecLine::grow_reset() void AtomVecLine::grow_bonus() { - nmax_bonus += DELTA_BONUS; + nmax_bonus = grow_nmax_bonus(nmax_bonus); if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT) error->one(FLERR,"Per-processor system is too big"); diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 10d82a237f..f5f0f55f63 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -27,7 +27,6 @@ using namespace LAMMPS_NS; -#define DELTA_BONUS 10000 #define EPSILON 0.001 /* ---------------------------------------------------------------------- */ @@ -124,7 +123,7 @@ void AtomVecTri::grow_reset() void AtomVecTri::grow_bonus() { - nmax_bonus += DELTA_BONUS; + nmax_bonus = grow_nmax_bonus(nmax_bonus); if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT) error->one(FLERR,"Per-processor system is too big");