Commit 78b80ccf authored by peastman's avatar peastman
Browse files

Merge pull request #787 from peastman/step

Variable step size integrators were scaling the step size incorrectly
parents 923ccea5 bd01a379
......@@ -90,7 +90,7 @@ extern "C" __global__ void selectLangevinStepSize(int numAtoms, int paddedNumAto
while (index < numAtoms) {
mixed3 f = make_mixed3(scale*force[index], scale*force[index+paddedNumAtoms], scale*force[index+paddedNumAtoms*2]);
mixed invMass = velm[index].w;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass*invMass;
index += blockDim.x*gridDim.x;
}
error[threadIdx.x] = err;
......
......@@ -89,7 +89,7 @@ extern "C" __global__ void selectVerletStepSize(int numAtoms, int paddedNumAtoms
for (int index = threadIdx.x; index < numAtoms; index += blockDim.x*gridDim.x) {
mixed3 f = make_mixed3(scale*force[index], scale*force[index+paddedNumAtoms], scale*force[index+paddedNumAtoms*2]);
mixed invMass = velm[index].w;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass*invMass;
}
error[threadIdx.x] = err;
__syncthreads();
......
......@@ -81,7 +81,7 @@ __kernel void selectLangevinStepSize(mixed maxStepSize, mixed errorTol, mixed ta
while (index < NUM_ATOMS) {
real4 f = force[index];
mixed invMass = velm[index].w;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass*invMass;
index += get_global_size(0);
}
error[get_local_id(0)] = err;
......
......@@ -85,7 +85,7 @@ __kernel void selectVerletStepSize(int numAtoms, mixed maxStepSize, mixed errorT
while (index < numAtoms) {
real4 f = force[index];
mixed invMass = velm[index].w;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass;
err += (f.x*f.x + f.y*f.y + f.z*f.z)*invMass*invMass;
index += get_global_size(0);
}
error[get_local_id(0)] = err;
......
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