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
9b2b0cad
"wrappers/python/vscode:/vscode.git/clone" did not exist on "8bcff367565b896f7468161480f4d446254a8a13"
Commit
9b2b0cad
authored
Apr 02, 2013
by
Peter Eastman
Browse files
Modified some stochastic test cases to fail less often
parent
0529f325
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
platforms/cuda/tests/TestCudaCustomIntegrator.cpp
platforms/cuda/tests/TestCudaCustomIntegrator.cpp
+5
-4
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
+5
-4
platforms/reference/tests/TestReferenceCustomIntegrator.cpp
platforms/reference/tests/TestReferenceCustomIntegrator.cpp
+5
-4
No files found.
platforms/cuda/tests/TestCudaCustomIntegrator.cpp
View file @
9b2b0cad
...
@@ -241,9 +241,9 @@ void testWithThermostat() {
...
@@ -241,9 +241,9 @@ void testWithThermostat() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
20.0
;
const
double
collisionFreq
=
20.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
System
system
;
System
system
;
CustomIntegrator
integrator
(
0.00
5
);
CustomIntegrator
integrator
(
0.00
3
);
integrator
.
addUpdateContextState
();
integrator
.
addUpdateContextState
();
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
...
@@ -260,6 +260,7 @@ void testWithThermostat() {
...
@@ -260,6 +260,7 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
// Let it equilibrate.
...
@@ -271,11 +272,11 @@ void testWithThermostat() {
...
@@ -271,11 +272,11 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
}
ke
/=
numSteps
;
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
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
);
}
}
/**
/**
...
...
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
View file @
9b2b0cad
...
@@ -241,9 +241,9 @@ void testWithThermostat() {
...
@@ -241,9 +241,9 @@ void testWithThermostat() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
System
system
;
System
system
;
CustomIntegrator
integrator
(
0.00
5
);
CustomIntegrator
integrator
(
0.00
3
);
integrator
.
addUpdateContextState
();
integrator
.
addUpdateContextState
();
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
...
@@ -260,6 +260,7 @@ void testWithThermostat() {
...
@@ -260,6 +260,7 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
// Let it equilibrate.
...
@@ -271,11 +272,11 @@ void testWithThermostat() {
...
@@ -271,11 +272,11 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
}
ke
/=
numSteps
;
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
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
);
}
}
/**
/**
...
...
platforms/reference/tests/TestReferenceCustomIntegrator.cpp
View file @
9b2b0cad
...
@@ -229,10 +229,10 @@ void testWithThermostat() {
...
@@ -229,10 +229,10 @@ void testWithThermostat() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10
000
;
const
int
numSteps
=
5
000
;
ReferencePlatform
platform
;
ReferencePlatform
platform
;
System
system
;
System
system
;
CustomIntegrator
integrator
(
0.00
5
);
CustomIntegrator
integrator
(
0.00
3
);
integrator
.
addUpdateContextState
();
integrator
.
addUpdateContextState
();
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
...
@@ -249,6 +249,7 @@ void testWithThermostat() {
...
@@ -249,6 +249,7 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
positions
[
i
]
=
Vec3
((
i
%
2
==
0
?
2
:
-
2
),
(
i
%
4
<
2
?
2
:
-
2
),
(
i
<
4
?
2
:
-
2
));
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
temp
);
// Let it equilibrate.
// Let it equilibrate.
...
@@ -260,11 +261,11 @@ void testWithThermostat() {
...
@@ -260,11 +261,11 @@ void testWithThermostat() {
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
++
i
)
{
State
state
=
context
.
getState
(
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Energy
);
ke
+=
state
.
getKineticEnergy
();
ke
+=
state
.
getKineticEnergy
();
integrator
.
step
(
1
);
integrator
.
step
(
1
0
);
}
}
ke
/=
numSteps
;
ke
/=
numSteps
;
double
expected
=
0.5
*
numParticles
*
3
*
BOLTZ
*
temp
;
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
);
}
}
/**
/**
...
...
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