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
0529f325
"platforms/vscode:/vscode.git/clone" did not exist on "e5e2d9c937e6409b717967078c3eeefdbcbb6477"
Commit
0529f325
authored
Apr 02, 2013
by
Peter Eastman
Browse files
Modified some stochastic test cases to fail less often
parent
8e995a20
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
42 deletions
+51
-42
platforms/cuda/tests/TestCudaAndersenThermostat.cpp
platforms/cuda/tests/TestCudaAndersenThermostat.cpp
+10
-8
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
+7
-6
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
+10
-8
platforms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
...rms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
+7
-6
platforms/reference/tests/TestReferenceAndersenThermostat.cpp
...forms/reference/tests/TestReferenceAndersenThermostat.cpp
+10
-8
platforms/reference/tests/TestReferenceVariableLangevinIntegrator.cpp
...ference/tests/TestReferenceVariableLangevinIntegrator.cpp
+7
-6
No files found.
platforms/cuda/tests/TestCudaAndersenThermostat.cpp
View file @
0529f325
...
...
@@ -54,9 +54,9 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
3
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -70,6 +70,7 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
...
...
@@ -81,20 +82,20 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
1
0
000
;
const
int
numSteps
=
1
5
000
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
4
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -122,10 +123,11 @@ void testConstraints() {
positions
[
6
]
=
Vec3
(
0
,
1
,
1
);
positions
[
7
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
...
...
@@ -137,7 +139,7 @@ void testConstraints() {
}
ke
/=
numSteps
;
double
expected
=
0.5
*
(
numParticles
*
3
-
system
.
getNumConstraints
())
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testRandomSeed
()
{
...
...
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
View file @
0529f325
...
...
@@ -99,7 +99,7 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
1
e-
4
);
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
5
e-
5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -111,20 +111,21 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
1
000
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
000
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
5
);
}
ke
/=
1
000
;
ke
/=
5
000
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
...
...
@@ -276,13 +277,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
4
00
;
++
i
)
{
for
(
int
i
=
0
;
i
<
20
00
;
++
i
)
{
double
t
=
2.0
+
0.01
*
(
i
+
1
);
integrator
.
stepTo
(
t
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
}
ke
/=
4
00
;
ke
/=
20
00
;
double
expected
=
1.5
*
numParticles
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.01
);
}
...
...
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
View file @
0529f325
...
...
@@ -54,9 +54,9 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
3
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -70,6 +70,7 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
...
...
@@ -81,20 +82,20 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
1
0
000
;
const
int
numSteps
=
1
5
000
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
4
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -122,10 +123,11 @@ void testConstraints() {
positions
[
6
]
=
Vec3
(
0
,
1
,
1
);
positions
[
7
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
...
...
@@ -137,7 +139,7 @@ void testConstraints() {
}
ke
/=
numSteps
;
double
expected
=
0.5
*
(
numParticles
*
3
-
system
.
getNumConstraints
())
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testRandomSeed
()
{
...
...
platforms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
View file @
0529f325
...
...
@@ -99,7 +99,7 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
1
e-
4
);
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
5
e-
5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -111,20 +111,21 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
1
000
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
000
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
5
);
}
ke
/=
1
000
;
ke
/=
5
000
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
...
...
@@ -276,13 +277,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
4
00
;
++
i
)
{
for
(
int
i
=
0
;
i
<
20
00
;
++
i
)
{
double
t
=
2.0
+
0.01
*
(
i
+
1
);
integrator
.
stepTo
(
t
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
}
ke
/=
4
00
;
ke
/=
20
00
;
double
expected
=
1.5
*
numParticles
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.01
);
}
...
...
platforms/reference/tests/TestReferenceAndersenThermostat.cpp
View file @
0529f325
...
...
@@ -52,10 +52,10 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
3
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -69,6 +69,7 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
...
...
@@ -80,21 +81,21 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
1
0
000
;
const
int
numSteps
=
1
5
000
;
ReferencePlatform
platform
;
System
system
;
VerletIntegrator
integrator
(
0.00
5
);
VerletIntegrator
integrator
(
0.00
4
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -122,10 +123,11 @@ void testConstraints() {
positions
[
6
]
=
Vec3
(
0
,
1
,
1
);
positions
[
7
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
...
...
@@ -137,7 +139,7 @@ void testConstraints() {
}
ke
/=
numSteps
;
double
expected
=
0.5
*
(
numParticles
*
3
-
system
.
getNumConstraints
())
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
6
/
std
::
sqrt
((
double
)
numSteps
)
);
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
void
testRandomSeed
()
{
...
...
platforms/reference/tests/TestReferenceVariableLangevinIntegrator.cpp
View file @
0529f325
...
...
@@ -99,7 +99,7 @@ void testTemperature() {
const
double
temp
=
100.0
;
ReferencePlatform
platform
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
1
e-
4
);
VariableLangevinIntegrator
integrator
(
temp
,
5.0
,
5
e-
5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
@@ -111,20 +111,21 @@ void testTemperature() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
integrator
.
step
(
10
000
);
integrator
.
step
(
5
000
);
// Now run it for a while and see if the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
1
000
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
000
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
5
);
}
ke
/=
1
000
;
ke
/=
5
000
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.1
);
}
...
...
@@ -279,13 +280,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double
ke
=
0.0
;
for
(
int
i
=
0
;
i
<
4
00
;
++
i
)
{
for
(
int
i
=
0
;
i
<
20
00
;
++
i
)
{
double
t
=
2.0
+
0.01
*
(
i
+
1
);
integrator
.
stepTo
(
t
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
}
ke
/=
4
00
;
ke
/=
20
00
;
double
expected
=
1.5
*
numParticles
*
BOLTZ
*
temp
;
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
0.01
);
}
...
...
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