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
f2301d34
Commit
f2301d34
authored
Aug 10, 2015
by
Jason Swails
Browse files
Add test for CMAPTorsionForce
parent
a2c6e628
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
wrappers/python/tests/TestAPIUnits.py
wrappers/python/tests/TestAPIUnits.py
+26
-0
No files found.
wrappers/python/tests/TestAPIUnits.py
View file @
f2301d34
...
...
@@ -2,6 +2,7 @@ import unittest
from
simtk.openmm
import
*
from
simtk.openmm.app
import
*
from
simtk.unit
import
*
import
random
import
math
class
TestAPIUnits
(
unittest
.
TestCase
):
...
...
@@ -159,5 +160,30 @@ class TestAPIUnits(unittest.TestCase):
self
.
assertIs
(
sigma
.
unit
,
nanometers
)
self
.
assertIs
(
epsilon
.
unit
,
kilojoules_per_mole
)
def
testCmapForce
(
self
):
""" Tests the CMAPTorsionForce API features """
map1
=
[
random
.
random
()
for
i
in
range
(
24
*
24
)]
map2
=
[
random
.
random
()
for
i
in
range
(
12
*
12
)]
*
kilocalories_per_mole
force
=
CMAPTorsionForce
()
force
.
addMap
(
24
,
map1
)
force
.
addMap
(
12
,
map2
)
force
.
addTorsion
(
0
,
0
,
1
,
2
,
3
,
1
,
2
,
3
,
4
)
force
.
addTorsion
(
1
,
5
,
6
,
7
,
8
,
6
,
7
,
8
,
9
)
force
.
addTorsion
(
0
,
10
,
11
,
12
,
13
,
11
,
12
,
13
,
14
)
force
.
addTorsion
(
1
,
15
,
16
,
17
,
18
,
16
,
17
,
18
,
19
)
self
.
assertEqual
(
force
.
getNumTorsions
(),
4
)
self
.
assertEqual
(
force
.
getNumMaps
(),
2
)
self
.
assertEqual
(
force
.
getMapParameters
(
0
)[
0
],
24
)
self
.
assertEqual
(
force
.
getMapParameters
(
1
)[
0
],
12
)
self
.
assertIs
(
force
.
getMapParameters
(
0
)[
1
].
unit
,
kilojoules_per_mole
)
self
.
assertIs
(
force
.
getMapParameters
(
1
)[
1
].
unit
,
kilojoules_per_mole
)
for
x
,
y
in
zip
(
force
.
getMapParameters
(
0
)[
1
],
map1
):
self
.
assertAlmostEqual
(
x
.
value_in_unit
(
kilojoules_per_mole
),
y
)
for
x
,
y
in
zip
(
force
.
getMapParameters
(
1
)[
1
],
map2
):
self
.
assertAlmostEqualUnit
(
x
,
y
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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