Commit e81ae21d authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

do not access uninitialized data for ewald/disp and pppm/disp

parent 7fdd6e28
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -489,8 +489,9 @@ void EwaldDisp::init_coeffs()
    double **b = (double **) force->pair->extract("B",tmp);
    delete [] B;
    B = new double[n+1];
    B[0] = 0.0;
    bytes += (n+1)*sizeof(double);
    for (int i=0; i<=n; ++i) B[i] = sqrt(fabs(b[i][i]));
    for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i]));
  }
  if (function[2]) {                                        // arithmetic 1/r^6
    double **epsilon = (double **) force->pair->extract("epsilon",tmp);
@@ -502,7 +503,9 @@ void EwaldDisp::init_coeffs()
    if (!(epsilon&&sigma))
      error->all(
          FLERR,"Epsilon or sigma reference not set by pair style in ewald/n");
    for (int i=0; i<=n; ++i) {
    for (int j=0; j<7; ++j)
      *(bi++) = 0.0;
    for (int i=1; i<=n; ++i) {
      eps_i = sqrt(epsilon[i][i]);
      sigma_i = sigma[i][i];
      sigma_n = 1.0;
+2 −1
Original line number Diff line number Diff line
@@ -1357,7 +1357,8 @@ void PPPMDisp::init_coeffs() // local pair coeffs
  if (function[1]) {					// geometric 1/r^6
    double **b = (double **) force->pair->extract("B",tmp);
    B = new double[n+1];
    for (int i=0; i<=n; ++i) B[i] = sqrt(fabs(b[i][i]));
    B[0] = 0.0;
    for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i]));
  }
  if (function[2]) {					// arithmetic 1/r^6
    //cannot use epsilon, because this has not been set yet