Unverified Commit a18b750b authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Fixed error in accumulating parameter derivatives (#4249)

parent 76be194c
...@@ -2315,7 +2315,7 @@ void CommonCalcCustomNonbondedForceKernel::initInteractionGroups(const CustomNon ...@@ -2315,7 +2315,7 @@ void CommonCalcCustomNonbondedForceKernel::initInteractionGroups(const CustomNon
initDerivs<<"mixed "<<derivVariable<<" = 0;\n"; initDerivs<<"mixed "<<derivVariable<<" = 0;\n";
for (int index = 0; index < numDerivs; index++) for (int index = 0; index < numDerivs; index++)
if (allParamDerivNames[index] == paramName) if (allParamDerivNames[index] == paramName)
saveDerivs<<"energyParamDerivs[GLOBAL_ID*"<<numDerivs<<"+"<<index<<"] += "<<derivVariable<<";\n"; saveDerivs<<"energyParamDerivs[GLOBAL_ID*numDerivatives+"<<index<<"] += "<<derivVariable<<";\n";
} }
replacements["INIT_DERIVATIVES"] = initDerivs.str(); replacements["INIT_DERIVATIVES"] = initDerivs.str();
replacements["SAVE_DERIVATIVES"] = saveDerivs.str(); replacements["SAVE_DERIVATIVES"] = saveDerivs.str();
...@@ -2391,6 +2391,7 @@ double CommonCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool ...@@ -2391,6 +2391,7 @@ double CommonCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool
interactionGroupKernel->addArg((int) useNeighborList); interactionGroupKernel->addArg((int) useNeighborList);
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
interactionGroupKernel->addArg(); // Periodic box information will be set just before it is executed. interactionGroupKernel->addArg(); // Periodic box information will be set just before it is executed.
interactionGroupKernel->addArg((int) cc.getEnergyParamDerivNames().size());
for (auto& buffer : paramBuffers) for (auto& buffer : paramBuffers)
interactionGroupKernel->addArg(buffer.getArray()); interactionGroupKernel->addArg(buffer.getArray());
for (auto& buffer : computedValueBuffers) for (auto& buffer : computedValueBuffers)
......
...@@ -39,7 +39,7 @@ KERNEL void computeInteractionGroups( ...@@ -39,7 +39,7 @@ KERNEL void computeInteractionGroups(
GLOBAL mm_ulong* RESTRICT forceBuffers, GLOBAL mm_ulong* RESTRICT forceBuffers,
GLOBAL mixed* RESTRICT energyBuffer, GLOBAL const real4* RESTRICT posq, GLOBAL const int4* RESTRICT groupData, GLOBAL mixed* RESTRICT energyBuffer, GLOBAL const real4* RESTRICT posq, GLOBAL const int4* RESTRICT groupData,
GLOBAL const int* RESTRICT numGroupTiles, int useNeighborList, GLOBAL const int* RESTRICT numGroupTiles, int useNeighborList,
real4 periodicBoxSize, real4 invPeriodicBoxSize, real4 periodicBoxVecX, real4 periodicBoxVecY, real4 periodicBoxVecZ real4 periodicBoxSize, real4 invPeriodicBoxSize, real4 periodicBoxVecX, real4 periodicBoxVecY, real4 periodicBoxVecZ, int numDerivatives
PARAMETER_ARGUMENTS) { PARAMETER_ARGUMENTS) {
const unsigned int totalWarps = GLOBAL_SIZE/TILE_SIZE; const unsigned int totalWarps = GLOBAL_SIZE/TILE_SIZE;
const unsigned int warp = GLOBAL_ID/TILE_SIZE; // global warpIndex const unsigned int warp = GLOBAL_ID/TILE_SIZE; // global warpIndex
......
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