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
f18fa49c
Commit
f18fa49c
authored
May 06, 2015
by
Peter Eastman
Browse files
Fixed failing test cases. Increased default minimizer tolerance to 10.
parent
73be43c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
27 deletions
+27
-27
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+2
-2
openmmapi/include/openmm/LocalEnergyMinimizer.h
openmmapi/include/openmm/LocalEnergyMinimizer.h
+2
-2
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
+8
-8
platforms/opencl/tests/TestOpenCLLocalEnergyMinimizer.cpp
platforms/opencl/tests/TestOpenCLLocalEnergyMinimizer.cpp
+8
-8
platforms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
...rms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
+5
-5
wrappers/python/simtk/openmm/app/simulation.py
wrappers/python/simtk/openmm/app/simulation.py
+2
-2
No files found.
docs-source/usersguide/application.rst
View file @
f18fa49c
...
@@ -1222,9 +1222,9 @@ specify if you want further control over the minimization. First, you can
...
@@ -1222,9 +1222,9 @@ specify if you want further control over the minimization. First, you can
specify
a
tolerance
for
when
the
energy
should
be
considered
to
have
converged
:
specify
a
tolerance
for
when
the
energy
should
be
considered
to
have
converged
:
::
::
simulation
.
minimizeEnergy
(
tolerance
=
10
*
kilojoule
/
mole
)
simulation
.
minimizeEnergy
(
tolerance
=
5
*
kilojoule
/
mole
)
If
you
do
not
specify
this
parameter
,
a
default
tolerance
of
1
kJ
/
mole
is
used
.
If
you
do
not
specify
this
parameter
,
a
default
tolerance
of
1
0
kJ
/
mole
is
used
.
Second
,
you
can
specify
a
maximum
number
of
iterations
:
Second
,
you
can
specify
a
maximum
number
of
iterations
:
::
::
...
...
openmmapi/include/openmm/LocalEnergyMinimizer.h
View file @
f18fa49c
...
@@ -54,12 +54,12 @@ public:
...
@@ -54,12 +54,12 @@ public:
* @param context a Context specifying the System to minimize and the initial particle positions
* @param context a Context specifying the System to minimize and the initial particle positions
* @param tolerance this specifies how precisely the energy minimum must be located. Minimization
* @param tolerance this specifies how precisely the energy minimum must be located. Minimization
* will be halted once the root-mean-square value of all force components reaches
* will be halted once the root-mean-square value of all force components reaches
* this tolerance. The default value is 1.
* this tolerance. The default value is 1
0
.
* @param maxIterations the maximum number of iterations to perform. If this is 0, minimation is continued
* @param maxIterations the maximum number of iterations to perform. If this is 0, minimation is continued
* until the results converge without regard to how many iterations it takes. The
* until the results converge without regard to how many iterations it takes. The
* default value is 0.
* default value is 0.
*/
*/
static
void
minimize
(
Context
&
context
,
double
tolerance
=
1
,
int
maxIterations
=
0
);
static
void
minimize
(
Context
&
context
,
double
tolerance
=
1
0
,
int
maxIterations
=
0
);
};
};
}
// namespace OpenMM
}
// namespace OpenMM
...
...
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
View file @
f18fa49c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -81,7 +81,7 @@ void testLargeSystem() {
...
@@ -81,7 +81,7 @@ void testLargeSystem() {
const
int
numParticles
=
numMolecules
*
2
;
const
int
numParticles
=
numMolecules
*
2
;
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
4.0
;
const
double
boxSize
=
4.0
;
const
double
tolerance
=
5
;
const
double
tolerance
=
10
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -114,7 +114,7 @@ void testLargeSystem() {
...
@@ -114,7 +114,7 @@ void testLargeSystem() {
State
finalState
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
|
State
::
Positions
);
State
finalState
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
|
State
::
Positions
);
ASSERT
(
finalState
.
getPotentialEnergy
()
<
initialState
.
getPotentialEnergy
());
ASSERT
(
finalState
.
getPotentialEnergy
()
<
initialState
.
getPotentialEnergy
());
// Compute the force magnitude, sub
s
tracting off any component parallel to a constraint, and
// Compute the force magnitude, subtracting off any component parallel to a constraint, and
// check that it satisfies the requested tolerance.
// check that it satisfies the requested tolerance.
double
forceNorm
=
0.0
;
double
forceNorm
=
0.0
;
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
f
-=
dir
*
dir
.
dot
(
f
);
f
-=
dir
*
dir
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
void
testVirtualSites
()
{
void
testVirtualSites
()
{
...
@@ -138,7 +138,7 @@ void testVirtualSites() {
...
@@ -138,7 +138,7 @@ void testVirtualSites() {
const
int
numParticles
=
numMolecules
*
3
;
const
int
numParticles
=
numMolecules
*
3
;
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
4.0
;
const
double
boxSize
=
4.0
;
const
double
tolerance
=
5
;
const
double
tolerance
=
10
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
platforms/opencl/tests/TestOpenCLLocalEnergyMinimizer.cpp
View file @
f18fa49c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -81,7 +81,7 @@ void testLargeSystem() {
...
@@ -81,7 +81,7 @@ void testLargeSystem() {
const
int
numParticles
=
numMolecules
*
2
;
const
int
numParticles
=
numMolecules
*
2
;
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
4.0
;
const
double
boxSize
=
4.0
;
const
double
tolerance
=
5
;
const
double
tolerance
=
10
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -114,7 +114,7 @@ void testLargeSystem() {
...
@@ -114,7 +114,7 @@ void testLargeSystem() {
State
finalState
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
|
State
::
Positions
);
State
finalState
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
|
State
::
Positions
);
ASSERT
(
finalState
.
getPotentialEnergy
()
<
initialState
.
getPotentialEnergy
());
ASSERT
(
finalState
.
getPotentialEnergy
()
<
initialState
.
getPotentialEnergy
());
// Compute the force magnitude, sub
s
tracting off any component parallel to a constraint, and
// Compute the force magnitude, subtracting off any component parallel to a constraint, and
// check that it satisfies the requested tolerance.
// check that it satisfies the requested tolerance.
double
forceNorm
=
0.0
;
double
forceNorm
=
0.0
;
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
f
-=
dir
*
dir
.
dot
(
f
);
f
-=
dir
*
dir
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
void
testVirtualSites
()
{
void
testVirtualSites
()
{
...
@@ -138,7 +138,7 @@ void testVirtualSites() {
...
@@ -138,7 +138,7 @@ void testVirtualSites() {
const
int
numParticles
=
numMolecules
*
3
;
const
int
numParticles
=
numMolecules
*
3
;
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
4.0
;
const
double
boxSize
=
4.0
;
const
double
tolerance
=
5
;
const
double
tolerance
=
10
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
platforms/reference/tests/TestReferenceLocalEnergyMinimizer.cpp
View file @
f18fa49c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
...
@@ -129,8 +129,8 @@ void testLargeSystem() {
f
-=
dir
*
dir
.
dot
(
f
);
f
-=
dir
*
dir
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
forceNorm
+=
f
.
dot
(
f
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
void
testVirtualSites
()
{
void
testVirtualSites
()
{
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
...
@@ -195,8 +195,8 @@ void testVirtualSites() {
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
ASSERT_EQUAL_VEC
((
finalState
.
getPositions
()[
i
+
1
]
+
finalState
.
getPositions
()[
i
])
*
0.5
,
finalState
.
getPositions
()[
i
+
2
],
1e-5
);
}
}
forceNorm
=
sqrt
(
forceNorm
/
(
4
*
numMolecules
));
forceNorm
=
sqrt
(
forceNorm
/
(
5
*
numMolecules
));
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
2
*
tolerance
);
}
}
int
main
()
{
int
main
()
{
...
...
wrappers/python/simtk/openmm/app/simulation.py
View file @
f18fa49c
...
@@ -78,11 +78,11 @@ class Simulation(object):
...
@@ -78,11 +78,11 @@ class Simulation(object):
else
:
else
:
self
.
context
=
mm
.
Context
(
system
,
integrator
,
platform
,
platformProperties
)
self
.
context
=
mm
.
Context
(
system
,
integrator
,
platform
,
platformProperties
)
def
minimizeEnergy
(
self
,
tolerance
=
1
*
unit
.
kilojoule
/
unit
.
mole
,
maxIterations
=
0
):
def
minimizeEnergy
(
self
,
tolerance
=
1
0
*
unit
.
kilojoule
/
unit
.
mole
,
maxIterations
=
0
):
"""Perform a local energy minimization on the system.
"""Perform a local energy minimization on the system.
Parameters:
Parameters:
- tolerance (energy=1*kilojoule/mole) The energy tolerance to which the system should be minimized
- tolerance (energy=1
0
*kilojoule
s
/mole) The energy tolerance to which the system should be minimized
- maxIterations (int=0) The maximum number of iterations to perform. If this is 0, minimization is continued
- maxIterations (int=0) The maximum number of iterations to perform. If this is 0, minimization is continued
until the results converge without regard to how many iterations it takes.
until the results converge without regard to how many iterations it takes.
"""
"""
...
...
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