Skip to content

Commit

Permalink
Merge pull request mdtraj#1265 from marscher/xtc_fix_single_frame_trajs
Browse files Browse the repository at this point in the history
[xtc] approx_nframes returns at least one.
  • Loading branch information
mpharrigan authored May 12, 2017
2 parents 0a6e58f + e2c6e12 commit fe45f86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mdtraj/formats/xtc/xtc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ cdef class XTCTrajectoryFile(object):
coefs_[1]*self.n_atoms) / (coefs_[2] * self.n_atoms +
coefs_[0])

return approx_n_frames
return max(approx_n_frames, 1)

def __dealloc__(self):
self.close()
Expand Down Expand Up @@ -621,6 +621,7 @@ cdef class XTCTrajectoryFile(object):
dtype=np.int64, count=n_frames)
else:
offsets = np.empty(self.approx_n_frames, dtype=np.int64)
assert len(offsets) >= 1

try:
# skip header
Expand Down

0 comments on commit fe45f86

Please sign in to comment.