make use of copymode flag in pair style destructors consistent

This commit is contained in:
Axel Kohlmeyer 2019-03-22 04:55:58 -04:00
parent 8f90d6c6d0
commit b975d59d9f
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
18 changed files with 238 additions and 240 deletions

View File

@ -38,20 +38,20 @@ PairLJClass2::PairLJClass2(LAMMPS *lmp) : Pair(lmp)
PairLJClass2::~PairLJClass2()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}

View File

@ -39,23 +39,23 @@ PairLJClass2CoulCut::PairLJClass2CoulCut(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulCut::~PairLJClass2CoulCut()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(cut_coul);
memory->destroy(cut_coulsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(cut_coul);
memory->destroy(cut_coulsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}

View File

@ -50,21 +50,21 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulLong::~PairLJClass2CoulLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (ftable) free_tables();
}

View File

@ -50,23 +50,23 @@ PairBuckCoulLong::PairBuckCoulLong(LAMMPS *lmp) : Pair(lmp)
PairBuckCoulLong::~PairBuckCoulLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(a);
memory->destroy(rho);
memory->destroy(c);
memory->destroy(rhoinv);
memory->destroy(buck1);
memory->destroy(buck2);
memory->destroy(offset);
}
if (ftable) free_tables();
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(a);
memory->destroy(rho);
memory->destroy(c);
memory->destroy(rhoinv);
memory->destroy(buck1);
memory->destroy(buck2);
memory->destroy(offset);
}
if (ftable) free_tables();
}
/* ---------------------------------------------------------------------- */

View File

@ -55,15 +55,15 @@ PairCoulLong::PairCoulLong(LAMMPS *lmp) : Pair(lmp)
PairCoulLong::~PairCoulLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(scale);
}
if (ftable) free_tables();
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(scale);
}
if (ftable) free_tables();
}
/* ---------------------------------------------------------------------- */

View File

@ -59,27 +59,27 @@ PairLJCharmmCoulLong::PairLJCharmmCoulLong(LAMMPS *lmp) : Pair(lmp)
PairLJCharmmCoulLong::~PairLJCharmmCoulLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
memory->destroy(offset);
}
if (ftable) free_tables();
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
memory->destroy(offset);
}
if (ftable) free_tables();
}
/* ---------------------------------------------------------------------- */

View File

@ -77,27 +77,6 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp)
PairLJCharmmfswCoulLong::~PairLJCharmmfswCoulLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
}
if (ftable) free_tables();
}
// switch qqr2e back from CHARMM value to LAMMPS value
if (update && strcmp(update->unit_style,"real") == 0) {
@ -106,6 +85,27 @@ PairLJCharmmfswCoulLong::~PairLJCharmmfswCoulLong()
" conversion constant");
force->qqr2e = force->qqr2e_lammps_real;
}
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
}
if (ftable) free_tables();
}
/* ---------------------------------------------------------------------- */

View File

@ -43,8 +43,9 @@ PairLJCharmmCoulCharmm::PairLJCharmmCoulCharmm(LAMMPS *lmp) : Pair(lmp)
PairLJCharmmCoulCharmm::~PairLJCharmmCoulCharmm()
{
if (!copymode) {
if (allocated) {
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
@ -60,7 +61,6 @@ PairLJCharmmCoulCharmm::~PairLJCharmmCoulCharmm()
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
}
}
}

View File

@ -62,26 +62,6 @@ PairLJCharmmfswCoulCharmmfsh::PairLJCharmmfswCoulCharmmfsh(LAMMPS *lmp) :
PairLJCharmmfswCoulCharmmfsh::~PairLJCharmmfswCoulCharmmfsh()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
}
}
// switch qqr2e back from CHARMM value to LAMMPS value
if (update && strcmp(update->unit_style,"real") == 0) {
@ -90,6 +70,26 @@ PairLJCharmmfswCoulCharmmfsh::~PairLJCharmmfswCoulCharmmfsh()
" conversion constant");
force->qqr2e = force->qqr2e_lammps_real;
}
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(eps14);
memory->destroy(sigma14);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(lj14_1);
memory->destroy(lj14_2);
memory->destroy(lj14_3);
memory->destroy(lj14_4);
}
}
/* ---------------------------------------------------------------------- */

View File

@ -39,24 +39,24 @@ PairLJClass2CoulCutSoft::PairLJClass2CoulCutSoft(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulCutSoft::~PairLJClass2CoulCutSoft()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(cut_coul);
memory->destroy(cut_coulsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(cut_coul);
memory->destroy(cut_coulsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}

View File

@ -49,22 +49,22 @@ PairLJClass2CoulLongSoft::PairLJClass2CoulLongSoft(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulLongSoft::~PairLJClass2CoulLongSoft()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}

View File

@ -32,28 +32,26 @@ using namespace MathConst;
PairLJClass2Soft::PairLJClass2Soft(LAMMPS *lmp) : Pair(lmp)
{
writedata = 1;
allocated = 0;
}
/* ---------------------------------------------------------------------- */
PairLJClass2Soft::~PairLJClass2Soft()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(offset);
allocated=0;
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lambda);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(offset);
}
}

View File

@ -48,29 +48,29 @@ PairBuck6dCoulGaussDSF::PairBuck6dCoulGaussDSF(LAMMPS *lmp) : Pair(lmp)
PairBuck6dCoulGaussDSF::~PairBuck6dCoulGaussDSF()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(alpha_ij);
memory->destroy(f_shift_ij);
memory->destroy(e_shift_ij);
memory->destroy(buck6d1);
memory->destroy(buck6d2);
memory->destroy(buck6d3);
memory->destroy(buck6d4);
memory->destroy(c0);
memory->destroy(c1);
memory->destroy(c2);
memory->destroy(c3);
memory->destroy(c4);
memory->destroy(c5);
memory->destroy(rsmooth_sq);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(alpha_ij);
memory->destroy(f_shift_ij);
memory->destroy(e_shift_ij);
memory->destroy(buck6d1);
memory->destroy(buck6d2);
memory->destroy(buck6d3);
memory->destroy(buck6d4);
memory->destroy(c0);
memory->destroy(c1);
memory->destroy(c2);
memory->destroy(c3);
memory->destroy(c4);
memory->destroy(c5);
memory->destroy(rsmooth_sq);
memory->destroy(offset);
}
}

View File

@ -51,27 +51,27 @@ PairBuck6dCoulGaussLong::PairBuck6dCoulGaussLong(LAMMPS *lmp) : Pair(lmp)
PairBuck6dCoulGaussLong::~PairBuck6dCoulGaussLong()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(alpha_ij);
memory->destroy(buck6d1);
memory->destroy(buck6d2);
memory->destroy(buck6d3);
memory->destroy(buck6d4);
memory->destroy(c0);
memory->destroy(c1);
memory->destroy(c2);
memory->destroy(c3);
memory->destroy(c4);
memory->destroy(c5);
memory->destroy(rsmooth_sq);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(alpha_ij);
memory->destroy(buck6d1);
memory->destroy(buck6d2);
memory->destroy(buck6d3);
memory->destroy(buck6d4);
memory->destroy(c0);
memory->destroy(c1);
memory->destroy(c2);
memory->destroy(c3);
memory->destroy(c4);
memory->destroy(c5);
memory->destroy(rsmooth_sq);
memory->destroy(offset);
}
}

View File

@ -52,21 +52,21 @@ PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp)
PairLJCutCoulDSF::~PairLJCutCoulDSF()
{
if (!copymode) {
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
if (copymode) return;
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut_lj);
memory->destroy(cut_ljsq);
memory->destroy(epsilon);
memory->destroy(sigma);
memory->destroy(lj1);
memory->destroy(lj2);
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}

View File

@ -38,8 +38,9 @@ PairLJExpand::PairLJExpand(LAMMPS *lmp) : Pair(lmp)
PairLJExpand::~PairLJExpand()
{
if (!copymode) {
if (allocated) {
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
@ -52,7 +53,6 @@ PairLJExpand::~PairLJExpand()
memory->destroy(lj3);
memory->destroy(lj4);
memory->destroy(offset);
}
}
}

View File

@ -41,8 +41,9 @@ PairLJGromacs::PairLJGromacs(LAMMPS *lmp) : Pair(lmp)
PairLJGromacs::~PairLJGromacs()
{
if (!copymode) {
if (allocated) {
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
@ -60,7 +61,6 @@ PairLJGromacs::~PairLJGromacs()
memory->destroy(ljsw3);
memory->destroy(ljsw4);
memory->destroy(ljsw5);
}
}
}

View File

@ -41,8 +41,9 @@ PairLJGromacsCoulGromacs::PairLJGromacsCoulGromacs(LAMMPS *lmp) : Pair(lmp)
PairLJGromacsCoulGromacs::~PairLJGromacsCoulGromacs()
{
if (!copymode) {
if (allocated) {
if (copymode) return;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
@ -57,7 +58,6 @@ PairLJGromacsCoulGromacs::~PairLJGromacsCoulGromacs()
memory->destroy(ljsw3);
memory->destroy(ljsw4);
memory->destroy(ljsw5);
}
}
}