mdanalysis
mdanalysis copied to clipboard
Cannot read default LAMMPS H5MD file out of the box due to lack of `units` tag
Expected behavior
We are not necessarily doing anything wrong, but just notifying people that we cannot read H5MD files produced by LAMMPS out of the box. LAMMPS does not use the units tag in the H5MD spec, meaning you must specify convert_units=False
Code to reproduce the behaviour
Have the following in LAMMPS input file
write_data system.data
dump h5md1 all h5md 100 dump.h5md position velocity force
import MDAnalysis as mda
u = mda.Universe("system.data", "dump.h5md", atom_style='id type x y z', convert_units=True)
whereas the below will work,
import MDAnalysis as mda
u = mda.Universe("system.data", "dump.h5md", atom_style='id type x y z', convert_units=False)
The resulting system will have units of whatever LAMMPS unit style you chose.
Current version of MDAnalysis
2.8.0dev0
Good to know, perhaps we should just mention it in the docs for any LAMMPS users. We could also make the error message be clearer.
Reading through the H5MD Units spec
The datasets of any H5MD element that have a physical dimension may carry an attribute unit to indicate the physical unit of the respective data.
it is a may so LAMMPS is adhering to the standard.
I am labeling this failure as a defect because LAMMPS adheres to the H5MD standard and we should be able to read standard-compliant H5MD files.