Commit 4ec07422 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid division by zero when using cutoff 0.0 with pair_modify shift yes

parent 3f297382
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ double PairGayBerne::init_one(int i, int j)
  lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
  lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);

  if (offset_flag) {
  if (offset_flag && (cut[i][j] > 0.0)) {
    double ratio = sigma[i][j] / cut[i][j];
    offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0));
  } else offset[i][j] = 0.0;
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ double PairRESquared::init_one(int i, int j)
  lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
  lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);

  if (offset_flag) {
  if (offset_flag && (cut[i][j] > 0.0)) {
    double ratio = sigma[i][j] / cut[i][j];
    offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0));
  } else offset[i][j] = 0.0;
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ double PairLJClass2::init_one(int i, int j)
  lj3[i][j] = 2.0 * epsilon[i][j] * pow(sigma[i][j],9.0);
  lj4[i][j] = 3.0 * epsilon[i][j] * pow(sigma[i][j],6.0);

  if (offset_flag) {
  if (offset_flag && (cut[i][j] > 0.0)) {
    double ratio = sigma[i][j] / cut[i][j];
    offset[i][j] = epsilon[i][j] * (2.0*pow(ratio,9.0) - 3.0*pow(ratio,6.0));
  } else offset[i][j] = 0.0;
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ double PairLJClass2CoulCut::init_one(int i, int j)
  lj3[i][j] = 2.0 * epsilon[i][j] * pow(sigma[i][j],9.0);
  lj4[i][j] = 3.0 * epsilon[i][j] * pow(sigma[i][j],6.0);

  if (offset_flag) {
  if (offset_flag && (cut_lj[i][j] > 0.0)) {
    double ratio = sigma[i][j] / cut_lj[i][j];
    offset[i][j] = epsilon[i][j] * (2.0*pow(ratio,9.0) - 3.0*pow(ratio,6.0));
  } else offset[i][j] = 0.0;
+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ double PairLJClass2CoulLong::init_one(int i, int j)
  lj3[i][j] = 2.0 * epsilon[i][j] * pow(sigma[i][j],9.0);
  lj4[i][j] = 3.0 * epsilon[i][j] * pow(sigma[i][j],6.0);

  if (offset_flag) {
  if (offset_flag && (cut_lj[i][j] > 0.0)) {
    double ratio = sigma[i][j] / cut_lj[i][j];
    offset[i][j] = epsilon[i][j] * (2.0*pow(ratio,9.0) - 3.0*pow(ratio,6.0));
  } else offset[i][j] = 0.0;
Loading