diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 9e2df3e46c..07b3ca6426 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -519,8 +519,8 @@ double LammpsInterface::domain_yz() const { return lammps_->domain->yz; } int LammpsInterface::domain_triclinic() const { return lammps_->domain->triclinic; } void LammpsInterface::box_periodicity(int & xperiodic, - int & yperiodic, - int & zperiodic) const + int & yperiodic, + int & zperiodic) const { xperiodic = lammps_->domain->xperiodic; yperiodic = lammps_->domain->yperiodic; @@ -546,6 +546,7 @@ bool LammpsInterface::region_bounds(const char * regionName, double & xscale, double & yscale, double & zscale) const { int iRegion = region_id(regionName); + if (iRegion < 0) throw ATC_Error("Unknown region " + to_string(regionName)); xscale = region_xscale(iRegion); yscale = region_yscale(iRegion); zscale = region_zscale(iRegion); diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index e9cc501744..1417ece8a9 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -106,6 +106,7 @@ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) : FixElectronStopping::~FixElectronStopping() { + delete[] idregion; memory->destroy(elstop_ranges); } diff --git a/src/SMTBQ/pair_smatb_single.cpp b/src/SMTBQ/pair_smatb_single.cpp index 759ad4216b..520716bb82 100644 --- a/src/SMTBQ/pair_smatb_single.cpp +++ b/src/SMTBQ/pair_smatb_single.cpp @@ -299,52 +299,33 @@ void PairSMATBSingle::init_style() double PairSMATBSingle::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); + //calculating the polynomial linking to zero double es = cutOffEnd - cutOffStart; double es2 = es * es; double es3 = es2 * es; //variables for poly for p and A - double expp = A * exp(p * (1. - cutOffStart / r0)); - double ap = -1. / es3; + double expp = A * exp(p * (1.0 - cutOffStart / r0)); + double ap = -1.0 / es3; double bp = p / (r0 * es2); double cp = -(p * p) / (es * r0 * r0); - a5 = expp * (12. * ap + 6. * bp + cp) / (2. * es2); - a4 = expp * (15. * ap + 7. * bp + cp) / es; - a3 = expp * (20. * ap + 8. * bp + cp) / 2.; + a5 = expp * (12.0 * ap + 6.0 * bp + cp) / (2.0 * es2); + a4 = expp * (15.0 * ap + 7.0 * bp + cp) / es; + a3 = expp * (20.0 * ap + 8.0 * bp + cp) / 2.0; //variables for poly for q and qsi - double expq = QSI * exp(q * (1. - cutOffStart / r0)); + double expq = QSI * exp(q * (1.0 - cutOffStart / r0)); double aq = -1 / es3; double bq = q / (es2 * r0); double cq = -(q * q) / (es * r0 * r0); - x5 = expq * (12. * aq + 6. * bq + cq) / (2. * es2); - x4 = expq * (15. * aq + 7. * bq + cq) / es; - x3 = expq * (20. * aq + 8. * bq + cq) / 2.; + x5 = expq * (12.0 * aq + 6.0 * bq + cq) / (2.0 * es2); + x4 = expq * (15.0 * aq + 7.0 * bq + cq) / es; + x3 = expq * (20.0 * aq + 8.0 * bq + cq) / 2.0; cutOffEnd2 = cutOffEnd * cutOffEnd; - if (i != j) { - setflag[j][i] = 1; - cutOffEnd2 = cutOffEnd2; - - r0 = r0; - p = p; - q = q; - A = A; - QSI = QSI; - cutOffStart = cutOffStart; - cutOffEnd = cutOffEnd; - - a3 = a3; - a4 = a4; - a5 = a5; - x3 = x3; - x4 = x4; - x5 = x5; - } - return cutOffEnd; }