Merge pull request #1125 from athomps/sna-atom-leakfix

The sna*/atom computes were not destroying SNA objects. Fixed.
This commit is contained in:
Axel Kohlmeyer
2018-09-18 15:50:17 -04:00
committed by GitHub
6 changed files with 12 additions and 1 deletions

View File

@ -115,7 +115,8 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal compute sna/atom command");
}
snaptr = new SNA*[comm->nthreads];
nthreads = comm->nthreads;
snaptr = new SNA*[nthreads];
#if defined(_OPENMP)
#pragma omp parallel default(none) shared(lmp,rfac0,twojmax,rmin0,switchflag,bzeroflag)
#endif
@ -146,6 +147,8 @@ ComputeSNAAtom::~ComputeSNAAtom()
memory->destroy(radelem);
memory->destroy(wjelem);
memory->destroy(cutsq);
for (int tid = 0; tid<nthreads; tid++)
delete snaptr[tid];
delete [] snaptr;
}

View File

@ -45,6 +45,7 @@ class ComputeSNAAtom : public Compute {
class SNA** snaptr;
double cutmax;
int quadraticflag;
int nthreads;
};
}

View File

@ -148,6 +148,8 @@ ComputeSNADAtom::~ComputeSNADAtom()
memory->destroy(radelem);
memory->destroy(wjelem);
memory->destroy(cutsq);
for (int tid = 0; tid<nthreads; tid++)
delete snaptr[tid];
delete [] snaptr;
}

View File

@ -47,6 +47,7 @@ class ComputeSNADAtom : public Compute {
class SNA** snaptr;
double cutmax;
int quadraticflag;
int nthreads;
};
}

View File

@ -142,6 +142,9 @@ ComputeSNAVAtom::~ComputeSNAVAtom()
memory->destroy(radelem);
memory->destroy(wjelem);
memory->destroy(cutsq);
for (int tid = 0; tid<nthreads; tid++)
delete snaptr[tid];
delete [] snaptr;
}

View File

@ -46,6 +46,7 @@ class ComputeSNAVAtom : public Compute {
double *wjelem;
class SNA** snaptr;
int quadraticflag;
int nthreads;
};
}