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
e4ccca2e
Commit
e4ccca2e
authored
Mar 19, 2015
by
Jason Swails
Browse files
Very simple change to get ~20% performance improvement in reading Amber prmtop
files.
parent
2762adf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
...ers/python/simtk/openmm/app/internal/amber_file_parser.py
+17
-17
No files found.
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
View file @
e4ccca2e
...
@@ -122,21 +122,22 @@ class PrmtopLoader(object):
...
@@ -122,21 +122,22 @@ class PrmtopLoader(object):
with
open
(
inFilename
,
'r'
)
as
fIn
:
with
open
(
inFilename
,
'r'
)
as
fIn
:
for
line
in
fIn
:
for
line
in
fIn
:
if
line
.
startswith
(
'%VERSION'
):
if
line
[
0
]
==
'%'
:
tag
,
self
.
_prmtopVersion
=
line
.
rstrip
().
split
(
None
,
1
)
if
line
.
startswith
(
'%VERSION'
):
elif
line
.
startswith
(
'%FLAG'
):
tag
,
self
.
_prmtopVersion
=
line
.
rstrip
().
split
(
None
,
1
)
tag
,
flag
=
line
.
rstrip
().
split
(
None
,
1
)
elif
line
.
startswith
(
'%FLAG'
):
self
.
_flags
.
append
(
flag
)
tag
,
flag
=
line
.
rstrip
().
split
(
None
,
1
)
self
.
_raw_data
[
flag
]
=
[]
self
.
_flags
.
append
(
flag
)
elif
line
.
startswith
(
'%FORMAT'
):
self
.
_raw_data
[
flag
]
=
[]
format
=
line
.
rstrip
()
elif
line
.
startswith
(
'%FORMAT'
):
index0
=
format
.
index
(
'('
)
format
=
line
.
rstrip
()
index1
=
format
.
index
(
')'
)
index0
=
format
.
index
(
'('
)
format
=
format
[
index0
+
1
:
index1
]
index1
=
format
.
index
(
')'
)
m
=
FORMAT_RE_PATTERN
.
search
(
format
)
format
=
format
[
index0
+
1
:
index1
]
self
.
_raw_format
[
self
.
_flags
[
-
1
]]
=
(
format
,
m
.
group
(
1
),
m
.
group
(
2
),
m
.
group
(
3
),
m
.
group
(
4
))
m
=
FORMAT_RE_PATTERN
.
search
(
format
)
elif
line
.
startswith
(
'%COMMENT'
):
self
.
_raw_format
[
self
.
_flags
[
-
1
]]
=
(
format
,
m
.
group
(
1
),
m
.
group
(
2
),
int
(
m
.
group
(
3
)),
m
.
group
(
4
))
continue
elif
line
.
startswith
(
'%COMMENT'
):
continue
elif
self
.
_flags
\
elif
self
.
_flags
\
and
'TITLE'
==
self
.
_flags
[
-
1
]
\
and
'TITLE'
==
self
.
_flags
[
-
1
]
\
and
not
self
.
_raw_data
[
'TITLE'
]:
and
not
self
.
_raw_data
[
'TITLE'
]:
...
@@ -144,8 +145,7 @@ class PrmtopLoader(object):
...
@@ -144,8 +145,7 @@ class PrmtopLoader(object):
else
:
else
:
flag
=
self
.
_flags
[
-
1
]
flag
=
self
.
_flags
[
-
1
]
(
format
,
numItems
,
itemType
,
(
format
,
numItems
,
itemType
,
itemLength
,
itemPrecision
)
=
self
.
_getFormat
(
flag
)
iLength
,
itemPrecision
)
=
self
.
_getFormat
(
flag
)
iLength
=
int
(
itemLength
)
line
=
line
.
rstrip
()
line
=
line
.
rstrip
()
for
index
in
range
(
0
,
len
(
line
),
iLength
):
for
index
in
range
(
0
,
len
(
line
),
iLength
):
item
=
line
[
index
:
index
+
iLength
]
item
=
line
[
index
:
index
+
iLength
]
...
...
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