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
12b839b2
Commit
12b839b2
authored
May 23, 2017
by
Jason Swails
Browse files
Add a test for flexibleConstraints.
parent
cc03f111
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+28
-5
No files found.
wrappers/python/tests/TestForceField.py
View file @
12b839b2
...
@@ -95,6 +95,29 @@ class TestForceField(unittest.TestCase):
...
@@ -95,6 +95,29 @@ class TestForceField(unittest.TestCase):
validateConstraints
(
self
,
topology
,
system
,
validateConstraints
(
self
,
topology
,
system
,
constraints_value
,
rigidWater_value
)
constraints_value
,
rigidWater_value
)
def
test_flexibleConstraints
(
self
):
""" Test the flexibleConstraints keyword """
topology
=
self
.
pdb1
.
topology
system1
=
self
.
forcefield1
.
createSystem
(
topology
,
constraints
=
HAngles
,
rigidWater
=
True
)
system2
=
self
.
forcefield1
.
createSystem
(
topology
,
constraints
=
HAngles
,
rigidWater
=
True
,
flexibleConstraints
=
True
)
validateConstraints
(
self
,
topology
,
system1
,
HAngles
,
True
)
validateConstraints
(
self
,
topology
,
system2
,
HAngles
,
True
)
for
force
in
system1
.
getForces
():
if
isinstance
(
force
,
HarmonicBondForce
):
bf1
=
force
elif
isinstance
(
force
,
HarmonicAngleForce
):
af1
=
force
for
force
in
system2
.
getForces
():
if
isinstance
(
force
,
HarmonicBondForce
):
bf2
=
force
elif
isinstance
(
force
,
HarmonicAngleForce
):
af2
=
force
# Make sure we picked up extra terms with flexibleConstraints
self
.
assertGreater
(
bf2
.
getNumBonds
(),
bf1
.
getNumBonds
())
self
.
assertGreater
(
af2
.
getNumAngles
(),
af2
.
getNumAngles
())
def
test_ImplicitSolvent
(
self
):
def
test_ImplicitSolvent
(
self
):
"""Test the four types of implicit solvents using the implicitSolvent
"""Test the four types of implicit solvents using the implicitSolvent
parameter.
parameter.
...
@@ -687,7 +710,7 @@ class TestForceField(unittest.TestCase):
...
@@ -687,7 +710,7 @@ class TestForceField(unittest.TestCase):
def
test_NBFix
(
self
):
def
test_NBFix
(
self
):
"""Test using LennardJonesGenerator to implement NBFix terms."""
"""Test using LennardJonesGenerator to implement NBFix terms."""
# Create a chain of five atoms.
# Create a chain of five atoms.
top
=
Topology
()
top
=
Topology
()
chain
=
top
.
addChain
()
chain
=
top
.
addChain
()
res
=
top
.
addResidue
(
'RES'
,
chain
)
res
=
top
.
addResidue
(
'RES'
,
chain
)
...
@@ -701,9 +724,9 @@ class TestForceField(unittest.TestCase):
...
@@ -701,9 +724,9 @@ class TestForceField(unittest.TestCase):
top
.
addBond
(
atoms
[
1
],
atoms
[
2
])
top
.
addBond
(
atoms
[
1
],
atoms
[
2
])
top
.
addBond
(
atoms
[
2
],
atoms
[
3
])
top
.
addBond
(
atoms
[
2
],
atoms
[
3
])
top
.
addBond
(
atoms
[
3
],
atoms
[
4
])
top
.
addBond
(
atoms
[
3
],
atoms
[
4
])
# Create the force field and system.
# Create the force field and system.
xml
=
"""
xml
=
"""
<ForceField>
<ForceField>
<AtomTypes>
<AtomTypes>
...
@@ -738,9 +761,9 @@ class TestForceField(unittest.TestCase):
...
@@ -738,9 +761,9 @@ class TestForceField(unittest.TestCase):
</ForceField> """
</ForceField> """
ff
=
ForceField
(
StringIO
(
xml
))
ff
=
ForceField
(
StringIO
(
xml
))
system
=
ff
.
createSystem
(
top
)
system
=
ff
.
createSystem
(
top
)
# Check that it produces the correct energy.
# Check that it produces the correct energy.
integrator
=
VerletIntegrator
(
0.001
)
integrator
=
VerletIntegrator
(
0.001
)
context
=
Context
(
system
,
integrator
,
Platform
.
getPlatform
(
0
))
context
=
Context
(
system
,
integrator
,
Platform
.
getPlatform
(
0
))
positions
=
[
Vec3
(
i
,
0
,
0
)
for
i
in
range
(
5
)]
*
nanometers
positions
=
[
Vec3
(
i
,
0
,
0
)
for
i
in
range
(
5
)]
*
nanometers
...
...
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