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
ad98f764
Commit
ad98f764
authored
Sep 28, 2015
by
Jason Swails
Browse files
Add units to AmoebaMultipoleForce.getMultipoleParameters (check that these are
right). Add a test for AmoebaMultipoleForce.
parent
3e42a372
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
wrappers/python/src/swig_doxygen/swigInputConfig.py
wrappers/python/src/swig_doxygen/swigInputConfig.py
+3
-1
wrappers/python/tests/TestAPIUnits.py
wrappers/python/tests/TestAPIUnits.py
+59
-0
No files found.
wrappers/python/src/swig_doxygen/swigInputConfig.py
View file @
ad98f764
...
@@ -256,7 +256,9 @@ UNITS = {
...
@@ -256,7 +256,9 @@ UNITS = {
# void getCovalentMap(int index, CovalentType typeId, std::vector<int>& covalentAtoms )
# void getCovalentMap(int index, CovalentType typeId, std::vector<int>& covalentAtoms )
# void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists )
# void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists )
(
"AmoebaMultipoleForce"
,
"getMultipoleParameters"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getMultipoleParameters"
)
:
(
None
,
(
'unit.elementary_charge'
,
'unit.elementary_charge/unit.nanometer'
,
'unit.elementary_charge/unit.nanometer**2'
,
None
,
None
,
None
,
None
,
None
,
None
,
'unit.nanometer**3'
)),
(
"AmoebaMultipoleForce"
,
"getCovalentMap"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getCovalentMap"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getCovalentMaps"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getCovalentMaps"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getScalingDistanceCutoff"
)
:
(
'unit.nanometer'
,
()),
(
"AmoebaMultipoleForce"
,
"getScalingDistanceCutoff"
)
:
(
'unit.nanometer'
,
()),
...
...
wrappers/python/tests/TestAPIUnits.py
View file @
ad98f764
...
@@ -13,6 +13,10 @@ class TestAPIUnits(unittest.TestCase):
...
@@ -13,6 +13,10 @@ class TestAPIUnits(unittest.TestCase):
def
assertAlmostEqualUnit
(
self
,
x1
,
x2
):
def
assertAlmostEqualUnit
(
self
,
x1
,
x2
):
self
.
assertAlmostEqual
(
x1
.
_value
,
x2
.
value_in_unit
(
x1
.
unit
))
self
.
assertAlmostEqual
(
x1
.
_value
,
x2
.
value_in_unit
(
x1
.
unit
))
def
assertAlmostEqualUnitArray
(
self
,
a1
,
a2
):
for
x1
,
x2
in
zip
(
a1
.
_value
,
a2
.
value_in_unit
(
a1
.
unit
)):
self
.
assertAlmostEqual
(
x1
,
x2
)
def
testHarmonicBondForce
(
self
):
def
testHarmonicBondForce
(
self
):
""" Tests HarmonicBondForce API features """
""" Tests HarmonicBondForce API features """
force
=
HarmonicBondForce
()
force
=
HarmonicBondForce
()
...
@@ -982,5 +986,60 @@ class TestAPIUnits(unittest.TestCase):
...
@@ -982,5 +986,60 @@ class TestAPIUnits(unittest.TestCase):
self
.
assertEqual
(
eps
,
1
*
kilocalorie_per_mole
)
self
.
assertEqual
(
eps
,
1
*
kilocalorie_per_mole
)
self
.
assertIs
(
eps
.
unit
,
kilojoule_per_mole
)
self
.
assertIs
(
eps
.
unit
,
kilojoule_per_mole
)
def
testAmoebaMultipoleForce
(
self
):
""" Tests the AmoebaMultipoleForce API features """
force
=
AmoebaMultipoleForce
()
self
.
assertIs
(
force
.
getNonbondedMethod
(),
AmoebaMultipoleForce
.
NoCutoff
)
self
.
assertFalse
(
force
.
usesPeriodicBoundaryConditions
())
force
.
setNonbondedMethod
(
AmoebaMultipoleForce
.
PME
)
self
.
assertIs
(
force
.
getNonbondedMethod
(),
AmoebaMultipoleForce
.
PME
)
self
.
assertTrue
(
force
.
usesPeriodicBoundaryConditions
())
self
.
assertEqual
(
force
.
getCutoffDistance
(),
1
*
nanometer
)
self
.
assertIs
(
force
.
getCutoffDistance
().
unit
,
nanometer
)
force
.
setCutoffDistance
(
8
*
angstroms
)
self
.
assertEqual
(
force
.
getCutoffDistance
(),
8
*
angstrom
)
self
.
assertIs
(
force
.
getCutoffDistance
().
unit
,
nanometer
)
self
.
assertEqual
(
force
.
getPolarizationType
(),
AmoebaMultipoleForce
.
Mutual
)
force
.
setPolarizationType
(
AmoebaMultipoleForce
.
Direct
)
self
.
assertEqual
(
force
.
getPolarizationType
(),
AmoebaMultipoleForce
.
Direct
)
force
.
setPolarizationType
(
AmoebaMultipoleForce
.
Mutual
)
self
.
assertEqual
(
force
.
getPolarizationType
(),
AmoebaMultipoleForce
.
Mutual
)
force
.
addMultipole
(
1.0
,
[
0.5
,
0
,
-
0.5
],
list
(
range
(
9
)),
AmoebaMultipoleForce
.
ZThenX
,
1
,
2
,
3
,
0.5
,
0.5
,
1.0
)
force
.
addMultipole
(
1.0
*
elementary_charge
,
[
0.5
,
0
,
-
0.5
]
*
elementary_charge
/
angstrom
,
list
(
range
(
9
))
*
elementary_charge
/
angstrom
**
2
,
AmoebaMultipoleForce
.
Bisector
,
2
,
3
,
4
,
0.5
,
0.5
,
1.0
*
angstrom
**
3
)
self
.
assertEqual
(
force
.
getNumMultipoles
(),
2
)
q
,
mu
,
quad
,
ax
,
i
,
j
,
k
,
thole
,
damp
,
polarity
=
force
.
getMultipoleParameters
(
0
)
self
.
assertEqual
(
q
,
1.0
*
elementary_charge
)
self
.
assertEqual
(
mu
,
(
0.5
,
0
,
-
0.5
)
*
elementary_charge
/
nanometer
)
self
.
assertEqual
(
quad
,
tuple
(
range
(
9
))
*
elementary_charge
/
nanometer
**
2
)
self
.
assertEqual
(
ax
,
AmoebaMultipoleForce
.
ZThenX
)
self
.
assertEqual
(
i
,
1
)
self
.
assertEqual
(
j
,
2
)
self
.
assertEqual
(
k
,
3
)
self
.
assertEqual
(
thole
,
0.5
)
self
.
assertEqual
(
damp
,
0.5
)
self
.
assertEqual
(
polarity
,
1
*
nanometer
**
3
)
q
,
mu
,
quad
,
ax
,
i
,
j
,
k
,
thole
,
damp
,
polarity
=
force
.
getMultipoleParameters
(
1
)
self
.
assertEqual
(
q
,
1.0
*
elementary_charge
)
self
.
assertEqual
(
mu
,
(
0.5
,
0
,
-
0.5
)
*
elementary_charge
/
angstrom
)
self
.
assertAlmostEqualUnitArray
(
quad
,
tuple
(
range
(
9
))
*
elementary_charge
/
angstrom
**
2
)
self
.
assertEqual
(
ax
,
AmoebaMultipoleForce
.
Bisector
)
self
.
assertEqual
(
i
,
2
)
self
.
assertEqual
(
j
,
3
)
self
.
assertEqual
(
k
,
4
)
self
.
assertEqual
(
thole
,
0.5
)
self
.
assertEqual
(
damp
,
0.5
)
self
.
assertAlmostEqualUnit
(
polarity
,
1
*
angstrom
**
3
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
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