Skip to content

Commit

Permalink
Bug fix. Multitraj iterator had sync issues with Trajectory class res…
Browse files Browse the repository at this point in the history
…ulting in skipped first frame and duplicated final frame.
  • Loading branch information
tromo committed Aug 7, 2018
1 parent bf37cbe commit 3b91e67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/MultiTraj.cpp
Expand Up @@ -71,7 +71,7 @@ namespace loos {
}

bool MultiTrajectory::parseFrame() {
if (eof())
if (eof() || atEnd())
return 0;
return(_trajectories[_curtraj]->readFrame(_curframe));
}
Expand All @@ -96,4 +96,3 @@ namespace loos {
}

}

8 changes: 5 additions & 3 deletions src/MultiTraj.hpp
Expand Up @@ -45,23 +45,24 @@ namespace loos {

MultiTrajectory()
: _nframes(0), _skip(0), _stride(1), _curtraj(0), _curframe(0)
{ }
{ cached_first = true; }

//! instantiate a new empty MultiTrajectory
MultiTrajectory(const AtomicGroup& model)
: _nframes(0), _skip(0), _stride(1), _curtraj(0), _curframe(0), _model(model)
{ }
{ cached_first = true; }

MultiTrajectory(const AtomicGroup& model, const uint skip, const uint stride)
: _nframes(0), _skip(skip), _stride(stride), _curtraj(0), _curframe(0), _model(model)
{ }
{ cached_first = true; }


//! Instantiate a new MultiTrajectory using the passed filenames
MultiTrajectory(const std::vector<std::string>& filenames,
const AtomicGroup& model)
: _nframes(0), _skip(0), _stride(1), _curtraj(0), _curframe(0), _model(model)
{
cached_first = true;
initWithList(filenames, model);
}

Expand All @@ -72,6 +73,7 @@ namespace loos {
const uint stride)
: _nframes(0), _skip(skip), _stride(stride), _curtraj(0), _curframe(skip), _model(model)
{
cached_first = true;
initWithList(filenames, model);
}

Expand Down

0 comments on commit 3b91e67

Please sign in to comment.