"plugins/vscode:/vscode.git/clone" did not exist on "b591d0113681896c1d7613858cfaea11f5091641"
Commit 138c1c88 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed a bug in local force computation that produced a launch failure on Linux

parent b12bd24c
......@@ -136,12 +136,8 @@ __global__ void kCalculateLocalForces_kernel()
dz *= dEdR;
unsigned int offsetA = atom.x + atom.z * cSim.stride;
unsigned int offsetB = atom.y + atom.w * cSim.stride;
float4 forceA = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.z < cSim.totalNonbondOutputBuffers)
forceA = cSim.pForce4[offsetA];
float4 forceB = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.w < cSim.totalNonbondOutputBuffers)
forceB = cSim.pForce4[offsetB];
float4 forceA = cSim.pForce4[offsetA];
float4 forceB = cSim.pForce4[offsetB];
forceA.x += dx;
forceA.y += dy;
forceA.z += dz;
......@@ -195,24 +191,18 @@ __global__ void kCalculateLocalForces_kernel()
c23.z *= termC;
int2 atom2 = cSim.pBondAngleID2[pos1];
unsigned int offset = atom1.x + atom1.w * cSim.stride;
float4 force = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom1.w < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
float4 force = cSim.pForce4[offset];
force.x += c21.x;
force.y += c21.y;
force.z += c21.z;
cSim.pForce4[offset] = force;
offset = atom1.y + atom2.x * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.x < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x -= (c21.x + c23.x);
force.y -= (c21.y + c23.y);
force.z -= (c21.z + c23.z);
cSim.pForce4[offset] = force;
offset = atom1.z + atom2.y * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.y < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x += c23.x;
force.y += c23.y;
......@@ -264,9 +254,7 @@ __global__ void kCalculateLocalForces_kernel()
// printf("%4d: %9.4f %9.4f %9.4f %9.4f\n", pos1, ff.x, ff.y, ff.z, ff.w);
unsigned int offset = atom1.x + atom2.x * cSim.stride;
float4 force = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom2.x < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
float4 force = cSim.pForce4[offset];
internalF0.x = ff.x * cp0.x;
force.x += internalF0.x;
internalF0.y = ff.x * cp0.y;
......@@ -277,8 +265,6 @@ __global__ void kCalculateLocalForces_kernel()
//printf("%4d - 0: %9.4f %9.4f %9.4f\n", pos1, cSim.pForce[offset], cSim.pForce[offset + cSim.stride], cSim.pForce[offset + cSim.stride2]);
offset = atom1.w + atom2.w * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.w < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
internalF3.x = ff.w * cp1.x;
force.x += internalF3.x;
......@@ -293,8 +279,6 @@ __global__ void kCalculateLocalForces_kernel()
s.y = ff.y * internalF0.y - ff.z * internalF3.y;
s.z = ff.y * internalF0.z - ff.z * internalF3.z;
offset = atom1.y + atom2.y * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.y < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x += -internalF0.x + s.x;
force.y += -internalF0.y + s.y;
......@@ -303,8 +287,6 @@ __global__ void kCalculateLocalForces_kernel()
//printf("%4d - 1: %9.4f %9.4f %9.4f\n", pos1, cSim.pForce[offset], cSim.pForce[offset + cSim.stride], cSim.pForce[offset + cSim.stride2]);
offset = atom1.z + atom2.z * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.z < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x += -internalF3.x - s.x;
force.y += -internalF3.y - s.y;
......@@ -385,9 +367,7 @@ __global__ void kCalculateLocalForces_kernel()
// printf("%4d: %9.4f %9.4f %9.4f %9.4f\n", pos1, ff.x, ff.y, ff.z, ff.w);
unsigned int offset = atom1.x + atom2.x * cSim.stride;
float4 force = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom2.x < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
float4 force = cSim.pForce4[offset];
internalF0.x = ff.x * cp0.x;
force.x += internalF0.x;
internalF0.y = ff.x * cp0.y;
......@@ -398,8 +378,6 @@ __global__ void kCalculateLocalForces_kernel()
// printf("%4d - 0: %9.4f %9.4f %9.4f\n", pos1, cSim.pForce[offset], cSim.pForce[offset + cSim.stride], cSim.pForce[offset + cSim.stride2]);
offset = atom1.w + atom2.w * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.w < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
internalF3.x = ff.w * cp1.x;
force.x += internalF3.x;
......@@ -414,8 +392,6 @@ __global__ void kCalculateLocalForces_kernel()
s.y = ff.y * internalF0.y - ff.z * internalF3.y;
s.z = ff.y * internalF0.z - ff.z * internalF3.z;
offset = atom1.y + atom2.y * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.y < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x += -internalF0.x + s.x;
force.y += -internalF0.y + s.y;
......@@ -423,8 +399,6 @@ __global__ void kCalculateLocalForces_kernel()
cSim.pForce4[offset] = force;
// printf("%4d - 1: %9.4f %9.4f %9.4f\n", pos1, cSim.pForce[offset], cSim.pForce[offset + cSim.stride], cSim.pForce[offset + cSim.stride2]);
offset = atom1.z + atom2.z * cSim.stride;
force.x = force.y = force.z = 0.0f;
if (atom2.z < cSim.totalNonbondOutputBuffers)
force = cSim.pForce4[offset];
force.x += -internalF3.x - s.x;
force.y += -internalF3.y - s.y;
......@@ -460,12 +434,8 @@ __global__ void kCalculateLocalForces_kernel()
dEdR *= inverseR * inverseR;
unsigned int offsetA = atom.x + atom.z * cSim.stride;
unsigned int offsetB = atom.y + atom.w * cSim.stride;
float4 forceA = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.z < cSim.totalNonbondOutputBuffers)
forceA = cSim.pForce4[offsetA];
float4 forceB = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.w < cSim.totalNonbondOutputBuffers)
forceB = cSim.pForce4[offsetB];
float4 forceA = cSim.pForce4[offsetA];
float4 forceB = cSim.pForce4[offsetB];
d.x *= dEdR;
d.y *= dEdR;
d.z *= dEdR;
......@@ -510,12 +480,8 @@ __global__ void kCalculateLocalForces_kernel()
}
unsigned int offsetA = atom.x + atom.z * cSim.stride;
unsigned int offsetB = atom.y + atom.w * cSim.stride;
float4 forceA = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.z < cSim.totalNonbondOutputBuffers)
forceA = cSim.pForce4[offsetA];
float4 forceB = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.w < cSim.totalNonbondOutputBuffers)
forceB = cSim.pForce4[offsetB];
float4 forceA = cSim.pForce4[offsetA];
float4 forceB = cSim.pForce4[offsetB];
d.x *= dEdR;
d.y *= dEdR;
d.z *= dEdR;
......@@ -563,12 +529,8 @@ __global__ void kCalculateLocalForces_kernel()
}
unsigned int offsetA = atom.x + atom.z * cSim.stride;
unsigned int offsetB = atom.y + atom.w * cSim.stride;
float4 forceA = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.z < cSim.totalNonbondOutputBuffers)
forceA = cSim.pForce4[offsetA];
float4 forceB = {0.0f, 0.0f, 0.0f, 0.0f};
if (atom.w < cSim.totalNonbondOutputBuffers)
forceB = cSim.pForce4[offsetB];
float4 forceA = cSim.pForce4[offsetA];
float4 forceB = cSim.pForce4[offsetB];
d.x *= dEdR;
d.y *= dEdR;
d.z *= dEdR;
......
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