Unverified Commit abe4385f authored by Andy Simmonett's avatar Andy Simmonett
Browse files

Fix bug in CUDA LJPME energy without Coulomb terms

parent eb2f74e0
...@@ -2192,8 +2192,6 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF ...@@ -2192,8 +2192,6 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF
cu.executeKernel(pmeInterpolateForceKernel, interpolateArgs, cu.getNumAtoms(), 128); cu.executeKernel(pmeInterpolateForceKernel, interpolateArgs, cu.getNumAtoms(), 128);
} }
// As written, we check only the Electrostatic grid pointer to get here. We could separate them out, but for
// now we assume that LJPME can only be used if electrostatic PME is also active.
if (doLJPME && hasLJ) { if (doLJPME && hasLJ) {
if (!hasCoulomb) { if (!hasCoulomb) {
void* gridIndexArgs[] = {&cu.getPosq().getDevicePointer(), &pmeAtomGridIndex.getDevicePointer(), cu.getPeriodicBoxSizePointer(), void* gridIndexArgs[] = {&cu.getPosq().getDevicePointer(), &pmeAtomGridIndex.getDevicePointer(), cu.getPeriodicBoxSizePointer(),
...@@ -2202,6 +2200,7 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF ...@@ -2202,6 +2200,7 @@ double CudaCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeF
cu.executeKernel(pmeDispersionGridIndexKernel, gridIndexArgs, cu.getNumAtoms()); cu.executeKernel(pmeDispersionGridIndexKernel, gridIndexArgs, cu.getNumAtoms());
sort->sort(pmeAtomGridIndex); sort->sort(pmeAtomGridIndex);
cu.clearBuffer(pmeEnergyBuffer);
} }
cu.clearBuffer(pmeGrid2); cu.clearBuffer(pmeGrid2);
......
...@@ -1307,6 +1307,11 @@ void testWater125DpmeVsLongCutoffNoExclusions() { ...@@ -1307,6 +1307,11 @@ void testWater125DpmeVsLongCutoffNoExclusions() {
State state = context.getState(State::Forces | State::Energy); State state = context.getState(State::Forces | State::Energy);
double energy = state.getPotentialEnergy(); double energy = state.getPotentialEnergy();
// Make another call to the get the energy to test that the call is
// idempotent when Coulomb terms are absent.
double secondEnergy = context.getState(State::Energy).getPotentialEnergy();
ASSERT_EQUAL_TOL(secondEnergy, energy, 5E-5);
//Gromacs reference values. See comments in testWater2DpmeEnergiesForcesNoExclusions() for details. //Gromacs reference values. See comments in testWater2DpmeEnergiesForcesNoExclusions() for details.
//Coordinates are from make_waterbox, and the .gro file looks like //Coordinates are from make_waterbox, and the .gro file looks like
// //
......
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