customNonbonded.cu 508 Bytes
Newer Older
1
2
3
4
5
6
7
#ifdef USE_CUTOFF
if (!isExcluded && r2 < CUTOFF_SQUARED) {
#else
if (!isExcluded) {
#endif
    real tempForce = 0;
    COMPUTE_FORCE
8
9
10
11
12
13
14
15
16
#if USE_SWITCH
    if (r > SWITCH_CUTOFF) {
        real x = r-SWITCH_CUTOFF;
        real switchValue = 1+x*x*x*(SWITCH_C3+x*(SWITCH_C4+x*SWITCH_C5));
        real switchDeriv = x*x*(3*SWITCH_C3+x*(4*SWITCH_C4+x*5*SWITCH_C5));
        tempForce = tempForce*switchValue - tempEnergy*switchDeriv;
        tempEnergy *= switchValue;
    }
#endif
17
18
    dEdR += tempForce*invR;
}