Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5MD reader does not accept box vector #4075

Closed
schlaicha opened this issue Mar 15, 2023 · 0 comments · Fixed by #4076
Closed

H5MD reader does not accept box vector #4075

schlaicha opened this issue Mar 15, 2023 · 0 comments · Fixed by #4076

Comments

@schlaicha
Copy link
Contributor

Expected behavior

According to the H5MD format specification:

edges
A D-dimensional vector or a D × D matrix, depending on the geometry of the box, of Float or Integer type. If edges is a vector, it specifies the space diagonal of a cuboid-shaped box. If edges is a matrix, the box is of triclinic shape with the edge vectors given by the rows of the matrix.

The current implementation in coordinates/H5MD.py
however assumes a 3x3 matrix.
When loading a LAMMPS h5md trajectory of a cubic box, edges have shape (3,) and thus core.triclinic_box will return a vector of zeros.

Actual behavior

Box dimensions are None when loading a H5MD trajectory with box edges specified as vector.

Code to reproduce the behavior

minimal_example.zip

import MDAnalysis as mda
u = mda.Universe('minimal.data', 'lammps.h5md', convert_units=False)
print(u.dimensions)

Current version of MDAnalysis

MDAnalysis 2.4.2 / Python 3.10.6 / Ubuntu 22.04

orbeckst pushed a commit that referenced this issue Mar 27, 2023
* fix #4075 
* Fix parsing of box vector in H5MD reader: cuboid boxes are now handled according
   to H5MD standard as they can be given as (Lx, Ly, Lz) only
* update CHANGELOG
* add @schlaicha to AUTHORS
* add docstring
* Add unit test as suggested by @edisj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant