Unverified Commit 4c3dc956 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

need to explicitly clamp the forces and energy in single function to zero at...

need to explicitly clamp the forces and energy in single function to zero at (implicit) pairwise cutoff
parent 891be931
Loading
Loading
Loading
Loading
+12 −7
Original line number Original line Diff line number Diff line
@@ -129,8 +129,7 @@ void PairLJCubic::compute(int eflag, int vflag)
          if (rsq <= cut_inner_sq[itype][jtype])
          if (rsq <= cut_inner_sq[itype][jtype])
            evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
            evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
          else
          else
            evdwl = epsilon[itype][jtype]*
            evdwl = epsilon[itype][jtype]*(PHIS + DPHIDS*t - A3*t*t*t/6.0);
              (PHIS + DPHIDS*t - A3*t*t*t/6.0);
          evdwl *= factor_lj;
          evdwl *= factor_lj;


          if (evflag) ev_tally(i,j,nlocal,newton_pair,
          if (evflag) ev_tally(i,j,nlocal,newton_pair,
@@ -330,6 +329,13 @@ double PairLJCubic::single(int /*i*/, int /*j*/, int itype, int jtype,
  double r,t;
  double r,t;
  double rmin;
  double rmin;


  // this is a truncated potential with an implicit cutoff

  if (rsq >= cutsq[itype][jtype]) {
    fforce=0.0;
    return 0.0;
  }

  r2inv = 1.0/rsq;
  r2inv = 1.0/rsq;
  if (rsq <= cut_inner_sq[itype][jtype]) {
  if (rsq <= cut_inner_sq[itype][jtype]) {
    r6inv = r2inv*r2inv*r2inv;
    r6inv = r2inv*r2inv*r2inv;
@@ -345,8 +351,7 @@ double PairLJCubic::single(int /*i*/, int /*j*/, int itype, int jtype,
  if (rsq <= cut_inner_sq[itype][jtype])
  if (rsq <= cut_inner_sq[itype][jtype])
    philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
    philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
  else
  else
    philj = epsilon[itype][jtype]*
    philj = epsilon[itype][jtype]*(PHIS + DPHIDS*t - A3*t*t*t/6.0);
      (PHIS + DPHIDS*t - A3*t*t*t/6.0);


  return factor_lj*philj;
  return factor_lj*philj;
}
}