Unverified Commit 5a2704ef authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

ensure that local per-thread storage is completely cleared in hybrid styles.

parent 3e39b8c6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -108,6 +108,18 @@ void AngleHybrid::compute(int eflag, int vflag)

  ev_init(eflag,vflag);

  // need to clear per-thread storage here, when using multiple threads
  // with thread-enabled substyles to avoid uninitlialized data access.

  const int nthreads = comm->nthreads;
  if (comm->nthreads > 1) {
    const int nall = atom->nlocal + atom->nghost;
    if (eflag_atom)
      memset(&eatom[0],0,nall*nthreads*sizeof(double));
    if (vflag_atom)
      memset(&vatom[0][0],0,6*nall*nthreads*sizeof(double));
  }

  for (m = 0; m < nstyles; m++) {
    neighbor->nanglelist = nanglelist[m];
    neighbor->anglelist = anglelist[m];
+12 −0
Original line number Diff line number Diff line
@@ -108,6 +108,18 @@ void BondHybrid::compute(int eflag, int vflag)

  ev_init(eflag,vflag);

  // need to clear per-thread storage once here, when using multiple threads
  // with thread-enabled substyles to avoid uninitlialized data access.

  const int nthreads = comm->nthreads;
  if (nthreads > 1) {
    const int nall = atom->nlocal + atom->nghost;
    if (eflag_atom)
      memset(&eatom[0],0,nall*nthreads*sizeof(double));
    if (vflag_atom)
      memset(&vatom[0][0],0,6*nall*nthreads*sizeof(double));
  }

  for (m = 0; m < nstyles; m++) {
    neighbor->nbondlist = nbondlist[m];
    neighbor->bondlist = bondlist[m];