diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index de2c10501e95ddc1ee540e00aac7ffd1a038c6d6..2b29a38c2540f00470c92f9366a3701e23984078 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -667,14 +667,19 @@ void PairEAM::file2array() // set of z2r arrays only fill lower triangular Nelement matrix // value = n = sum over rows of lower-triangular matrix until reach irow,icol // swap indices when irow < icol to stay lower triangular - // OK if map = -1 (non-EAM atom in pair hybrid) b/c type2z2r not used + // if map = -1 (non-EAM atom in pair hybrid): + // type2z2r is not used by non-opt + // but set type2z2r to 0 since accessed by opt int irow,icol; for (i = 1; i <= ntypes; i++) { for (j = 1; j <= ntypes; j++) { irow = map[i]; icol = map[j]; - if (irow == -1 || icol == -1) continue; + if (irow == -1 || icol == -1) { + type2z2r[i][j] = 0; + continue; + } if (irow < icol) { irow = map[j]; icol = map[i]; diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index a13468acffa62a06f4f9ed7f4df3335cb1806948..202758091eeb527e5502a58c38d119463bd60e32 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -298,14 +298,19 @@ void PairEAMAlloy::file2array() // set of z2r arrays only fill lower triangular Nelement matrix // value = n = sum over rows of lower-triangular matrix until reach irow,icol // swap indices when irow < icol to stay lower triangular - // OK if map = -1 (non-EAM atom in pair hybrid) b/c type2z2r not used + // if map = -1 (non-EAM atom in pair hybrid): + // type2z2r is not used by non-opt + // but set type2z2r to 0 since accessed by opt int irow,icol; for (i = 1; i <= ntypes; i++) { for (j = 1; j <= ntypes; j++) { irow = map[i]; icol = map[j]; - if (irow == -1 || icol == -1) continue; + if (irow == -1 || icol == -1) { + type2z2r[i][j] = 0; + continue; + } if (irow < icol) { irow = map[j]; icol = map[i]; diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index d42bdce4c4eed0b7f9749d9198167daa1f7a0e3b..74cdd61f60457bdee69095cfb3a4b90b74705d60 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -305,14 +305,19 @@ void PairEAMFS::file2array() // set of z2r arrays only fill lower triangular Nelement matrix // value = n = sum over rows of lower-triangular matrix until reach irow,icol // swap indices when irow < icol to stay lower triangular - // OK if map = -1 (non-EAM atom in pair hybrid) b/c type2z2r not used + // if map = -1 (non-EAM atom in pair hybrid): + // type2z2r is not used by non-opt + // but set type2z2r to 0 since accessed by opt int irow,icol; for (i = 1; i <= ntypes; i++) { for (j = 1; j <= ntypes; j++) { irow = map[i]; icol = map[j]; - if (irow == -1 || icol == -1) continue; + if (irow == -1 || icol == -1) { + type2z2r[i][j] = 0; + continue; + } if (irow < icol) { irow = map[j]; icol = map[i]; diff --git a/src/finish.cpp b/src/finish.cpp index 72acf8497c61fb5dce0d57325c5386b12f8ad352..05ecd4ec84005ee23c00934898d6276687b6f471 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -414,8 +414,9 @@ void Finish::end(int flag) int inum = neighbor->lists[m]->inum; int *ilist = neighbor->lists[m]->ilist; int *numneigh = neighbor->lists[m]->numneigh; - for (int ii = 0; ii < inum; ii++) - nneigh += numneigh[ilist[ii]]; + if (numneigh) + for (i = 0; i < inum; i++) + nneigh += numneigh[ilist[i]]; } tmp = nneigh; @@ -443,9 +444,13 @@ void Finish::end(int flag) if (m < neighbor->old_nrequest) { nneigh = 0; - for (i = 0; i < atom->nlocal; i++) - nneigh += neighbor->lists[m]->numneigh[i]; - + int inum = neighbor->lists[m]->inum; + int *ilist = neighbor->lists[m]->ilist; + int *numneigh = neighbor->lists[m]->numneigh; + if (numneigh) + for (i = 0; i < inum; i++) + nneigh += numneigh[ilist[i]]; + tmp = nneigh; stats(1,&tmp,&ave,&max,&min,10,histo); if (me == 0) { diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index 0aca03a3827b945ce3998deb545338b43bb07214..9426c3df687a0a0a4216911cd737478c9cf7736f 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -32,6 +32,7 @@ NeighList::NeighList(LAMMPS *lmp, int size) : Pointers(lmp) maxlocal = 0; pgsize = size; + inum = 0; ilist = NULL; numneigh = NULL; firstneigh = NULL;