Fixing rare bug in writing restart files with history

This commit is contained in:
jtclemm
2022-06-15 12:37:02 -06:00
parent c0078fda05
commit 68e00a60bd

View File

@ -351,7 +351,9 @@ void FixNeighHistory::pre_exchange_newton()
// 1st loop over neighbor list
// calculate npartner for owned+ghost atoms
for (i = 0; i < nall_neigh; i++) npartner[i] = 0;
// Ensure npartner is zeroed across all atoms, nall_neigh can be less than nall
// when writing restarts when comm calls are made but modify->post_neighbor() isn't
for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0;
tagint *tag = atom->tag;
NeighList *list = pair->list;
@ -406,7 +408,7 @@ void FixNeighHistory::pre_exchange_newton()
// store partner IDs and values for owned+ghost atoms
// re-zero npartner to use as counter
for (i = 0; i < nall_neigh; i++) npartner[i] = 0;
for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0;
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];