Skip to content

Commit

Permalink
xtcreader on open go to load frame 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kain88-de committed Oct 30, 2015
1 parent e612fa8 commit 3bd46ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions package/MDAnalysis/coordinates/XTC.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(self, filename, convert_units=True, sub=None, **kwargs):
self.n_atoms = len(sub)
else:
self.n_atoms = self.xtc.n_atoms
self.xtc.seek(0)

self.ts = self._Timestep(self.n_atoms, **self._ts_kwargs)
self.ts.frame = 0 # 0-based frame number as starting frame
Expand All @@ -43,6 +42,8 @@ def __init__(self, filename, convert_units=True, sub=None, **kwargs):
self.convert_pos_from_native(self.ts._pos)
self.convert_pos_from_native(self.ts._unitcell[:3])

self.rewind()

def close(self):
self.xtc.close()

Expand All @@ -58,7 +59,9 @@ def rewind(self):
self._read_frame(0)

def _reopen(self):
self._read_frame(0)
self.ts.frame = 0
self._frame = -1
self.xtc.seek(0)

def _read_frame(self, i):
self.xtc.seek(i)
Expand Down

0 comments on commit 3bd46ae

Please sign in to comment.