Commit 613bd77b authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed errors in mixed precision mode

parent 00e0bb96
......@@ -11,7 +11,7 @@ __kernel void applyAndersenThermostat(float collisionFrequency, float kT, __glob
float4 selectRand = random[randomIndex+atomGroups[index]];
float4 velRand = random[randomIndex+index];
real scale = (selectRand.w > -randomRange && selectRand.w < randomRange ? 0 : 1);
real add = (1-scale)*SQRT(kT*velocity.w);
real add = (1-scale)*sqrt(kT*velocity.w);
velocity.x = scale*velocity.x + add*velRand.x;
velocity.y = scale*velocity.y + add*velRand.y;
velocity.z = scale*velocity.z + add*velRand.z;
......
......@@ -8,9 +8,9 @@ __kernel void integrateBrownianPart1(mixed tauDeltaT, mixed noiseAmplitude, __gl
for (int index = get_global_id(0); index < NUM_ATOMS; index += get_global_size(0)) {
mixed invMass = velm[index].w;
if (invMass != 0) {
posDelta[index] = (mixed4) (tauDeltaT*invMass*force[index].x + noiseAmplitude*SQRT(invMass)*random[randomIndex].x,
tauDeltaT*invMass*force[index].y + noiseAmplitude*SQRT(invMass)*random[randomIndex].y,
tauDeltaT*invMass*force[index].z + noiseAmplitude*SQRT(invMass)*random[randomIndex].z, 0);
posDelta[index] = (mixed4) (tauDeltaT*invMass*force[index].x + noiseAmplitude*sqrt(invMass)*random[randomIndex].x,
tauDeltaT*invMass*force[index].y + noiseAmplitude*sqrt(invMass)*random[randomIndex].y,
tauDeltaT*invMass*force[index].z + noiseAmplitude*sqrt(invMass)*random[randomIndex].z, 0);
}
randomIndex += get_global_size(0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment