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

Fixed bug in calculating plasma self energy correction with offsets (#5069)

parent d8798cb3
...@@ -317,6 +317,7 @@ void CommonCalcNonbondedForceKernel::commonInitialize(const System& system, cons ...@@ -317,6 +317,7 @@ void CommonCalcNonbondedForceKernel::commonInitialize(const System& system, cons
paramsDefines["ONE_4PI_EPS0"] = cc.doubleToString(ONE_4PI_EPS0); paramsDefines["ONE_4PI_EPS0"] = cc.doubleToString(ONE_4PI_EPS0);
paramsDefines["EPSILON0"] = cc.doubleToString(EPSILON0); paramsDefines["EPSILON0"] = cc.doubleToString(EPSILON0);
paramsDefines["WORK_GROUP_SIZE"] = cc.intToString(cc.ThreadBlockSize); paramsDefines["WORK_GROUP_SIZE"] = cc.intToString(cc.ThreadBlockSize);
paramsDefines["CHARGE_BUFFER_SIZE"] = cc.intToString(cc.getNumThreadBlocks());
hasOffsets = (force.getNumParticleParameterOffsets() > 0 || force.getNumExceptionParameterOffsets() > 0); hasOffsets = (force.getNumParticleParameterOffsets() > 0 || force.getNumExceptionParameterOffsets() > 0);
if (hasOffsets) if (hasOffsets)
paramsDefines["HAS_OFFSETS"] = "1"; paramsDefines["HAS_OFFSETS"] = "1";
......
...@@ -115,7 +115,7 @@ KERNEL void computePlasmaCorrection(GLOBAL real* RESTRICT chargeBuffer, GLOBAL m ...@@ -115,7 +115,7 @@ KERNEL void computePlasmaCorrection(GLOBAL real* RESTRICT chargeBuffer, GLOBAL m
real alpha, real volume) { real alpha, real volume) {
LOCAL real temp[WORK_GROUP_SIZE]; LOCAL real temp[WORK_GROUP_SIZE];
real sum = 0; real sum = 0;
for (unsigned int index = LOCAL_ID; index < NUM_GROUPS; index += LOCAL_SIZE) for (unsigned int index = LOCAL_ID; index < CHARGE_BUFFER_SIZE; index += LOCAL_SIZE)
sum += chargeBuffer[index]; sum += chargeBuffer[index];
temp[LOCAL_ID] = sum; temp[LOCAL_ID] = sum;
for (int i = 1; i < WORK_GROUP_SIZE; i *= 2) { for (int i = 1; i < WORK_GROUP_SIZE; i *= 2) {
......
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