"openmmapi/vscode:/vscode.git/clone" did not exist on "6eb3c4187c0a3692560d85c2227ba6f1b518e813"
customIntegratorPerDof.cl 1.89 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * Load the position of a particle.
 */
mixed4 loadPos(__global const real4* restrict posq, __global const real4* restrict posqCorrection, int index) {
#ifdef USE_MIXED_PRECISION
    real4 pos1 = posq[index];
    real4 pos2 = posqCorrection[index];
    return (mixed4) (pos1.x+(mixed)pos2.x, pos1.y+(mixed)pos2.y, pos1.z+(mixed)pos2.z, pos1.w);
#else
    return posq[index];
#endif
}

/**
 * Store the position of a particle.
 */
void storePos(__global real4* restrict posq, __global real4* restrict posqCorrection, int index, mixed4 pos) {
#ifdef USE_MIXED_PRECISION
    posq[index] = (real4) ((real) pos.x, (real) pos.y, (real) pos.z, (real) pos.w);
    posqCorrection[index] = (real4) (pos.x-(real) pos.x, pos.y-(real) pos.y, pos.z-(real) pos.z, 0);
#else
    posq[index] = pos;
23
#endif
24
}
25

26
27
__kernel void computePerDof(__global real4* restrict posq, __global real4* restrict posqCorrection, __global mixed4* restrict posDelta,
        __global mixed4* restrict velm, __global const real4* restrict force, __global const mixed2* restrict dt, __global const mixed* restrict globals,
28
29
        __global mixed* restrict sum, __global const float4* restrict gaussianValues, unsigned int gaussianBaseIndex, __global const float4* restrict uniformValues,
        const real energy, __global mixed* restrict energyParamDerivs
30
        PARAMETER_ARGUMENTS) {
31
    mixed stepSize = dt[0].y;
32
33
    int index = get_global_id(0);
    while (index < NUM_ATOMS) {
34
#ifdef LOAD_POS_AS_DELTA
35
        mixed4 position = loadPos(posq, posqCorrection, index)+posDelta[index];
36
#else
37
        mixed4 position = loadPos(posq, posqCorrection, index);
38
#endif
39
40
41
        mixed4 velocity = velm[index];
        real4 f = force[index];
        mixed mass = 1/velocity.w;
42
        if (velocity.w != 0.0) {
43
44
            int gaussianIndex = gaussianBaseIndex;
            int uniformIndex = 0;
45
46
            COMPUTE_STEP
        }
47
48
49
        index += get_global_size(0);
    }
}