From bde38bc21709c342e00e0a67a6765370c04d3fb0 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 31 Jan 2013 17:30:50 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9350 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/BODY/compute_body_local.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index a7a4fecfa5..fef644a5ec 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -84,6 +84,27 @@ ComputeBodyLocal::~ComputeBodyLocal() void ComputeBodyLocal::init() { + // if non-body particles in group insure only indices 1,2,3 are used + + int nonbody = 0; + int *mask = atom->mask; + int *body = atom->body; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + if (body[i] < 0) nonbody = 1; + + int flag; + MPI_Allreduce(&nonbody,&flag,1,MPI_INT,MPI_SUM,world); + + if (flag) { + for (int i = 0; i < nvalues; i++) + if (which[i] == INDEX && index[i] > 2) + error->all(FLERR,"Invalid index for non-body particles " + "in compute body/local command"); + } + // do initial memory allocation so that memory_usage() is correct int ncount = compute_body(0);