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
93055791
Commit
93055791
authored
Aug 02, 2013
by
peastman
Browse files
Speed optimization to GromacsTopFile
parent
01e5d92a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+23
-1
No files found.
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
93055791
...
...
@@ -462,6 +462,24 @@ class GromacsTopFile(object):
topologyAtoms
=
list
(
self
.
topology
.
atoms
())
exceptions
=
[]
fudgeQQ
=
float
(
self
.
_defaults
[
4
])
# Build a lookup table to let us process dihedrals more quickly.
dihedralTypeTable
=
{}
for
key
in
self
.
_dihedralTypes
:
if
key
[
1
]
!=
'X'
and
key
[
2
]
!=
'X'
:
if
(
key
[
1
],
key
[
2
])
not
in
dihedralTypeTable
:
dihedralTypeTable
[(
key
[
1
],
key
[
2
])]
=
[]
dihedralTypeTable
[(
key
[
1
],
key
[
2
])].
append
(
key
)
if
(
key
[
2
],
key
[
1
])
not
in
dihedralTypeTable
:
dihedralTypeTable
[(
key
[
2
],
key
[
1
])]
=
[]
dihedralTypeTable
[(
key
[
2
],
key
[
1
])].
append
(
key
)
wildcardDihedralTypes
=
[]
for
key
in
self
.
_dihedralTypes
:
if
key
[
1
]
==
'X'
or
key
[
2
]
==
'X'
:
wildcardDihedralTypes
.
append
(
key
)
for
types
in
dihedralTypeTable
.
itervalues
():
types
.
append
(
key
)
# Loop over molecules and create the specified number of each type.
...
...
@@ -584,7 +602,11 @@ class GromacsTopFile(object):
else
:
# Look for a matching dihedral type.
paramsList
=
None
for
key
in
self
.
_dihedralTypes
:
if
(
types
[
1
],
types
[
2
])
in
dihedralTypeTable
:
dihedralTypes
=
dihedralTypeTable
[(
types
[
1
],
types
[
2
])]
else
:
dihedralTypes
=
wildcardDihedralTypes
for
key
in
dihedralTypes
:
if
all
(
a
==
b
or
a
==
'X'
for
a
,
b
in
zip
(
key
,
types
))
or
all
(
a
==
b
or
a
==
'X'
for
a
,
b
in
zip
(
key
,
reversedTypes
)):
paramsList
=
self
.
_dihedralTypes
[
key
]
if
'X'
not
in
key
:
...
...
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