"wrappers/python/src/vscode:/vscode.git/clone" did not exist on "2fbed592588e968fc244f6a60718db1e7fed2bec"
Commit 3c130a24 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed bugs in AMOEBA GK

parent 20e01186
...@@ -1079,7 +1079,7 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const ...@@ -1079,7 +1079,7 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
electrostaticsSource << "#define T1\n"; electrostaticsSource << "#define T1\n";
electrostaticsSource << CudaAmoebaKernelSources::electrostaticPairForce; electrostaticsSource << CudaAmoebaKernelSources::electrostaticPairForce;
electrostaticsSource << "#undef T1\n"; electrostaticsSource << "#undef T1\n";
electrostaticsSource << "#define T2\n"; electrostaticsSource << "#define T3\n";
electrostaticsSource << CudaAmoebaKernelSources::electrostaticPairForce; electrostaticsSource << CudaAmoebaKernelSources::electrostaticPairForce;
} }
module = cu.createModule(electrostaticsSource.str(), defines); module = cu.createModule(electrostaticsSource.str(), defines);
...@@ -1401,12 +1401,6 @@ double CudaCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool in ...@@ -1401,12 +1401,6 @@ double CudaCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool in
cu.executeKernel(electrostaticsKernel, electrostaticsArgs, numForceThreadBlocks*forceThreadBlockSize, forceThreadBlockSize); cu.executeKernel(electrostaticsKernel, electrostaticsArgs, numForceThreadBlocks*forceThreadBlockSize, forceThreadBlockSize);
if (gkKernel != NULL) if (gkKernel != NULL)
gkKernel->finishComputation(*torque, *labFrameDipoles, *labFrameQuadrupoles, *inducedDipole, *inducedDipolePolar, *dampingAndThole, *covalentFlags, *polarizationGroupFlags); gkKernel->finishComputation(*torque, *labFrameDipoles, *labFrameQuadrupoles, *inducedDipole, *inducedDipolePolar, *dampingAndThole, *covalentFlags, *polarizationGroupFlags);
// Map torques to force.
void* mapTorqueArgs[] = {&cu.getForce().getDevicePointer(), &torque->getDevicePointer(),
&cu.getPosq().getDevicePointer(), &multipoleParticles->getDevicePointer()};
cu.executeKernel(mapTorqueKernel, mapTorqueArgs, cu.getNumAtoms());
} }
else { else {
// Reciprocal space calculation. // Reciprocal space calculation.
...@@ -1534,13 +1528,13 @@ double CudaCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool in ...@@ -1534,13 +1528,13 @@ double CudaCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool in
&inducedDipole->getDevicePointer(), &inducedDipolePolar->getDevicePointer(), &pmePhi->getDevicePointer(), &pmePhid->getDevicePointer(), &inducedDipole->getDevicePointer(), &inducedDipolePolar->getDevicePointer(), &pmePhi->getDevicePointer(), &pmePhid->getDevicePointer(),
&pmePhip->getDevicePointer(), &pmePhidp->getDevicePointer(), cu.getInvPeriodicBoxSizePointer()}; &pmePhip->getDevicePointer(), &pmePhidp->getDevicePointer(), cu.getInvPeriodicBoxSizePointer()};
cu.executeKernel(pmeInducedForceKernel, pmeInducedForceArgs, cu.getNumAtoms()); cu.executeKernel(pmeInducedForceKernel, pmeInducedForceArgs, cu.getNumAtoms());
// Map torques to force.
void* mapTorqueArgs[] = {&cu.getForce().getDevicePointer(), &torque->getDevicePointer(),
&cu.getPosq().getDevicePointer(), &multipoleParticles->getDevicePointer()};
cu.executeKernel(mapTorqueKernel, mapTorqueArgs, cu.getNumAtoms());
} }
// Map torques to force.
void* mapTorqueArgs[] = {&cu.getForce().getDevicePointer(), &torque->getDevicePointer(),
&cu.getPosq().getDevicePointer(), &multipoleParticles->getDevicePointer()};
cu.executeKernel(mapTorqueKernel, mapTorqueArgs, cu.getNumAtoms());
return 0.0; return 0.0;
} }
......
...@@ -50,7 +50,7 @@ typedef struct { ...@@ -50,7 +50,7 @@ typedef struct {
float radius, scaledRadius, padding; float radius, scaledRadius, padding;
} AtomData1; } AtomData1;
__device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2, float& bornSum) { __device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2) {
if (atom1.radius <= 0) if (atom1.radius <= 0)
return; // Ignore this interaction return; // Ignore this interaction
real3 delta = atom2.pos - atom1.pos; real3 delta = atom2.pos - atom1.pos;
...@@ -61,7 +61,7 @@ __device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2, ...@@ -61,7 +61,7 @@ __device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2,
if (atom1.radius+r < sk) { if (atom1.radius+r < sk) {
real lik = atom1.radius; real lik = atom1.radius;
real uik = sk - r; real uik = sk - r;
bornSum -= RECIP(uik*uik*uik) - RECIP(lik*lik*lik); atom1.bornSum -= RECIP(uik*uik*uik) - RECIP(lik*lik*lik);
} }
real uik = r+sk; real uik = r+sk;
real lik; real lik;
...@@ -80,7 +80,7 @@ __device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2, ...@@ -80,7 +80,7 @@ __device__ void computeBornSumOneInteraction(AtomData1& atom1, AtomData1& atom2,
real ur = uik*r; real ur = uik*r;
real u4r = u4*r; real u4r = u4*r;
real term = (3*(r2-sk2)+6*u2-8*ur)/u4r - (3*(r2-sk2)+6*l2-8*lr)/l4r; real term = (3*(r2-sk2)+6*u2-8*ur)/u4r - (3*(r2-sk2)+6*l2-8*lr)/l4r;
bornSum += term/16; atom1.bornSum += term/16;
} }
/** /**
...@@ -124,7 +124,7 @@ extern "C" __global__ void computeBornSum(unsigned long long* __restrict__ bornS ...@@ -124,7 +124,7 @@ extern "C" __global__ void computeBornSum(unsigned long long* __restrict__ bornS
for (unsigned int j = 0; j < TILE_SIZE; j++) { for (unsigned int j = 0; j < TILE_SIZE; j++) {
int atom2 = y*TILE_SIZE+j; int atom2 = y*TILE_SIZE+j;
if (atom1 < NUM_ATOMS && atom2 < NUM_ATOMS && atom1 != atom2) if (atom1 < NUM_ATOMS && atom2 < NUM_ATOMS && atom1 != atom2)
computeBornSumOneInteraction(data, localData[tbx+j], data.bornSum); computeBornSumOneInteraction(data, localData[tbx+j]);
} }
} }
else { else {
...@@ -146,8 +146,8 @@ extern "C" __global__ void computeBornSum(unsigned long long* __restrict__ bornS ...@@ -146,8 +146,8 @@ extern "C" __global__ void computeBornSum(unsigned long long* __restrict__ bornS
for (unsigned int j = 0; j < TILE_SIZE; j++) { for (unsigned int j = 0; j < TILE_SIZE; j++) {
int atom2 = y*TILE_SIZE+tj; int atom2 = y*TILE_SIZE+tj;
if (atom1 < NUM_ATOMS && atom2 < NUM_ATOMS) { if (atom1 < NUM_ATOMS && atom2 < NUM_ATOMS) {
computeBornSumOneInteraction(data, localData[tbx+j], data.bornSum); computeBornSumOneInteraction(data, localData[tbx+tj]);
computeBornSumOneInteraction(localData[tbx+j], data, localData[tbx+j].bornSum); computeBornSumOneInteraction(localData[tbx+tj], data);
} }
tj = (tj + 1) & (TILE_SIZE - 1); tj = (tj + 1) & (TILE_SIZE - 1);
} }
......
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