Open csu1505110121 opened 2 years ago
I believe that the H5MD and mdtraj HDF5 formats are actually two different things (annoyingly another pseudo naming clash).
It's been on my to-do list to add an mdtraj HDF5 parser for a long time but I never get around to it. I'll bump it up my priority list unless someone else gets to it first.
I'm not sure I have a temporary solution for your issue. Having a quick look around mdtraj, it seems that there's not that many options when it comes to velocity & forces writing (unless I'm looking in the wrong place). A "simple" hack could be to 1) load the TRR in MDAnalysis and the H5 trajectory in MDtraj, 2) iterate through both trajectories, 3) at each iteration step overwrite the MDAnalysis universe's velocities and forces with those in MDtraj for that time step (transformed appropriately to deal with the unit conversion) and then directly write that frame to a new TRR file.
Expected behavior
Dear all, I am using OpenMM for the molecular dynamics simulations, and with the help of
mdtraj.reporters.HDF5Reporter
, I could save the velocities of each frame into ah5
format, when I convert the h5 file to trr that could be recognized by gromacs, errors encountered as inmdtraj.save()
the velocities and forces are both set to be zero. So, I sought to mdanalysis, as it stores these information I need. However, when I try to load the h5 file generated by mdtraj with the api provided by MDanalysis, the errors were throw out. The code I tried was detailed as belowActual behavior | codes | errors
code:
errors:
Current version of MDAnalysis
the python version is
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51)
Operating system iscentos 7
Best regards, Qiang