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