Unverified Commit 33e33048 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

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

The sna*/atom computes were not destroying SNA objects. Fixed.
parents e2293cc7 d753c51c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;
}

+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ class ComputeSNAAtom : public Compute {
  class SNA** snaptr;
  double cutmax;
  int quadraticflag;
  int nthreads;
};

}
+2 −0
Original line number Diff line number Diff line
@@ -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;
}

+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ class ComputeSNADAtom : public Compute {
  class SNA** snaptr;
  double cutmax;
  int quadraticflag;
  int nthreads;
};

}
+3 −0
Original line number Diff line number Diff line
@@ -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;
}

Loading