Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pycgtool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Graham
pycgtool
Commits
c8f36bb6
Commit
c8f36bb6
authored
9 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Better error messages when xtc fails
parent
da541a0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycgtool/frame.py
+22
-3
22 additions, 3 deletions
pycgtool/frame.py
with
22 additions
and
3 deletions
pycgtool/frame.py
+
22
−
3
View file @
c8f36bb6
...
...
@@ -5,6 +5,8 @@ The Frame class may contain multiple Residues which may each contain multiple At
Both Frame and Residue are iterable. Residue is indexable with either atom numbers or names.
"""
import
os
import
numpy
as
np
from
simpletraj
import
trajectory
...
...
@@ -15,6 +17,15 @@ from .parsers.cfg import CFG
np
.
seterr
(
all
=
"
raise
"
)
try
:
raise
FileNotFoundError
except
FileNotFoundError
:
pass
except
NameError
:
class
FileNotFoundError
(
OSError
):
pass
class
Atom
:
"""
Hold data for a single atom
...
...
@@ -112,9 +123,17 @@ class Frame:
self
.
numframes
+=
1
if
xtc
is
not
None
:
self
.
xtc
=
trajectory
.
XtcTrajectory
(
xtc
)
assert
self
.
xtc
.
numatoms
==
self
.
natoms
self
.
numframes
+=
self
.
xtc
.
numframes
try
:
self
.
xtc
=
trajectory
.
XtcTrajectory
(
xtc
)
except
OSError
as
e
:
if
not
os
.
path
.
isfile
(
xtc
):
raise
FileNotFoundError
(
xtc
)
from
e
e
.
args
=
(
"
Error opening file
'
{0}
'"
.
format
(
xtc
),)
raise
else
:
if
self
.
xtc
.
numatoms
!=
self
.
natoms
:
raise
AssertionError
(
"
Number of atoms does not match between gro and xtc files.
"
)
self
.
numframes
+=
self
.
xtc
.
numframes
if
itp
is
not
None
:
self
.
_parse_itp
(
itp
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment