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
806232c3
Commit
806232c3
authored
Nov 18, 2008
by
Peter Eastman
Browse files
Fixed a test case that was failing, and enhanced several others
parent
c4933b5e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
8 deletions
+14
-8
platforms/cuda/tests/TestCudaBrownianIntegrator.cpp
platforms/cuda/tests/TestCudaBrownianIntegrator.cpp
+2
-1
platforms/cuda/tests/TestCudaGBSAOBCForce.cpp
platforms/cuda/tests/TestCudaGBSAOBCForce.cpp
+2
-2
platforms/cuda/tests/TestCudaLangevinIntegrator.cpp
platforms/cuda/tests/TestCudaLangevinIntegrator.cpp
+2
-1
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
+2
-1
platforms/reference/tests/TestReferenceBrownianIntegrator.cpp
...forms/reference/tests/TestReferenceBrownianIntegrator.cpp
+2
-1
platforms/reference/tests/TestReferenceLangevinIntegrator.cpp
...forms/reference/tests/TestReferenceLangevinIntegrator.cpp
+2
-1
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
+2
-1
No files found.
platforms/cuda/tests/TestCudaBrownianIntegrator.cpp
View file @
806232c3
...
@@ -131,6 +131,7 @@ void testConstraints() {
...
@@ -131,6 +131,7 @@ void testConstraints() {
CudaPlatform
platform
;
CudaPlatform
platform
;
System
system
(
numParticles
,
numConstraints
);
System
system
(
numParticles
,
numConstraints
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -161,7 +162,7 @@ void testConstraints() {
...
@@ -161,7 +162,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
5
);
}
}
integrator
.
step
(
1
);
integrator
.
step
(
1
);
}
}
...
...
platforms/cuda/tests/TestCudaGBSAOBCForce.cpp
View file @
806232c3
...
@@ -107,7 +107,7 @@ void testForce() {
...
@@ -107,7 +107,7 @@ void testForce() {
norm
+=
f
[
0
]
*
f
[
0
]
+
f
[
1
]
*
f
[
1
]
+
f
[
2
]
*
f
[
2
];
norm
+=
f
[
0
]
*
f
[
0
]
+
f
[
1
]
*
f
[
1
]
+
f
[
2
]
*
f
[
2
];
}
}
norm
=
std
::
sqrt
(
norm
);
norm
=
std
::
sqrt
(
norm
);
const
double
delta
=
1e-
3
;
const
double
delta
=
1e-
2
;
double
step
=
delta
/
norm
;
double
step
=
delta
/
norm
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
Vec3
p
=
positions
[
i
];
Vec3
p
=
positions
[
i
];
...
@@ -119,7 +119,7 @@ void testForce() {
...
@@ -119,7 +119,7 @@ void testForce() {
// See whether the potential energy changed by the expected amount.
// See whether the potential energy changed by the expected amount.
State
state2
=
context
.
getState
(
State
::
Energy
);
State
state2
=
context
.
getState
(
State
::
Energy
);
ASSERT_EQUAL_TOL
(
norm
,
(
state2
.
getPotentialEnergy
()
-
state
.
getPotentialEnergy
())
/
delta
,
0.0
1
)
ASSERT_EQUAL_TOL
(
norm
,
(
state2
.
getPotentialEnergy
()
-
state
.
getPotentialEnergy
())
/
delta
,
0.0
2
)
}
}
int
main
()
{
int
main
()
{
...
...
platforms/cuda/tests/TestCudaLangevinIntegrator.cpp
View file @
806232c3
...
@@ -136,6 +136,7 @@ void testConstraints() {
...
@@ -136,6 +136,7 @@ void testConstraints() {
CudaPlatform
platform
;
CudaPlatform
platform
;
System
system
(
numParticles
,
numConstraints
);
System
system
(
numParticles
,
numConstraints
);
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -166,7 +167,7 @@ void testConstraints() {
...
@@ -166,7 +167,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
5
);
}
}
integrator
.
step
(
1
);
integrator
.
step
(
1
);
}
}
...
...
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
View file @
806232c3
...
@@ -92,6 +92,7 @@ void testConstraints() {
...
@@ -92,6 +92,7 @@ void testConstraints() {
CudaPlatform
platform
;
CudaPlatform
platform
;
System
system
(
numParticles
,
numConstraints
);
System
system
(
numParticles
,
numConstraints
);
VerletIntegrator
integrator
(
0.001
);
VerletIntegrator
integrator
(
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -123,7 +124,7 @@ void testConstraints() {
...
@@ -123,7 +124,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p1
=
state
.
getPositions
()[
particle1
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
Vec3
p2
=
state
.
getPositions
()[
particle2
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
distance
,
dist
,
2e-
5
);
}
}
double
energy
=
state
.
getKineticEnergy
()
+
state
.
getPotentialEnergy
();
double
energy
=
state
.
getKineticEnergy
()
+
state
.
getPotentialEnergy
();
if
(
i
==
1
)
if
(
i
==
1
)
...
...
platforms/reference/tests/TestReferenceBrownianIntegrator.cpp
View file @
806232c3
...
@@ -128,6 +128,7 @@ void testConstraints() {
...
@@ -128,6 +128,7 @@ void testConstraints() {
ReferencePlatform
platform
;
ReferencePlatform
platform
;
System
system
(
numParticles
,
numParticles
-
1
);
System
system
(
numParticles
,
numParticles
-
1
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -155,7 +156,7 @@ void testConstraints() {
...
@@ -155,7 +156,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
5
);
}
}
integrator
.
step
(
1
);
integrator
.
step
(
1
);
}
}
...
...
platforms/reference/tests/TestReferenceLangevinIntegrator.cpp
View file @
806232c3
...
@@ -135,6 +135,7 @@ void testConstraints() {
...
@@ -135,6 +135,7 @@ void testConstraints() {
ReferencePlatform
platform
;
ReferencePlatform
platform
;
System
system
(
numParticles
,
numParticles
-
1
);
System
system
(
numParticles
,
numParticles
-
1
);
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -162,7 +163,7 @@ void testConstraints() {
...
@@ -162,7 +163,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
5
);
}
}
integrator
.
step
(
1
);
integrator
.
step
(
1
);
}
}
...
...
platforms/reference/tests/TestReferenceVerletIntegrator.cpp
View file @
806232c3
...
@@ -91,6 +91,7 @@ void testConstraints() {
...
@@ -91,6 +91,7 @@ void testConstraints() {
ReferencePlatform
platform
;
ReferencePlatform
platform
;
System
system
(
numParticles
,
numParticles
-
1
);
System
system
(
numParticles
,
numParticles
-
1
);
VerletIntegrator
integrator
(
0.002
);
VerletIntegrator
integrator
(
0.002
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
NonbondedForce
*
forceField
=
new
NonbondedForce
(
numParticles
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
setParticleMass
(
i
,
10.0
);
system
.
setParticleMass
(
i
,
10.0
);
...
@@ -119,7 +120,7 @@ void testConstraints() {
...
@@ -119,7 +120,7 @@ void testConstraints() {
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p1
=
state
.
getPositions
()[
j
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
Vec3
p2
=
state
.
getPositions
()[
j
+
1
];
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
double
dist
=
std
::
sqrt
((
p1
[
0
]
-
p2
[
0
])
*
(
p1
[
0
]
-
p2
[
0
])
+
(
p1
[
1
]
-
p2
[
1
])
*
(
p1
[
1
]
-
p2
[
1
])
+
(
p1
[
2
]
-
p2
[
2
])
*
(
p1
[
2
]
-
p2
[
2
]));
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
4
);
ASSERT_EQUAL_TOL
(
1.0
,
dist
,
2e-
5
);
}
}
double
energy
=
state
.
getKineticEnergy
()
+
state
.
getPotentialEnergy
();
double
energy
=
state
.
getKineticEnergy
()
+
state
.
getPotentialEnergy
();
if
(
i
==
1
)
if
(
i
==
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