forked from lijiext/lammps
ensure that local per-thread storage is completely cleared in hybrid styles.
This commit is contained in:
parent
3e39b8c62d
commit
5a2704efc2
|
@ -108,6 +108,18 @@ void AngleHybrid::compute(int eflag, int vflag)
|
||||||
|
|
||||||
ev_init(eflag,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++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
neighbor->nanglelist = nanglelist[m];
|
neighbor->nanglelist = nanglelist[m];
|
||||||
neighbor->anglelist = anglelist[m];
|
neighbor->anglelist = anglelist[m];
|
||||||
|
|
|
@ -108,6 +108,18 @@ void BondHybrid::compute(int eflag, int vflag)
|
||||||
|
|
||||||
ev_init(eflag,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++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
neighbor->nbondlist = nbondlist[m];
|
neighbor->nbondlist = nbondlist[m];
|
||||||
neighbor->bondlist = bondlist[m];
|
neighbor->bondlist = bondlist[m];
|
||||||
|
|
Loading…
Reference in New Issue