"vscode:/vscode.git/clone" did not exist on "55081e216abf4bfccaa7764c999bac1a33c88bd1"
Commit 84a14401 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed another case where the exclusions for CustomGBForce could be handled incorrectly

parent 5f4ed12e
......@@ -2074,6 +2074,8 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
file = OpenCLKernelSources::customGBValueN2_default;
cl::Program program = cl.createProgram(cl.replaceStrings(file, replacements), defines);
pairValueKernel = cl::Kernel(program, "computeN2Value");
if (useExclusionsForValue)
cl.getNonbondedUtilities().requestExclusions(exclusionList);
}
{
// Create the kernel to reduce the N2 value and calculate other values.
......
......@@ -93,7 +93,24 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
if (cutoffDistance != cutoff)
throw OpenMMException("All Forces must use the same cutoff distance");
}
if (usesExclusions && anyExclusions) {
if (usesExclusions)
requestExclusions(exclusionList);
useCutoff = usesCutoff;
usePeriodic = usesPeriodic;
cutoff = cutoffDistance;
kernelSource += kernel+"\n";
}
void OpenCLNonbondedUtilities::addParameter(const ParameterInfo& parameter) {
parameters.push_back(parameter);
}
void OpenCLNonbondedUtilities::addArgument(const ParameterInfo& parameter) {
arguments.push_back(parameter);
}
void OpenCLNonbondedUtilities::requestExclusions(const vector<vector<int> >& exclusionList) {
if (anyExclusions) {
bool sameExclusions = (exclusionList.size() == atomExclusions.size());
for (int i = 0; i < (int) exclusionList.size() && sameExclusions; i++) {
if (exclusionList[i].size() != atomExclusions[i].size())
......@@ -105,24 +122,12 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
if (!sameExclusions)
throw OpenMMException("All Forces must have identical exceptions");
}
useCutoff = usesCutoff;
usePeriodic = usesPeriodic;
cutoff = cutoffDistance;
kernelSource += kernel+"\n";
if (usesExclusions && !anyExclusions) {
else {
atomExclusions = exclusionList;
anyExclusions = true;
}
}
void OpenCLNonbondedUtilities::addParameter(const ParameterInfo& parameter) {
parameters.push_back(parameter);
}
void OpenCLNonbondedUtilities::addArgument(const ParameterInfo& parameter) {
arguments.push_back(parameter);
}
void OpenCLNonbondedUtilities::initialize(const System& system) {
if (cutoff == -1.0)
return; // There are no nonbonded interactions in the System.
......
......@@ -84,6 +84,12 @@ public:
* Add an array (other than a per-atom parameter) that should be passed as an argument to the default interaction kernel.
*/
void addArgument(const ParameterInfo& parameter);
/**
* Specify the list of exclusions that an interaction outside the default kernel will depend on.
*
* @param exclusionList for each atom, specifies the list of other atoms whose interactions should be excluded
*/
void requestExclusions(const std::vector<std::vector<int> >& exclusionList);
/**
* Initialize this object in preparation for a simulation.
*/
......
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