Skip to content
Snippets Groups Projects
Commit 322f73bd authored by BIOPZ-Johner Niklaus's avatar BIOPZ-Johner Niklaus
Browse files

Fix in dcd reader to allow reading of dcd files written by namd 2.11

We cannot rely on the header containing the number of frames in the
dcd files, as namd 2.11 sets this variable to 0.
parent 7c3f6e67
No related branches found
No related tags found
No related merge requests found
......@@ -279,7 +279,7 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist, // this atom li
geom::Vec3 cell_size, cell_angles;
size_t frame_size=calc_frame_size(ucell_flag, gap_flag, xlist.size());
int i=0;
for(;i<header.num;i+=stride) {
while(true){
if (!read_frame(istream, header, frame_size, ucell_flag, gap_flag,
swap_flag, xlist, clist, i,cell_size,cell_angles)) {
break;
......@@ -292,11 +292,12 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist, // this atom li
// skip frames (defined by stride)
if(stride>1) istream.seekg(frame_size*(stride-1),std::ios_base::cur);
}
istream.get();
if(!istream.eof()) {
LOG_VERBOSE("LoadCHARMMTraj: unexpected trailing file data, bytes read: "
<< istream.tellg());
i+=stride;
istream.get();
if(istream.eof()){
break;
}
istream.unget();
}
LOG_VERBOSE("Loaded " << cg.GetFrameCount() << " frames with "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment