Skip to content

Commit

Permalink
Added comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetle committed Jul 31, 2016
1 parent 0c268ed commit 2f94dd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package/MDAnalysis/coordinates/dcdtimeseries.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,17 @@ def __read_timecorrel(object self, object atoms, object atomcounts, object forma
# Check if we have fixed atoms
# XXX not done
numskip = step - 1
# if the number to skip is greater than the number of frames left
# to be jumped over, just take one more step to reflect np slicing
# if there is a remainder, guaranteed to have at least one more
# frame.
if(remaining_frames < numskip):
numskip = 1

rc = skip_dcdstep(dcd.fd, dcd.natoms, dcd.nfixed, dcd.charmm, numskip)
if (rc < 0):
raise IOError("Error skipping frame from DCD file")
# on first iteration, numskip = 0, first set is always read.
dcd.setsread = dcd.setsread + numskip
rc = read_dcdsubset(dcd.fd, dcd.natoms, lowerb, upperb, tempX, tempY, tempZ, unitcell, dcd.nfixed, dcd.first, dcd.freeind, dcd.fixedcoords, dcd.reverse, dcd.charmm)
dcd.first = 0
Expand Down
7 changes: 6 additions & 1 deletion package/MDAnalysis/coordinates/src/dcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,16 @@ __read_timeseries(PyObject *self, PyObject *args)
goto error;
}

/*Should actually be number of frames, not true yet*/
remaining_frames = stop-start;
for (i=0;i<n_frames;i++) {
if (step > 1 && i>0) {
// Figure out how many steps to skip
numskip = step -1;
/* If the number to skip is greater than the number of frames left
to be jumped over, just take one more step to reflect np slicing
if there is a remainder, guaranteed to have at least one more
frame.
*/
if(remaining_frames < numskip){
numskip = 1;
}
Expand All @@ -547,6 +551,7 @@ __read_timeseries(PyObject *self, PyObject *args)
goto error;
}
}
// on first iteration, numskip == 0, first set is always read.
dcd->setsread += numskip;
//now read from subset
rc = read_dcdsubset(dcd->fd, dcd->natoms, lowerb, upperb, tempX, tempY, tempZ,
Expand Down

0 comments on commit 2f94dd5

Please sign in to comment.