Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
84a14401
Commit
84a14401
authored
Aug 22, 2011
by
Peter Eastman
Browse files
Fixed another case where the exclusions for CustomGBForce could be handled incorrectly
parent
5f4ed12e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
14 deletions
+27
-14
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+2
-0
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
+19
-14
platforms/opencl/src/OpenCLNonbondedUtilities.h
platforms/opencl/src/OpenCLNonbondedUtilities.h
+6
-0
No files found.
platforms/opencl/src/OpenCLKernels.cpp
View file @
84a14401
...
@@ -2074,6 +2074,8 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
...
@@ -2074,6 +2074,8 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
file
=
OpenCLKernelSources
::
customGBValueN2_default
;
file
=
OpenCLKernelSources
::
customGBValueN2_default
;
cl
::
Program
program
=
cl
.
createProgram
(
cl
.
replaceStrings
(
file
,
replacements
),
defines
);
cl
::
Program
program
=
cl
.
createProgram
(
cl
.
replaceStrings
(
file
,
replacements
),
defines
);
pairValueKernel
=
cl
::
Kernel
(
program
,
"computeN2Value"
);
pairValueKernel
=
cl
::
Kernel
(
program
,
"computeN2Value"
);
if
(
useExclusionsForValue
)
cl
.
getNonbondedUtilities
().
requestExclusions
(
exclusionList
);
}
}
{
{
// Create the kernel to reduce the N2 value and calculate other values.
// Create the kernel to reduce the N2 value and calculate other values.
...
...
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
View file @
84a14401
...
@@ -93,7 +93,24 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
...
@@ -93,7 +93,24 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
if
(
cutoffDistance
!=
cutoff
)
if
(
cutoffDistance
!=
cutoff
)
throw
OpenMMException
(
"All Forces must use the same cutoff distance"
);
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
());
bool
sameExclusions
=
(
exclusionList
.
size
()
==
atomExclusions
.
size
());
for
(
int
i
=
0
;
i
<
(
int
)
exclusionList
.
size
()
&&
sameExclusions
;
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
exclusionList
.
size
()
&&
sameExclusions
;
i
++
)
{
if
(
exclusionList
[
i
].
size
()
!=
atomExclusions
[
i
].
size
())
if
(
exclusionList
[
i
].
size
()
!=
atomExclusions
[
i
].
size
())
...
@@ -105,24 +122,12 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
...
@@ -105,24 +122,12 @@ void OpenCLNonbondedUtilities::addInteraction(bool usesCutoff, bool usesPeriodic
if
(
!
sameExclusions
)
if
(
!
sameExclusions
)
throw
OpenMMException
(
"All Forces must have identical exceptions"
);
throw
OpenMMException
(
"All Forces must have identical exceptions"
);
}
}
useCutoff
=
usesCutoff
;
else
{
usePeriodic
=
usesPeriodic
;
cutoff
=
cutoffDistance
;
kernelSource
+=
kernel
+
"
\n
"
;
if
(
usesExclusions
&&
!
anyExclusions
)
{
atomExclusions
=
exclusionList
;
atomExclusions
=
exclusionList
;
anyExclusions
=
true
;
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
)
{
void
OpenCLNonbondedUtilities
::
initialize
(
const
System
&
system
)
{
if
(
cutoff
==
-
1.0
)
if
(
cutoff
==
-
1.0
)
return
;
// There are no nonbonded interactions in the System.
return
;
// There are no nonbonded interactions in the System.
...
...
platforms/opencl/src/OpenCLNonbondedUtilities.h
View file @
84a14401
...
@@ -84,6 +84,12 @@ public:
...
@@ -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.
* 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
);
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.
* Initialize this object in preparation for a simulation.
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment