Unverified Commit 17b74762 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid sqrt computation on cutoffs. make single functions consistent with compute

parent 9f469623
Loading
Loading
Loading
Loading
+31 −24
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ void PairCoulShield::compute(int eflag, int vflag)

        // turn on/off taper function
        if (tap_flag) {
          Tap = calc_Tap(r,sqrt(cutsq[itype][jtype]));
          dTap = calc_dTap(r,sqrt(cutsq[itype][jtype]));
          Tap = calc_Tap(r,cut[itype][jtype]);
          dTap = calc_dTap(r,cut[itype][jtype]);
        } else {Tap = 1.0; dTap = 0.0;}

        forcecoul = qqrd2e*qtmp*q[j]*r*depsdr;
@@ -348,6 +348,13 @@ double PairCoulShield::single(int i, int j, int itype, int jtype,
  double *q = atom->q;
  double qqrd2e = force->qqrd2e;

  // only computed between different layers as indicated by different molecule ids.

  if (atom->molecule[i] == atom->molecule[j]) {
    fforce = 0.0;
    return 0.0;
  }

  r = sqrt(rsq);
  r3 = rsq*r;
  rarg = 1.0/sigmae[itype][jtype];
@@ -359,15 +366,15 @@ double PairCoulShield::single(int i, int j, int itype, int jtype,

  // turn on/off taper function
  if (tap_flag) {
     Tap = calc_Tap(r,sqrt(cutsq[itype][jtype]));
     dTap = calc_dTap(r,sqrt(cutsq[itype][jtype]));
    Tap = calc_Tap(r,cut[itype][jtype]);
    dTap = calc_dTap(r,cut[itype][jtype]);
  } else {Tap = 1.0; dTap = 0.0;}

  forcecoul = qqrd2e*q[i]*q[j]*r*depsdr;
  fvc = forcecoul*Tap - Vc*dTap/r;
  fforce = factor_coul*fvc;

  if (tap_flag) phishieldec = factor_coul*Vc*Tap;
  if (tap_flag) phishieldec = Vc*Tap;
  else phishieldec = Vc - offset[itype][jtype];
  return factor_coul*phishieldec;
}