add check for number of local atom indices overflowing neighbor lists for molecular systems

This commit is contained in:
Axel Kohlmeyer
2020-09-11 22:09:09 -04:00
parent 47b3039b28
commit 828ce84df5
2 changed files with 16 additions and 0 deletions

View File

@ -1152,6 +1152,14 @@ void CommTiled::borders()
atom->nghost += forward_recv_offset[iswap][n-1] + recvnum[iswap][n-1];
}
// For molecular systems we lose some bits for local atom indices due
// to encoding of special pairs in neighbor lists. Check for overflows.
if ((atom->molecular != Atom::ATOMIC)
&& ((atom->nlocal + atom->nghost) > NEIGHMASK))
error->one(FLERR,"Per-processor number of atoms is too large for "
"molecular neighbor lists");
// insure send/recv buffers are long enough for all forward & reverse comm
// send buf is for one forward or reverse sends to one proc
// recv buf is for all forward or reverse recvs in one swap