"platforms/reference/src/sfmt/SFMT-params4253.h" did not exist on "85da5e0f9018719e95350c76b483a2160c84d9d3"
customGBEnergyPerParticle.cc 1.08 KB
Newer Older
Peter Eastman's avatar
Peter Eastman committed
1
#define REDUCE_VALUE(NAME, TYPE) {\
2
3
4
    TYPE sum = NAME[index]; \
    for (int i = index+bufferSize; i < totalSize; i += bufferSize) \
        sum += NAME[i]; \
Peter Eastman's avatar
Peter Eastman committed
5
6
    NAME[index] = sum; \
}
7

8
9
10
11
/**
 * Reduce the derivatives computed in the N^2 energy kernel, and compute all per-particle energy terms.
 */

12
13
14
15
16
17
KERNEL void computePerParticleEnergy(GLOBAL mixed* RESTRICT energyBuffer, GLOBAL const real4* RESTRICT posq,
#ifdef SUPPORTS_64_BIT_ATOMICS
        GLOBAL mm_long* RESTRICT forceBuffers
#else
        GLOBAL real4* RESTRICT forceBuffers, int bufferSize, int numBuffers
#endif
18
        PARAMETER_ARGUMENTS) {
19
    mixed energy = 0;
20
    INIT_PARAM_DERIVS
21
    for (int index = GLOBAL_ID; index < NUM_ATOMS; index += GLOBAL_SIZE) {
22
23
        // Reduce the derivatives

24
#ifndef SUPPORTS_64_BIT_ATOMICS
25
        int totalSize = bufferSize*numBuffers;
26
#endif
27
        REDUCE_DERIVATIVES
28
29
30

        // Now calculate the per-particle energy terms.

31
        real4 pos = posq[index];
32
        real3 force = make_real3(0, 0, 0);
33
34
        COMPUTE_ENERGY
    }
35
    energyBuffer[GLOBAL_ID] += energy;
36
    SAVE_PARAM_DERIVS
37
}