fix segfault: must not count bonds on atoms that are not in a molecule

This commit is contained in:
Axel Kohlmeyer
2020-10-28 15:11:19 -04:00
parent 94462bfb48
commit c25ef8edb0

View File

@ -557,6 +557,7 @@ void DeleteAtoms::recount_topology()
for (int i = 0; i < nlocal; i++) {
imol = molindex[i];
iatom = molatom[i];
if (imol < 0) continue;
nbonds += onemols[imol]->num_bond[iatom];
nangles += onemols[imol]->num_angle[iatom];
ndihedrals += onemols[imol]->num_dihedral[iatom];