Commit 039bb3fb authored by Peter Eastman's avatar Peter Eastman
Browse files

Very minor code simplification

parent 70ff98db
#if USE_EWALD #if USE_EWALD
bool needCorrection = hasExclusions && isExcluded && atom1 != atom2 && atom1 < NUM_ATOMS && atom2 < NUM_ATOMS; bool needCorrection = hasExclusions && isExcluded && atom1 != atom2 && atom1 < NUM_ATOMS && atom2 < NUM_ATOMS;
if (!isExcluded || needCorrection) { if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
if (r2 < CUTOFF_SQUARED || needCorrection) {
const real alphaR = EWALD_ALPHA*r; const real alphaR = EWALD_ALPHA*r;
const real expAlphaRSqr = EXP(-alphaR*alphaR); const real expAlphaRSqr = EXP(-alphaR*alphaR);
const real prefactor = 138.935456f*posq1.w*posq2.w*invR; const real prefactor = 138.935456f*posq1.w*posq2.w*invR;
...@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) { ...@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
#endif #endif
} }
dEdR += tempForce*invR*invR; dEdR += tempForce*invR*invR;
}
} }
#else #else
{ {
......
#if USE_EWALD #if USE_EWALD
bool needCorrection = hasExclusions && isExcluded && atom1 != atom2 && atom1 < NUM_ATOMS && atom2 < NUM_ATOMS; bool needCorrection = hasExclusions && isExcluded && atom1 != atom2 && atom1 < NUM_ATOMS && atom2 < NUM_ATOMS;
if (!isExcluded || needCorrection) { if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
if (r2 < CUTOFF_SQUARED || needCorrection) {
const real alphaR = EWALD_ALPHA*r; const real alphaR = EWALD_ALPHA*r;
const real expAlphaRSqr = EXP(-alphaR*alphaR); const real expAlphaRSqr = EXP(-alphaR*alphaR);
const real prefactor = 138.935456f*posq1.w*posq2.w*invR; const real prefactor = 138.935456f*posq1.w*posq2.w*invR;
...@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) { ...@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
#endif #endif
} }
dEdR += tempForce*invR*invR; dEdR += tempForce*invR*invR;
}
} }
#else #else
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment