brownian.cl 1.1 KB
Newer Older
1
2
3
4
/**
 * Perform the first step of Brownian integration.
 */

5
6
__kernel void integrateBrownianPart1(float tauDeltaT, float noiseAmplitude, __global const float4* restrict force,
        __global float4* restrict posDelta, __global const float4* restrict velm, __global const float4* restrict random, unsigned int randomIndex) {
7
8
    randomIndex += get_global_id(0);
    for (int index = get_global_id(0); index < NUM_ATOMS; index += get_global_size(0)) {
9
10
        float invMass = velm[index].w;
        posDelta[index] = (float4) (tauDeltaT*invMass*force[index].xyz + noiseAmplitude*sqrt(invMass)*random[randomIndex].xyz, 0.0f);
11
12
13
14
15
16
17
18
        randomIndex += get_global_size(0);
    }
}

/**
 * Perform the second step of Brownian integration.
 */

19
__kernel void integrateBrownianPart2(float oneOverDeltaT, __global float4* posq, __global float4* velm, __global const float4* restrict posDelta) {
20
21
22
23
24
25
    for (int index = get_global_id(0); index < NUM_ATOMS; index += get_global_size(0)) {
        float4 delta = posDelta[index];
        velm[index].xyz = oneOverDeltaT*delta.xyz;
        posq[index].xyz = posq[index].xyz + delta.xyz;
    }
}