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
31d0d857
Commit
31d0d857
authored
Dec 30, 2014
by
Jason Swails
Browse files
Add tests for the new usesPeriodicBoundaryConditions API function to the
Reference platform.
parent
930fb6d6
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
85 additions
and
0 deletions
+85
-0
platforms/reference/tests/TestReferenceCMAPTorsionForce.cpp
platforms/reference/tests/TestReferenceCMAPTorsionForce.cpp
+4
-0
platforms/reference/tests/TestReferenceCustomAngleForce.cpp
platforms/reference/tests/TestReferenceCustomAngleForce.cpp
+2
-0
platforms/reference/tests/TestReferenceCustomBondForce.cpp
platforms/reference/tests/TestReferenceCustomBondForce.cpp
+2
-0
platforms/reference/tests/TestReferenceCustomCompoundBondForce.cpp
.../reference/tests/TestReferenceCustomCompoundBondForce.cpp
+2
-0
platforms/reference/tests/TestReferenceCustomExternalForce.cpp
...orms/reference/tests/TestReferenceCustomExternalForce.cpp
+2
-0
platforms/reference/tests/TestReferenceCustomGBForce.cpp
platforms/reference/tests/TestReferenceCustomGBForce.cpp
+11
-0
platforms/reference/tests/TestReferenceCustomHbondForce.cpp
platforms/reference/tests/TestReferenceCustomHbondForce.cpp
+2
-0
platforms/reference/tests/TestReferenceCustomManyParticleForce.cpp
.../reference/tests/TestReferenceCustomManyParticleForce.cpp
+7
-0
platforms/reference/tests/TestReferenceCustomNonbondedForce.cpp
...rms/reference/tests/TestReferenceCustomNonbondedForce.cpp
+6
-0
platforms/reference/tests/TestReferenceCustomTorsionForce.cpp
...forms/reference/tests/TestReferenceCustomTorsionForce.cpp
+2
-0
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
+16
-0
platforms/reference/tests/TestReferenceGBVIForce.cpp
platforms/reference/tests/TestReferenceGBVIForce.cpp
+2
-0
platforms/reference/tests/TestReferenceHarmonicAngleForce.cpp
...forms/reference/tests/TestReferenceHarmonicAngleForce.cpp
+2
-0
platforms/reference/tests/TestReferenceHarmonicBondForce.cpp
platforms/reference/tests/TestReferenceHarmonicBondForce.cpp
+2
-0
platforms/reference/tests/TestReferenceNonbondedForce.cpp
platforms/reference/tests/TestReferenceNonbondedForce.cpp
+19
-0
platforms/reference/tests/TestReferencePeriodicTorsionForce.cpp
...rms/reference/tests/TestReferencePeriodicTorsionForce.cpp
+2
-0
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
+2
-0
No files found.
platforms/reference/tests/TestReferenceCMAPTorsionForce.cpp
View file @
31d0d857
...
...
@@ -64,6 +64,8 @@ void testCMAPTorsions() {
periodic
->
addTorsion
(
0
,
1
,
2
,
3
,
2
,
M_PI
/
4
,
1.5
);
periodic
->
addTorsion
(
1
,
2
,
3
,
4
,
3
,
M_PI
/
3
,
2.0
);
system1
.
addForce
(
periodic
);
ASSERT
(
!
periodic
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system1
.
usesPeriodicBoundaryConditions
());
System
system2
;
for
(
int
i
=
0
;
i
<
5
;
i
++
)
system2
.
addParticle
(
1.0
);
...
...
@@ -81,6 +83,8 @@ void testCMAPTorsions() {
cmap
->
addMap
(
mapSize
,
mapEnergy
);
cmap
->
addTorsion
(
0
,
0
,
1
,
2
,
3
,
1
,
2
,
3
,
4
);
system2
.
addForce
(
cmap
);
ASSERT
(
!
cmap
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system2
.
usesPeriodicBoundaryConditions
());
// Set the atoms in various positions, and verify that both systems give equal forces and energy.
...
...
platforms/reference/tests/TestReferenceCustomAngleForce.cpp
View file @
31d0d857
...
...
@@ -71,6 +71,8 @@ void testAngles() {
parameters
[
1
]
=
0.5
;
custom
->
addAngle
(
1
,
2
,
3
,
parameters
);
customSystem
.
addForce
(
custom
);
ASSERT
(
!
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
// Create an identical system using a HarmonicAngleForce.
...
...
platforms/reference/tests/TestReferenceCustomBondForce.cpp
View file @
31d0d857
...
...
@@ -67,6 +67,8 @@ void testBonds() {
parameters
[
1
]
=
0.7
;
forceField
->
addBond
(
1
,
2
,
parameters
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
2
,
0
);
...
...
platforms/reference/tests/TestReferenceCustomCompoundBondForce.cpp
View file @
31d0d857
...
...
@@ -85,6 +85,8 @@ void testBond() {
parameters
[
5
]
=
1.3
;
custom
->
addBond
(
particles
,
parameters
);
customSystem
.
addForce
(
custom
);
ASSERT
(
!
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
// Create an identical system using standard forces.
...
...
platforms/reference/tests/TestReferenceCustomExternalForce.cpp
View file @
31d0d857
...
...
@@ -67,6 +67,8 @@ void testForce() {
parameters
[
1
]
=
3.0
;
forceField
->
addParticle
(
2
,
parameters
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
2
,
0
);
...
...
platforms/reference/tests/TestReferenceCustomGBForce.cpp
View file @
31d0d857
...
...
@@ -135,6 +135,17 @@ void testOBC(GBSAOBCForce::NonbondedMethod obcMethod, CustomGBForce::NonbondedMe
custom
->
setNonbondedMethod
(
customMethod
);
standardSystem
.
addForce
(
obc
);
customSystem
.
addForce
(
custom
);
if
(
customMethod
==
CustomGBForce
::
CutoffPeriodic
)
{
ASSERT
(
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
obc
->
usesPeriodicBoundaryConditions
());
ASSERT
(
standardSystem
.
usesPeriodicBoundaryConditions
());
ASSERT
(
customSystem
.
usesPeriodicBoundaryConditions
());
}
else
{
ASSERT
(
!
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
obc
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
standardSystem
.
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
}
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
Context
context1
(
standardSystem
,
integrator1
,
platform
);
...
...
platforms/reference/tests/TestReferenceCustomHbondForce.cpp
View file @
31d0d857
...
...
@@ -83,6 +83,8 @@ void testHbond() {
custom
->
addAcceptor
(
2
,
3
,
4
,
parameters
);
custom
->
setCutoffDistance
(
10.0
);
customSystem
.
addForce
(
custom
);
ASSERT
(
!
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
// Create an identical system using HarmonicBondForce, HarmonicAngleForce, and PeriodicTorsionForce.
...
...
platforms/reference/tests/TestReferenceCustomManyParticleForce.cpp
View file @
31d0d857
...
...
@@ -63,6 +63,13 @@ void validateAxilrodTeller(CustomManyParticleForce* force, const vector<Vec3>& p
system
.
addParticle
(
1.0
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
addForce
(
force
);
if
(
force
->
getNonbondedMethod
()
==
CustomManyParticleForce
::
CutoffPeriodic
)
{
ASSERT
(
force
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
}
else
{
ASSERT
(
!
force
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
}
VerletIntegrator
integrator
(
0.001
);
ReferencePlatform
platform
;
Context
context
(
system
,
integrator
,
platform
);
...
...
platforms/reference/tests/TestReferenceCustomNonbondedForce.cpp
View file @
31d0d857
...
...
@@ -184,6 +184,8 @@ void testCutoff() {
forceField
->
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffNonPeriodic
);
forceField
->
setCutoffDistance
(
2.5
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -213,6 +215,8 @@ void testPeriodic() {
forceField
->
setCutoffDistance
(
2.0
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
addForce
(
forceField
);
ASSERT
(
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -531,6 +535,8 @@ void testCoulombLennardJones() {
customNonbonded
->
setNonbondedMethod
(
CustomNonbondedForce
::
NoCutoff
);
standardSystem
.
addForce
(
standardNonbonded
);
customSystem
.
addForce
(
customNonbonded
);
ASSERT
(
!
customNonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
Context
context1
(
standardSystem
,
integrator1
,
platform
);
...
...
platforms/reference/tests/TestReferenceCustomTorsionForce.cpp
View file @
31d0d857
...
...
@@ -75,6 +75,8 @@ void testTorsions() {
parameters
[
1
]
=
2
;
custom
->
addTorsion
(
1
,
2
,
3
,
4
,
parameters
);
customSystem
.
addForce
(
custom
);
ASSERT
(
!
custom
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
customSystem
.
usesPeriodicBoundaryConditions
());
// Create an identical system using a PeriodicTorsionForce.
...
...
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
View file @
31d0d857
...
...
@@ -58,6 +58,8 @@ void testSingleParticle() {
GBSAOBCForce
*
forceField
=
new
GBSAOBCForce
();
forceField
->
addParticle
(
0.5
,
0.15
,
1
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
1
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -96,6 +98,8 @@ void testGlobalSettings() {
forceField
->
setSolventDielectric
(
solventDielectric
);
forceField
->
setSurfaceAreaEnergy
(
surfaceAreaEnergy
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
1
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -136,22 +140,34 @@ void testCutoffAndPeriodic() {
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffNonPeriodic
);
gbsa
->
setNonbondedMethod
(
GBSAOBCForce
::
CutoffNonPeriodic
);
ASSERT
(
!
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
gbsa
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
State
state1
=
context
.
getState
(
State
::
Forces
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
gbsa
->
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
ASSERT
(
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
gbsa
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
context
.
reinitialize
();
context
.
setPositions
(
positions
);
State
state2
=
context
.
getState
(
State
::
Forces
);
positions
[
1
][
0
]
+=
boxSize
;
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffNonPeriodic
);
gbsa
->
setNonbondedMethod
(
GBSAOBCForce
::
CutoffNonPeriodic
);
ASSERT
(
!
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
gbsa
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
context
.
reinitialize
();
context
.
setPositions
(
positions
);
State
state3
=
context
.
getState
(
State
::
Forces
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
gbsa
->
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
ASSERT
(
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
gbsa
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
context
.
reinitialize
();
context
.
setPositions
(
positions
);
State
state4
=
context
.
getState
(
State
::
Forces
);
...
...
platforms/reference/tests/TestReferenceGBVIForce.cpp
View file @
31d0d857
...
...
@@ -66,6 +66,8 @@ void testSingleParticle() {
double
gamma
=
1.0
;
forceField
->
addParticle
(
charge
,
radius
,
gamma
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
1
);
...
...
platforms/reference/tests/TestReferenceHarmonicAngleForce.cpp
View file @
31d0d857
...
...
@@ -60,6 +60,8 @@ void testAngles() {
forceField
->
addAngle
(
0
,
1
,
2
,
PI_M
/
3
,
1.1
);
forceField
->
addAngle
(
1
,
2
,
3
,
PI_M
/
2
,
1.2
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
4
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
...
...
platforms/reference/tests/TestReferenceHarmonicBondForce.cpp
View file @
31d0d857
...
...
@@ -59,6 +59,8 @@ void testBonds() {
forceField
->
addBond
(
0
,
1
,
1.5
,
0.8
);
forceField
->
addBond
(
1
,
2
,
1.2
,
0.7
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
2
,
0
);
...
...
platforms/reference/tests/TestReferenceNonbondedForce.cpp
View file @
31d0d857
...
...
@@ -59,6 +59,8 @@ void testCoulomb() {
forceField
->
addParticle
(
0.5
,
1
,
0
);
forceField
->
addParticle
(
-
1.5
,
1
,
0
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -82,6 +84,8 @@ void testLJ() {
forceField
->
addParticle
(
0
,
1.2
,
1
);
forceField
->
addParticle
(
0
,
1.4
,
2
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -201,6 +205,8 @@ void testCutoff() {
const
double
eps
=
50.0
;
forceField
->
setReactionFieldDielectric
(
eps
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -252,6 +258,8 @@ void testCutoff14() {
second14
=
i
;
}
system
.
addForce
(
nonbonded
);
ASSERT
(
!
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
5
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -333,6 +341,8 @@ void testPeriodic() {
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
addForce
(
nonbonded
);
ASSERT
(
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
@@ -376,6 +386,8 @@ void testDispersionCorrection() {
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
addForce
(
nonbonded
);
ASSERT
(
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
// See if the correction has the correct value.
...
...
@@ -435,6 +447,13 @@ void testSwitchingFunction(NonbondedForce::NonbondedMethod method) {
nonbonded
->
setSwitchingDistance
(
1.5
);
nonbonded
->
setUseDispersionCorrection
(
false
);
system
.
addForce
(
nonbonded
);
if
(
method
==
NonbondedForce
::
PME
)
{
ASSERT
(
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
system
.
usesPeriodicBoundaryConditions
());
}
else
{
ASSERT
(
!
nonbonded
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
}
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
...
...
platforms/reference/tests/TestReferencePeriodicTorsionForce.cpp
View file @
31d0d857
...
...
@@ -59,6 +59,8 @@ void testPeriodicTorsions() {
PeriodicTorsionForce
*
forceField
=
new
PeriodicTorsionForce
();
forceField
->
addTorsion
(
0
,
1
,
2
,
3
,
2
,
PI_M
/
3
,
1.1
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
4
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
...
...
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
View file @
31d0d857
...
...
@@ -59,6 +59,8 @@ void testRBTorsions() {
RBTorsionForce
*
forceField
=
new
RBTorsionForce
();
forceField
->
addTorsion
(
0
,
1
,
2
,
3
,
0.1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
);
system
.
addForce
(
forceField
);
ASSERT
(
!
forceField
->
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
4
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
...
...
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