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
a52c30a5
Commit
a52c30a5
authored
Feb 06, 2020
by
peastman
Browse files
Replace nonstandard atom and residue names when loading PSF files
parent
fc7382ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
wrappers/python/simtk/openmm/app/charmmpsffile.py
wrappers/python/simtk/openmm/app/charmmpsffile.py
+9
-2
wrappers/python/tests/TestCharmmFiles.py
wrappers/python/tests/TestCharmmFiles.py
+3
-3
No files found.
wrappers/python/simtk/openmm/app/charmmpsffile.py
View file @
a52c30a5
...
@@ -8,7 +8,7 @@ Structures at Stanford, funded under the NIH Roadmap for Medical Research,
...
@@ -8,7 +8,7 @@ Structures at Stanford, funded under the NIH Roadmap for Medical Research,
grant U54 GM072970. See https://simtk.org. This code was originally part of
grant U54 GM072970. See https://simtk.org. This code was originally part of
the ParmEd program and was ported for use with OpenMM.
the ParmEd program and was ported for use with OpenMM.
Copyright (c) 2014-20
16
the Authors
Copyright (c) 2014-20
20
the Authors
Author: Jason M. Swails
Author: Jason M. Swails
Contributors: Jing Huang
Contributors: Jing Huang
...
@@ -41,7 +41,7 @@ import sys
...
@@ -41,7 +41,7 @@ import sys
import
simtk.openmm
as
mm
import
simtk.openmm
as
mm
from
simtk.openmm.vec3
import
Vec3
from
simtk.openmm.vec3
import
Vec3
import
simtk.unit
as
u
import
simtk.unit
as
u
from
simtk.openmm.app
import
(
forcefield
as
ff
,
Topology
,
element
)
from
simtk.openmm.app
import
(
forcefield
as
ff
,
Topology
,
element
,
PDBFile
)
from
simtk.openmm.app.amberprmtopfile
import
HCT
,
OBC1
,
OBC2
,
GBn
,
GBn2
from
simtk.openmm.app.amberprmtopfile
import
HCT
,
OBC1
,
OBC2
,
GBn
,
GBn2
from
simtk.openmm.app.internal.customgbforces
import
(
GBSAHCTForce
,
from
simtk.openmm.app.internal.customgbforces
import
(
GBSAHCTForce
,
GBSAOBC1Force
,
GBSAOBC2Force
,
GBSAGBnForce
,
GBSAGBn2Force
)
GBSAOBC1Force
,
GBSAOBC2Force
,
GBSAGBnForce
,
GBSAGBn2Force
)
...
@@ -219,6 +219,7 @@ class CharmmPsfFile(object):
...
@@ -219,6 +219,7 @@ class CharmmPsfFile(object):
atom_list
=
AtomList
()
atom_list
=
AtomList
()
if
IsDrudePSF
:
if
IsDrudePSF
:
drudeconsts_list
=
TrackedList
()
drudeconsts_list
=
TrackedList
()
PDBFile
.
_loadNameReplacementTables
()
for
i
in
xrange
(
natom
):
for
i
in
xrange
(
natom
):
words
=
psfsections
[
'NATOM'
][
1
][
i
].
split
()
words
=
psfsections
[
'NATOM'
][
1
][
i
].
split
()
system
=
words
[
1
]
system
=
words
[
1
]
...
@@ -239,6 +240,12 @@ class CharmmPsfFile(object):
...
@@ -239,6 +240,12 @@ class CharmmPsfFile(object):
charge
=
conv
(
words
[
6
],
float
,
'partial charge'
)
charge
=
conv
(
words
[
6
],
float
,
'partial charge'
)
mass
=
conv
(
words
[
7
],
float
,
'atomic mass'
)
mass
=
conv
(
words
[
7
],
float
,
'atomic mass'
)
props
=
words
[
8
:]
props
=
words
[
8
:]
if
resname
in
PDBFile
.
_residueNameReplacements
:
resname
=
PDBFile
.
_residueNameReplacements
[
resname
]
if
resname
in
PDBFile
.
_atomNameReplacements
:
atomReplacements
=
PDBFile
.
_atomNameReplacements
[
resname
]
if
name
in
atomReplacements
:
name
=
atomReplacements
[
name
]
atom
=
residue_list
.
add_atom
(
system
,
resid
,
resname
,
name
,
atom
=
residue_list
.
add_atom
(
system
,
resid
,
resname
,
name
,
attype
,
charge
,
mass
,
inscode
,
props
)
attype
,
charge
,
mass
,
inscode
,
props
)
atom_list
.
append
(
atom
)
atom_list
.
append
(
atom
)
...
...
wrappers/python/tests/TestCharmmFiles.py
View file @
a52c30a5
...
@@ -284,7 +284,7 @@ class TestCharmmFiles(unittest.TestCase):
...
@@ -284,7 +284,7 @@ class TestCharmmFiles(unittest.TestCase):
+
[
"H{}"
.
format
(
i
)
for
i
in
range
(
1
,
12
)]
+
[
"H{}"
.
format
(
i
)
for
i
in
range
(
1
,
12
)]
+
[
"N{}"
.
format
(
i
)
for
i
in
range
(
1
,
4
)]
+
[
"N{}"
.
format
(
i
)
for
i
in
range
(
1
,
4
)]
)
)
tip3
=
[
"O
H2
"
,
"H1"
,
"H2"
]
hoh
=
[
"O"
,
"H1"
,
"H2"
]
pot
=
[
"POT"
]
pot
=
[
"POT"
]
cla
=
[
"CLA"
]
cla
=
[
"CLA"
]
psf
=
CharmmPsfFile
(
'systems/charmm-solvated/isa_wat.3_kcl.m14.psf'
)
psf
=
CharmmPsfFile
(
'systems/charmm-solvated/isa_wat.3_kcl.m14.psf'
)
...
@@ -292,8 +292,8 @@ class TestCharmmFiles(unittest.TestCase):
...
@@ -292,8 +292,8 @@ class TestCharmmFiles(unittest.TestCase):
atoms
=
[
atom
.
name
for
atom
in
residue
.
atoms
()]
atoms
=
[
atom
.
name
for
atom
in
residue
.
atoms
()]
if
residue
.
name
==
"M14"
:
if
residue
.
name
==
"M14"
:
self
.
assertEqual
(
sorted
(
m14
),
sorted
(
atoms
))
self
.
assertEqual
(
sorted
(
m14
),
sorted
(
atoms
))
elif
residue
.
name
==
"
TIP3
"
:
elif
residue
.
name
==
"
HOH
"
:
self
.
assertEqual
(
sorted
(
tip3
),
sorted
(
atoms
))
self
.
assertEqual
(
sorted
(
hoh
),
sorted
(
atoms
))
elif
residue
.
name
==
"POT"
:
elif
residue
.
name
==
"POT"
:
self
.
assertEqual
(
sorted
(
pot
),
sorted
(
atoms
))
self
.
assertEqual
(
sorted
(
pot
),
sorted
(
atoms
))
elif
residue
.
name
==
"CLA"
:
elif
residue
.
name
==
"CLA"
:
...
...
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