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
f322abd1
Commit
f322abd1
authored
Mar 19, 2015
by
peastman
Browse files
Merge pull request #858 from peastman/reference
Simplification to reference platform tests
parents
476c1bab
f66c9b61
Changes
34
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
28 additions
and
52 deletions
+28
-52
platforms/reference/tests/TestReferenceLangevinIntegrator.cpp
...forms/reference/tests/TestReferenceLangevinIntegrator.cpp
+2
-5
platforms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
...rms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
+2
-3
platforms/reference/tests/TestReferenceMonteCarloAnisotropicBarostat.cpp
...ence/tests/TestReferenceMonteCarloAnisotropicBarostat.cpp
+2
-5
platforms/reference/tests/TestReferenceMonteCarloBarostat.cpp
...forms/reference/tests/TestReferenceMonteCarloBarostat.cpp
+2
-3
platforms/reference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
...ference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
+2
-2
platforms/reference/tests/TestReferenceNonbondedForce.cpp
platforms/reference/tests/TestReferenceNonbondedForce.cpp
+2
-9
platforms/reference/tests/TestReferencePeriodicTorsionForce.cpp
...rms/reference/tests/TestReferencePeriodicTorsionForce.cpp
+2
-1
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
+2
-1
platforms/reference/tests/TestReferenceRandom.cpp
platforms/reference/tests/TestReferenceRandom.cpp
+2
-1
platforms/reference/tests/TestReferenceSettle.cpp
platforms/reference/tests/TestReferenceSettle.cpp
+2
-1
platforms/reference/tests/TestReferenceVariableLangevinIntegrator.cpp
...ference/tests/TestReferenceVariableLangevinIntegrator.cpp
+2
-6
platforms/reference/tests/TestReferenceVariableVerletIntegrator.cpp
...reference/tests/TestReferenceVariableVerletIntegrator.cpp
+2
-5
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
+2
-4
platforms/reference/tests/TestReferenceVirtualSites.cpp
platforms/reference/tests/TestReferenceVirtualSites.cpp
+2
-6
No files found.
platforms/reference/tests/TestReferenceLangevinIntegrator.cpp
View file @
f322abd1
...
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
...
@@ -97,7 +98,6 @@ void testSingleBond() {
void
testTemperature
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
...
@@ -132,7 +132,6 @@ void testTemperature() {
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -172,7 +171,6 @@ void testConstraints() {
}
void
testConstrainedMasslessParticles
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -207,7 +205,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
ReferencePlatform
platform
;
System
system
;
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
...
platforms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
View file @
f322abd1
...
...
@@ -45,6 +45,8 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testHarmonicBonds
()
{
const
int
numParticles
=
10
;
System
system
;
...
...
@@ -64,7 +66,6 @@ void testHarmonicBonds() {
// Minimize it and check that all bonds are at their equilibrium distances.
VerletIntegrator
integrator
(
0.01
);
ReferencePlatform
platform
;
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
LocalEnergyMinimizer
::
minimize
(
context
,
1e-5
);
...
...
@@ -105,7 +106,6 @@ void testLargeSystem() {
// Minimize it and verify that the energy has decreased.
ReferencePlatform
platform
;
VerletIntegrator
integrator
(
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
@@ -167,7 +167,6 @@ void testVirtualSites() {
// Minimize it and verify that the energy has decreased.
ReferencePlatform
platform
;
VerletIntegrator
integrator
(
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
platforms/reference/tests/TestReferenceMonteCarloAnisotropicBarostat.cpp
View file @
f322abd1
...
...
@@ -51,6 +51,8 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testIdealGas
()
{
const
int
numParticles
=
64
;
const
int
frequency
=
10
;
...
...
@@ -63,7 +65,6 @@ void testIdealGas() {
// Create a gas of noninteracting particles.
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
vector
<
Vec3
>
positions
(
numParticles
);
...
...
@@ -124,7 +125,6 @@ void testIdealGasAxis(int axis) {
// Create a gas of noninteracting particles.
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
vector
<
Vec3
>
positions
(
numParticles
);
...
...
@@ -182,7 +182,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
pressure
=
1.5
;
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
8
,
0
,
0
),
Vec3
(
0
,
8
,
0
),
Vec3
(
0
,
0
,
8
));
VerletIntegrator
integrator
(
0.01
);
...
...
@@ -255,7 +254,6 @@ void testTriclinic() {
// Create a gas of noninteracting particles.
ReferencePlatform
platform
;
System
system
;
Vec3
initialBox
[
3
];
initialBox
[
0
]
=
Vec3
(
initialLength
,
0
,
0
);
...
...
@@ -347,7 +345,6 @@ void testEinsteinCrystal() {
const
double
pres3
[]
=
{
2.0
,
8.0
,
15.0
};
const
double
initialVolume
=
numParticles
*
BOLTZ
*
temp
/
pressureInMD
;
const
double
initialLength
=
std
::
pow
(
initialVolume
,
1.0
/
3.0
);
ReferencePlatform
platform
;
vector
<
double
>
initialPositions
(
3
);
vector
<
double
>
results
;
// Run four groups of anisotropic simulations; scaling just x, y, z, then all three.
...
...
platforms/reference/tests/TestReferenceMonteCarloBarostat.cpp
View file @
f322abd1
...
...
@@ -49,8 +49,9 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testChangingBoxSize
()
{
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
5
,
0
),
Vec3
(
0
,
0
,
6
));
system
.
addParticle
(
1.0
);
...
...
@@ -100,7 +101,6 @@ void testIdealGas() {
// Create a gas of noninteracting particles.
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
vector
<
Vec3
>
positions
(
numParticles
);
...
...
@@ -148,7 +148,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
pressure
=
1.5
;
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
8
,
0
,
0
),
Vec3
(
0
,
8
,
0
),
Vec3
(
0
,
0
,
8
));
VerletIntegrator
integrator
(
0.01
);
...
...
platforms/reference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
View file @
f322abd1
...
...
@@ -49,6 +49,8 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testIdealGas
(
MonteCarloMembraneBarostat
::
XYMode
xymode
,
MonteCarloMembraneBarostat
::
ZMode
zmode
)
{
const
int
numParticles
=
64
;
const
int
frequency
=
1
;
...
...
@@ -63,7 +65,6 @@ void testIdealGas(MonteCarloMembraneBarostat::XYMode xymode, MonteCarloMembraneB
// Create a gas of noninteracting particles.
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
vector
<
Vec3
>
positions
(
numParticles
);
...
...
@@ -121,7 +122,6 @@ void testRandomSeed() {
const
double
temp
=
100.0
;
const
double
pressure
=
1.5
;
const
double
tension
=
0.3
;
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
8
,
0
,
0
),
Vec3
(
0
,
8
,
0
),
Vec3
(
0
,
0
,
8
));
VerletIntegrator
integrator
(
0.01
);
...
...
platforms/reference/tests/TestReferenceNonbondedForce.cpp
View file @
f322abd1
...
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testCoulomb
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -76,7 +77,6 @@ void testCoulomb() {
}
void
testLJ
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -103,7 +103,6 @@ void testLJ() {
}
void
testExclusionsAnd14
()
{
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
...
@@ -190,7 +189,6 @@ void testExclusionsAnd14() {
}
void
testCutoff
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -229,7 +227,6 @@ void testCutoff() {
}
void
testCutoff14
()
{
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
...
@@ -326,7 +323,6 @@ void testCutoff14() {
}
void
testPeriodic
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -363,7 +359,6 @@ void testPeriodic() {
}
void
testTriclinic
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -432,7 +427,6 @@ void testDispersionCorrection() {
int
numParticles
=
gridSize
*
gridSize
*
gridSize
;
double
boxSize
=
gridSize
*
0.7
;
double
cutoff
=
boxSize
/
3
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
...
@@ -496,7 +490,6 @@ void testDispersionCorrection() {
}
void
testSwitchingFunction
(
NonbondedForce
::
NonbondedMethod
method
)
{
ReferencePlatform
platform
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
6
,
0
,
0
),
Vec3
(
0
,
6
,
0
),
Vec3
(
0
,
0
,
6
));
system
.
addParticle
(
1.0
);
...
...
platforms/reference/tests/TestReferencePeriodicTorsionForce.cpp
View file @
f322abd1
...
...
@@ -46,10 +46,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testPeriodicTorsions
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
platforms/reference/tests/TestReferenceRBTorsionForce.cpp
View file @
f322abd1
...
...
@@ -46,10 +46,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testRBTorsions
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
platforms/reference/tests/TestReferenceRandom.cpp
View file @
f322abd1
...
...
@@ -43,6 +43,8 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testGaussian
()
{
const
int
numValues
=
10000000
;
double
mean
=
0.0
;
...
...
@@ -74,7 +76,6 @@ void testRandomVelocities() {
const
int
numParticles
=
10000
;
const
double
temperture
=
100.0
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
...
...
platforms/reference/tests/TestReferenceSettle.cpp
View file @
f322abd1
...
...
@@ -47,12 +47,13 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
void
testConstraints
()
{
const
int
numMolecules
=
10
;
const
int
numParticles
=
numMolecules
*
3
;
const
int
numConstraints
=
numMolecules
*
3
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
platforms/reference/tests/TestReferenceVariableLangevinIntegrator.cpp
View file @
f322abd1
...
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
...
@@ -97,7 +98,6 @@ void testSingleBond() {
void
testTemperature
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
5e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
...
@@ -133,7 +133,6 @@ void testTemperature() {
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -174,7 +173,6 @@ void testConstraints() {
}
void
testConstrainedMasslessParticles
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -208,7 +206,6 @@ void testConstrainedMasslessParticles() {
void
testRandomSeed
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
...
@@ -276,7 +273,6 @@ void testArgonBox() {
// Create a box of argon atoms.
ReferencePlatform
platform
;
System
system
;
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
vector
<
Vec3
>
positions
;
...
...
platforms/reference/tests/TestReferenceVariableVerletIntegrator.cpp
View file @
f322abd1
...
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
...
@@ -89,7 +90,6 @@ void testSingleBond() {
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
500.0
;
ReferencePlatform
platform
;
System
system
;
VariableVerletIntegrator
integrator
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -148,7 +148,6 @@ void testConstraints() {
void
testConstrainedClusters
()
{
const
int
numParticles
=
7
;
const
double
temp
=
500.0
;
ReferencePlatform
platform
;
System
system
;
VariableVerletIntegrator
integrator
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -211,7 +210,6 @@ void testConstrainedClusters() {
}
void
testConstrainedMasslessParticles
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -255,7 +253,6 @@ void testArgonBox() {
// Create a box of argon atoms.
ReferencePlatform
platform
;
System
system
;
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
vector
<
Vec3
>
positions
;
...
...
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
View file @
f322abd1
...
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
...
@@ -88,7 +89,6 @@ void testSingleBond() {
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
500.0
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.002
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -139,7 +139,6 @@ void testConstraints() {
void
testConstrainedClusters
()
{
const
int
numParticles
=
7
;
const
double
temp
=
500.0
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
...
@@ -201,7 +200,6 @@ void testConstrainedClusters() {
}
void
testConstrainedMasslessParticles
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
...
...
platforms/reference/tests/TestReferenceVirtualSites.cpp
View file @
f322abd1
...
...
@@ -50,11 +50,12 @@
using
namespace
OpenMM
;
using
namespace
std
;
ReferencePlatform
platform
;
/**
* Check that massless particles are handled correctly.
*/
void
testMasslessParticle
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -91,7 +92,6 @@ void testMasslessParticle() {
* Test a TwoParticleAverageSite virtual site.
*/
void
testTwoParticleAverage
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -128,7 +128,6 @@ void testTwoParticleAverage() {
* Test a ThreeParticleAverageSite virtual site.
*/
void
testThreeParticleAverage
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -170,7 +169,6 @@ void testThreeParticleAverage() {
* Test an OutOfPlaneSite virtual site.
*/
void
testOutOfPlane
()
{
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -223,7 +221,6 @@ void testLocalCoordinates() {
const
Vec3
xWeights
(
-
1.0
,
0.5
,
0.5
);
const
Vec3
yWeights
(
0.0
,
-
1.0
,
1.0
);
const
Vec3
localPosition
(
0.4
,
0.3
,
0.2
);
ReferencePlatform
platform
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
...
@@ -299,7 +296,6 @@ void testLocalCoordinates() {
* when using virtual sites.
*/
void
testConservationLaws
()
{
ReferencePlatform
platform
;
System
system
;
NonbondedForce
*
forceField
=
new
NonbondedForce
();
system
.
addForce
(
forceField
);
...
...
Prev
1
2
Next
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