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
eb232608
Commit
eb232608
authored
Apr 22, 2015
by
John Chodera (MSKCC)
Browse files
Merge remote-tracking branch 'upstream/master'
parents
62581e9c
7f8c5089
Changes
267
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
132 additions
and
1 deletion
+132
-1
wrappers/python/src/swig_doxygen/OpenMM.i
wrappers/python/src/swig_doxygen/OpenMM.i
+1
-0
wrappers/python/src/swig_doxygen/doxygen/Doxyfile.in
wrappers/python/src/swig_doxygen/doxygen/Doxyfile.in
+1
-0
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+17
-1
wrappers/python/tests/TestModeller.py
wrappers/python/tests/TestModeller.py
+21
-0
wrappers/python/tests/TestPdbFile.py
wrappers/python/tests/TestPdbFile.py
+6
-0
wrappers/python/tests/TestUnitCell.py
wrappers/python/tests/TestUnitCell.py
+85
-0
wrappers/python/tests/systems/Mg_water.prmtop
wrappers/python/tests/systems/Mg_water.prmtop
+1
-0
No files found.
wrappers/python/src/swig_doxygen/OpenMM.i
View file @
eb232608
...
@@ -48,6 +48,7 @@ namespace std {
...
@@ -48,6 +48,7 @@ namespace std {
#
include
"OpenMM.h"
#
include
"OpenMM.h"
#
include
"OpenMMAmoeba.h"
#
include
"OpenMMAmoeba.h"
#
include
"openmm/RPMDIntegrator.h"
#
include
"openmm/RPMDIntegrator.h"
#
include
"openmm/RPMDMonteCarloBarostat.h"
#
include
"OpenMMDrude.h"
#
include
"OpenMMDrude.h"
#
include
"openmm/serialization/SerializationNode.h"
#
include
"openmm/serialization/SerializationNode.h"
#
include
"openmm/serialization/SerializationProxy.h"
#
include
"openmm/serialization/SerializationProxy.h"
...
...
wrappers/python/src/swig_doxygen/doxygen/Doxyfile.in
View file @
eb232608
...
@@ -621,6 +621,7 @@ EXCLUDE_PATTERNS = */tests/* \
...
@@ -621,6 +621,7 @@ EXCLUDE_PATTERNS = */tests/* \
*amoebaKernels.h \
*amoebaKernels.h \
*DrudeKernels.h \
*DrudeKernels.h \
*RpmdKernels.h \
*RpmdKernels.h \
*RPMDUpdater.h \
*OpenMMFortranModule.f90 \
*OpenMMFortranModule.f90 \
*OpenMMCWrapper.h
*OpenMMCWrapper.h
...
...
wrappers/python/tests/TestForceField.py
View file @
eb232608
...
@@ -5,6 +5,7 @@ from simtk.openmm import *
...
@@ -5,6 +5,7 @@ from simtk.openmm import *
from
simtk.unit
import
*
from
simtk.unit
import
*
import
simtk.openmm.app.element
as
elem
import
simtk.openmm.app.element
as
elem
import
simtk.openmm.app.forcefield
as
forcefield
import
simtk.openmm.app.forcefield
as
forcefield
import
math
class
TestForceField
(
unittest
.
TestCase
):
class
TestForceField
(
unittest
.
TestCase
):
"""Test the ForceField.createSystem() method."""
"""Test the ForceField.createSystem() method."""
...
@@ -208,7 +209,7 @@ class AmoebaTestForceField(unittest.TestCase):
...
@@ -208,7 +209,7 @@ class AmoebaTestForceField(unittest.TestCase):
"""
"""
self
.
pdb1
=
PDBFile
(
'systems/amoeba-ion-in-water.pdb'
)
self
.
pdb1
=
PDBFile
(
'systems/amoeba-ion-in-water.pdb'
)
self
.
forcefield1
=
ForceField
(
'amoeba20
09
.xml'
)
self
.
forcefield1
=
ForceField
(
'amoeba20
13
.xml'
)
self
.
topology1
=
self
.
pdb1
.
topology
self
.
topology1
=
self
.
pdb1
.
topology
...
@@ -253,6 +254,21 @@ class AmoebaTestForceField(unittest.TestCase):
...
@@ -253,6 +254,21 @@ class AmoebaTestForceField(unittest.TestCase):
if
isinstance
(
force
,
AmoebaVdwForce
):
if
isinstance
(
force
,
AmoebaVdwForce
):
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
def
test_RigidWater
(
self
):
"""Test that AMOEBA creates rigid water with the correct geometry."""
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
rigidWater
=
True
)
constraints
=
dict
()
for
i
in
range
(
system
.
getNumConstraints
()):
p1
,
p2
,
dist
=
system
.
getConstraintParameters
(
i
)
if
p1
<
3
:
constraints
[(
min
(
p1
,
p2
),
max
(
p1
,
p2
))]
=
dist
.
value_in_unit
(
nanometers
)
hoDist
=
0.09572
hohAngle
=
108.50
*
math
.
pi
/
180.0
hohDist
=
math
.
sqrt
(
2
*
hoDist
**
2
-
2
*
hoDist
**
2
*
math
.
cos
(
hohAngle
))
self
.
assertAlmostEqual
(
constraints
[(
0
,
1
)],
hoDist
)
self
.
assertAlmostEqual
(
constraints
[(
0
,
2
)],
hoDist
)
self
.
assertAlmostEqual
(
constraints
[(
1
,
2
)],
hohDist
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
...
...
wrappers/python/tests/TestModeller.py
View file @
eb232608
...
@@ -886,6 +886,27 @@ class TestModeller(unittest.TestCase):
...
@@ -886,6 +886,27 @@ class TestModeller(unittest.TestCase):
validate_equivalence
(
self
,
topology_LYN
,
topology_after
)
validate_equivalence
(
self
,
topology_LYN
,
topology_after
)
def
test_addExtraParticles
(
self
):
"""Test addExtraParticles()."""
# Create a box of water.
ff1
=
ForceField
(
'tip3p.xml'
)
modeller
=
Modeller
(
Topology
(),
[]
*
nanometers
)
modeller
.
addSolvent
(
ff1
,
'tip3p'
,
boxSize
=
Vec3
(
2
,
2
,
2
)
*
nanometers
)
# Now convert the water to TIP4P.
ff2
=
ForceField
(
'tip4pew.xml'
)
modeller
.
addExtraParticles
(
ff2
)
for
residue
in
modeller
.
topology
.
residues
():
atoms
=
list
(
residue
.
atoms
())
self
.
assertEqual
(
4
,
len
(
atoms
))
ep
=
[
atom
for
atom
in
atoms
if
atom
.
element
is
None
]
self
.
assertEqual
(
1
,
len
(
ep
))
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
scale
=
max
(
1.0
,
norm
(
p1
),)
scale
=
max
(
1.0
,
norm
(
p1
),)
for
i
in
range
(
3
):
for
i
in
range
(
3
):
...
...
wrappers/python/tests/TestPdbFile.py
View file @
eb232608
...
@@ -60,6 +60,12 @@ class TestPdbFile(unittest.TestCase):
...
@@ -60,6 +60,12 @@ class TestPdbFile(unittest.TestCase):
self
.
assertEqual
(
atom1
.
name
,
atom2
.
name
)
self
.
assertEqual
(
atom1
.
name
,
atom2
.
name
)
self
.
assertEqual
(
atom1
.
residue
.
name
,
atom2
.
residue
.
name
)
self
.
assertEqual
(
atom1
.
residue
.
name
,
atom2
.
residue
.
name
)
def
test_BinaryStream
(
self
):
"""Test reading a stream that was opened in binary mode."""
pdb
=
PDBFile
(
open
(
'systems/triclinic.pdb'
,
'rb'
))
self
.
assertEqual
(
len
(
pdb
.
positions
),
8
)
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
unit
=
p1
.
unit
unit
=
p1
.
unit
p1
=
p1
.
value_in_unit
(
unit
)
p1
=
p1
.
value_in_unit
(
unit
)
...
...
wrappers/python/tests/TestUnitCell.py
0 → 100644
View file @
eb232608
import
unittest
import
math
from
simtk.openmm
import
Vec3
from
simtk.unit
import
*
from
simtk.openmm.app.internal.unitcell
import
computePeriodicBoxVectors
from
simtk.openmm.app.internal.unitcell
import
computeLengthsAndAngles
from
simtk.openmm.app.internal.unitcell
import
reducePeriodicBoxVectors
def
strip_units
(
x
):
if
is_quantity
(
x
):
return
x
.
value_in_unit_system
(
md_unit_system
)
return
x
class
TestUnitCell
(
unittest
.
TestCase
):
""" Test the unitcell.py module """
def
testReducePBCVectors
(
self
):
""" Checks that reducePeriodicBoxVectors properly reduces vectors """
a
=
Vec3
(
4.24388485
,
0.0
,
0.0
)
b
=
Vec3
(
-
1.4146281691908937
,
4.001173048368583
,
0.0
)
c
=
Vec3
(
-
1.4146281691908937
,
-
2.0005862820516203
,
3.4651176446201674
)
vecs
=
reducePeriodicBoxVectors
((
a
,
b
,
c
)
*
nanometers
)
vecs2
=
computePeriodicBoxVectors
(
4.24388485
,
4.24388485
,
4.24388485
,
109.4712190
*
degrees
,
109.4712190
*
degrees
,
109.4712190
*
degrees
)
# Check that the vectors are the same
a1
,
a2
,
a3
=
vecs
b1
,
b2
,
b3
=
vecs2
for
x
,
y
in
zip
(
a1
,
b1
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
for
x
,
y
in
zip
(
a2
,
b2
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
for
x
,
y
in
zip
(
a3
,
b3
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
def
testComputePBCVectors
(
self
):
""" Tests computing periodic box vectors """
deg90
=
90
*
degrees
vecs
=
computePeriodicBoxVectors
(
1
,
2
,
3
,
deg90
,
deg90
,
deg90
)
a
,
b
,
c
=
vecs
self
.
assertAlmostEqual
(
a
[
0
]
/
nanometers
,
1
)
self
.
assertAlmostEqual
(
a
[
1
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
a
[
2
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
b
[
0
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
b
[
1
]
/
nanometers
,
2
)
self
.
assertAlmostEqual
(
b
[
2
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
c
[
0
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
c
[
1
]
/
nanometers
,
0
)
self
.
assertAlmostEqual
(
c
[
2
]
/
nanometers
,
3
)
# Make sure round-trip works
la
,
lb
,
lc
,
al
,
be
,
ga
=
computeLengthsAndAngles
(
vecs
)
self
.
assertAlmostEqual
(
la
,
1
)
self
.
assertAlmostEqual
(
lb
,
2
)
self
.
assertAlmostEqual
(
lc
,
3
)
self
.
assertAlmostEqual
(
al
,
math
.
pi
/
2
)
self
.
assertAlmostEqual
(
be
,
math
.
pi
/
2
)
self
.
assertAlmostEqual
(
ga
,
math
.
pi
/
2
)
# Now test a truncated octahedron. Can't do a simple round-trip though,
# due to the reduced form. So test the *second* round-trip, which should
# yield the same measurements
vecs
=
computePeriodicBoxVectors
(
4.24388485
,
4.24388485
,
4.24388485
,
109.4712190
*
degrees
,
109.4712190
*
degrees
,
109.4712190
*
degrees
)
la
,
lb
,
lc
,
al
,
be
,
ga
=
computeLengthsAndAngles
(
vecs
)
vecs2
=
computePeriodicBoxVectors
(
la
,
lb
,
lc
,
al
,
be
,
ga
)
la2
,
lb2
,
lc2
,
al2
,
be2
,
ga2
=
computeLengthsAndAngles
(
vecs2
)
# Now make sure that the round-trip worked
self
.
assertAlmostEqual
(
strip_units
(
la
),
strip_units
(
la2
))
self
.
assertAlmostEqual
(
strip_units
(
lb
),
strip_units
(
lb2
))
self
.
assertAlmostEqual
(
strip_units
(
lc
),
strip_units
(
lc2
))
self
.
assertAlmostEqual
(
strip_units
(
al
),
strip_units
(
al2
))
self
.
assertAlmostEqual
(
strip_units
(
be
),
strip_units
(
be2
))
self
.
assertAlmostEqual
(
strip_units
(
ga
),
strip_units
(
ga2
))
# Check that the vectors are the same
a1
,
a2
,
a3
=
vecs
b1
,
b2
,
b3
=
vecs2
for
x
,
y
in
zip
(
a1
,
b1
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
for
x
,
y
in
zip
(
a2
,
b2
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
for
x
,
y
in
zip
(
a3
,
b3
):
self
.
assertAlmostEqual
(
strip_units
(
x
),
strip_units
(
y
))
wrappers/python/tests/systems/Mg_water.prmtop
View file @
eb232608
...
@@ -1802,6 +1802,7 @@ WAT WAT
...
@@ -1802,6 +1802,7 @@ WAT WAT
2.54487941E+01 1.27063907E+02 5.94825035E+02 0.00000000E+00 0.00000000E+00
2.54487941E+01 1.27063907E+02 5.94825035E+02 0.00000000E+00 0.00000000E+00
0.00000000E+00
0.00000000E+00
%FLAG LENNARD_JONES_CCOEF
%FLAG LENNARD_JONES_CCOEF
%COMMENT This is the r^-4 term in the 12-6-4 LJ potential
%FORMAT(5E16.8)
%FORMAT(5E16.8)
0.00000000E+00 1.32908847E+02 0000000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 1.32908847E+02 0000000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00
0.00000000E+00
...
...
Prev
1
…
10
11
12
13
14
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