fix race condition in derived neighborlist build

This commit is contained in:
Axel Kohlmeyer
2012-02-03 23:12:01 -05:00
parent 78e2b4b61d
commit 416f52f28e

View File

@ -56,14 +56,14 @@ void Neighbor::half_from_full_no_newton_omp(NeighList *list)
for (ii = ifrom; ii < ito; ii++) {
#if defined(_OPENMP)
#pragma omp critical
#endif
if (pgsize - npnt < oneatom) {
npnt = 0;
npage += nthreads;
// only one thread at a time may check whether we
// need new neighbor list pages and then add to them.
#if defined(_OPENMP)
#pragma omp critical
#endif
if (npage >= list->maxpage) list->add_pages(nthreads);
}
@ -132,14 +132,14 @@ void Neighbor::half_from_full_newton_omp(NeighList *list)
for (ii = ifrom; ii < ito; ii++) {
#if defined(_OPENMP)
#pragma omp critical
#endif
if (pgsize - npnt < oneatom) {
npnt = 0;
npage += nthreads;
// only one thread at a time may check whether we
// need new neighbor list pages and then add to them.
#if defined(_OPENMP)
#pragma omp critical
#endif
if (npage >= list->maxpage) list->add_pages(nthreads);
}