Skip to content

Commit

Permalink
check for malformed MDTrajTraj
Browse files Browse the repository at this point in the history
  • Loading branch information
agrossfield committed Mar 29, 2024
1 parent 74e6e8c commit a84a601
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/mdtrajtraj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ namespace loos {
periodic = false;
}

coords_dataset = file.openDataSet("coordinates");
coords_dataspace = coords_dataset.getSpace();
coords_datatype = coords_dataset.getDataType();
hsize_t coords_dims[3];
int coords_ndims = coords_dataspace.getSimpleExtentDims(coords_dims, NULL);
int coords_ndims;
if (H5Lexists(file.getId(), "coordinates", H5P_DEFAULT)) {
coords_dataset = file.openDataSet("coordinates");
coords_dataspace = coords_dataset.getSpace();
coords_datatype = coords_dataset.getDataType();
coords_ndims = coords_dataspace.getSimpleExtentDims(coords_dims, NULL);
} else{
throw(FileError(_filename, "No coordinates dataset found in HDF5"));
}

if (periodic) {
if (coords_dims[0] != box_dims[0]) {
Expand Down

0 comments on commit a84a601

Please sign in to comment.