avoid uninitialized data access in case there are no atoms owned by a process

This commit is contained in:
Axel Kohlmeyer
2024-08-26 21:14:44 -04:00
parent 6e791034f9
commit 2ebe1f019f

View File

@ -3714,7 +3714,7 @@ int FixBondReact::insert_atoms_setup(tagint **my_update_mega_glove, int iupdate)
tagint *molecule = atom->molecule;
int nlocal = atom->nlocal;
tagint maxmol_all;
tagint maxmol_all = 0;;
for (int i = 0; i < nlocal; i++) maxmol_all = MAX(maxmol_all,molecule[i]);
MPI_Allreduce(MPI_IN_PLACE,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);