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
8a9a5026
Commit
8a9a5026
authored
Aug 15, 2016
by
peastman
Browse files
Empty interaction group should produce no interactions
parent
27550631
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
platforms/cpu/include/CpuCustomNonbondedForce.h
platforms/cpu/include/CpuCustomNonbondedForce.h
+1
-0
platforms/cpu/src/CpuCustomNonbondedForce.cpp
platforms/cpu/src/CpuCustomNonbondedForce.cpp
+3
-2
tests/TestCustomNonbondedForce.h
tests/TestCustomNonbondedForce.h
+10
-0
No files found.
platforms/cpu/include/CpuCustomNonbondedForce.h
View file @
8a9a5026
...
...
@@ -129,6 +129,7 @@ private:
bool
useSwitch
;
bool
periodic
;
bool
triclinic
;
bool
useInteractionGroups
;
const
CpuNeighborList
*
neighborList
;
float
recipBoxSize
[
3
];
RealVec
periodicBoxVectors
[
3
];
...
...
platforms/cpu/src/CpuCustomNonbondedForce.cpp
View file @
8a9a5026
...
...
@@ -70,7 +70,7 @@ CpuCustomNonbondedForce::ThreadData::ThreadData(const Lepton::CompiledExpression
CpuCustomNonbondedForce
::
CpuCustomNonbondedForce
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
const
vector
<
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
Lepton
::
CompiledExpression
>
energyParamDerivExpressions
,
ThreadPool
&
threads
)
:
cutoff
(
false
),
useSwitch
(
false
),
periodic
(
false
),
paramNames
(
parameterNames
),
exclusions
(
exclusions
),
threads
(
threads
)
{
cutoff
(
false
),
useSwitch
(
false
),
periodic
(
false
),
useInteractionGroups
(
false
),
paramNames
(
parameterNames
),
exclusions
(
exclusions
),
threads
(
threads
)
{
for
(
int
i
=
0
;
i
<
threads
.
getNumThreads
();
i
++
)
threadData
.
push_back
(
new
ThreadData
(
energyExpression
,
forceExpression
,
parameterNames
,
energyParamDerivExpressions
));
}
...
...
@@ -87,6 +87,7 @@ void CpuCustomNonbondedForce::setUseCutoff(RealOpenMM distance, const CpuNeighbo
}
void
CpuCustomNonbondedForce
::
setInteractionGroups
(
const
vector
<
pair
<
set
<
int
>
,
set
<
int
>
>
>&
groups
)
{
useInteractionGroups
=
true
;
for
(
int
group
=
0
;
group
<
(
int
)
groups
.
size
();
group
++
)
{
const
set
<
int
>&
set1
=
groups
[
group
].
first
;
const
set
<
int
>&
set2
=
groups
[
group
].
second
;
...
...
@@ -183,7 +184,7 @@ void CpuCustomNonbondedForce::threadComputeForce(ThreadPool& threads, int thread
data
.
energyParamDerivs
[
i
]
=
0.0
;
fvec4
boxSize
(
periodicBoxVectors
[
0
][
0
],
periodicBoxVectors
[
1
][
1
],
periodicBoxVectors
[
2
][
2
],
0
);
fvec4
invBoxSize
(
recipBoxSize
[
0
],
recipBoxSize
[
1
],
recipBoxSize
[
2
],
0
);
if
(
group
Interaction
s
.
size
()
>
0
)
{
if
(
use
Interaction
Groups
)
{
// The user has specified interaction groups, so compute only the requested interactions.
while
(
true
)
{
...
...
tests/TestCustomNonbondedForce.h
View file @
8a9a5026
...
...
@@ -878,6 +878,16 @@ void testLargeInteractionGroup() {
State
state3
=
context
.
getState
(
State
::
Forces
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state3
.
getForces
()[
i
],
1e-4
);
// Now make the interaction group empty. The energy should then be zero.
set1
.
clear
();
set2
.
clear
();
nonbonded
->
setInteractionGroupParameters
(
0
,
set1
,
set2
);
context
.
reinitialize
();
context
.
setPositions
(
positions
);
State
state4
=
context
.
getState
(
State
::
Energy
);
ASSERT_EQUAL
(
0.0
,
state4
.
getPotentialEnergy
());
}
void
testInteractionGroupLongRangeCorrection
()
{
...
...
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