Commit 0f76bbc7 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

replace rsq_lookup.f with rsq when computing the interpolation fraction for lookup tables

this avoids truncation for rsq to single precision without need and thus should improve accuracy
parent 62dea1bb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
            rsq_lookup.f = rsq;
            itable = rsq_lookup.i & ncoulmask;
            itable >>= ncoulshiftbits;
            fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
            fraction = (rsq - rtable[itable]) * drtable[itable];
            table = ftable[itable] + fraction*dftable[itable];
            forcecoul = qtmp*q[j] * table;
            if (factor_coul < 1.0) {
@@ -504,7 +504,7 @@ double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
      rsq_lookup.f = rsq;
      itable = rsq_lookup.i & ncoulmask;
      itable >>= ncoulshiftbits;
      fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
      fraction = (rsq - rtable[itable]) * drtable[itable];
      table = ftable[itable] + fraction*dftable[itable];
      forcecoul = atom->q[i]*atom->q[j] * table;
      if (factor_coul < 1.0) {
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ void PairBornCoulLongCS::compute(int eflag, int vflag)
            rsq_lookup.f = rsq;
            itable = rsq_lookup.i & ncoulmask;
            itable >>= ncoulshiftbits;
            fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
            fraction = (rsq - rtable[itable]) * drtable[itable];
            table = ftable[itable] + fraction*dftable[itable];
            forcecoul = qtmp*q[j] * table;
            if (factor_coul < 1.0) {
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ void PairBuckCoulLongCS::compute(int eflag, int vflag)
            rsq_lookup.f = rsq;
            itable = rsq_lookup.i & ncoulmask;
            itable >>= ncoulshiftbits;
            fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
            fraction = (rsq - rtable[itable]) * drtable[itable];
            table = ftable[itable] + fraction*dftable[itable];
            forcecoul = qtmp*q[j] * table;
            if (factor_coul < 1.0) {
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ void PairCoulLongCS::compute(int eflag, int vflag)
          rsq_lookup.f = rsq;
          itable = rsq_lookup.i & ncoulmask;
          itable >>= ncoulshiftbits;
          fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
          fraction = (rsq - rtable[itable]) * drtable[itable];
          table = ftable[itable] + fraction*dftable[itable];
          forcecoul = scale[itype][jtype] * qtmp*q[j] * table;
          if (factor_coul < 1.0) {
+2 −2
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ void PairLJCutCoulLongCS::compute(int eflag, int vflag)
            rsq_lookup.f = rsq;
            itable = rsq_lookup.i & ncoulmask;
            itable >>= ncoulshiftbits;
            fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
            fraction = (rsq - rtable[itable]) * drtable[itable];
            table = ftable[itable] + fraction*dftable[itable];
            forcecoul = qtmp*q[j] * table;
            if (factor_coul < 1.0) {
@@ -481,7 +481,7 @@ void PairLJCutCoulLongCS::compute_outer(int eflag, int vflag)
            rsq_lookup.f = rsq;
            itable = rsq_lookup.i & ncoulmask;
            itable >>= ncoulshiftbits;
            fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
            fraction = (rsq - rtable[itable]) * drtable[itable];
            table = ftable[itable] + fraction*dftable[itable];
            forcecoul = qtmp*q[j] * table;
            if (factor_coul < 1.0) {
Loading