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
95711b88
Commit
95711b88
authored
Jun 16, 2019
by
huangj
Browse files
Add a test case for the colinear lonepair facility in CHARMM psf parser.
parent
cbbc7911
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
36 deletions
+41
-36
wrappers/python/simtk/openmm/app/charmmpsffile.py
wrappers/python/simtk/openmm/app/charmmpsffile.py
+30
-28
wrappers/python/tests/TestCharmmFiles.py
wrappers/python/tests/TestCharmmFiles.py
+11
-8
No files found.
wrappers/python/simtk/openmm/app/charmmpsffile.py
View file @
95711b88
...
@@ -714,6 +714,7 @@ class CharmmPsfFile(object):
...
@@ -714,6 +714,7 @@ class CharmmPsfFile(object):
if
atom
.
type
is
not
None
:
if
atom
.
type
is
not
None
:
# This is the most reliable way of determining the element
# This is the most reliable way of determining the element
atomic_num
=
atom
.
type
.
atomic_number
atomic_num
=
atom
.
type
.
atomic_number
if
atomic_num
!=
0
:
elem
=
element
.
Element
.
getByAtomicNumber
(
atomic_num
)
elem
=
element
.
Element
.
getByAtomicNumber
(
atomic_num
)
else
:
else
:
# Figure it out from the mass
# Figure it out from the mass
...
@@ -911,6 +912,7 @@ class CharmmPsfFile(object):
...
@@ -911,6 +912,7 @@ class CharmmPsfFile(object):
bond
.
bond_type
.
req
*
length_conv
)
bond
.
bond_type
.
req
*
length_conv
)
# Add virtual sites
# Add virtual sites
if
hasattr
(
self
,
'lonepair_list'
):
if
verbose
:
print
(
'Adding lonepairs...'
)
if
verbose
:
print
(
'Adding lonepairs...'
)
for
lpsite
in
self
.
lonepair_list
:
for
lpsite
in
self
.
lonepair_list
:
index
=
lpsite
[
0
]
index
=
lpsite
[
0
]
...
...
wrappers/python/tests/TestCharmmFiles.py
View file @
95711b88
...
@@ -141,17 +141,20 @@ class TestCharmmFiles(unittest.TestCase):
...
@@ -141,17 +141,20 @@ class TestCharmmFiles(unittest.TestCase):
warnings
.
filterwarnings
(
'ignore'
,
category
=
CharmmPSFWarning
)
warnings
.
filterwarnings
(
'ignore'
,
category
=
CharmmPSFWarning
)
psf
=
CharmmPsfFile
(
'systems/chlb_cgenff.psf'
)
psf
=
CharmmPsfFile
(
'systems/chlb_cgenff.psf'
)
crd
=
CharmmCrdFile
(
'systems/chlb_cgenff.crd'
)
crd
=
CharmmCrdFile
(
'systems/chlb_cgenff.crd'
)
# move the position of the lonepair on Cholride
params
=
CharmmParameterSet
(
'systems/top_all36_cgenff.rtf'
,
params
=
CharmmParameterSet
(
'systems/par_all36_cgenff.prm'
,
'systems/par_all36_cgenff.prm'
)
'systems/top_all36_cgenff.rtf'
)
# Box dimensions (found from bounding box)
plat
=
Platform
.
getPlatformByName
(
'Reference'
)
plat
=
Platform
.
getPlatformByName
(
'Reference'
)
system
=
psf
.
createSystem
(
params
,
nonbondedMethod
=
PME
,
system
=
psf
.
createSystem
(
params
)
nonbondedCutoff
=
8
*
angstroms
)
con
=
Context
(
system
,
VerletIntegrator
(
2
*
femtoseconds
),
plat
)
con
=
Context
(
system
,
VerletIntegrator
(
2
*
femtoseconds
),
plat
)
con
.
setPositions
(
crd
.
positions
)
con
.
setPositions
(
crd
.
positions
)
init_coor
=
con
.
getState
(
getPositions
=
True
).
getPositions
()
# move the position of the lonepair and recompute its coordinates
crd
.
positions
[
12
]
=
Vec3
(
0.5
,
1.0
,
1.5
)
*
angstrom
con
.
setPositions
(
crd
.
positions
)
con
.
computeVirtualSites
()
new_coor
=
con
.
getState
(
getPositions
=
True
).
getPositions
()
self
.
assertEqual
(
init_coor
,
new_coor
)
def
test_InsCode
(
self
):
def
test_InsCode
(
self
):
""" Test the parsing of PSF files that contain insertion codes in their residue numbers """
""" Test the parsing of PSF files that contain insertion codes in their residue numbers """
...
...
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