H5MSMReporter#

Streaming OpenMM simulation trajectories directly to binary H5MSM files on disk.

The H5MSMReporter class writes high-speed compressed HDF5 binary trajectory files (.h5msm) incrementally during OpenMM molecular dynamics simulations.

Added in version 1.0.0.

Basic usage#

Let’s stream trajectory data to an H5MSM file:

import molsysmt as msm
import os

molsys = msm.convert(msm.systems['Trp-Cage']['1l2y.h5msm'], to_form='molsysmt.MolSys')
simulation = msm.convert(molsys, to_form='openmm.Simulation', temperature='300 K')

h5_out = 'traj_run.h5msm'
reporter = msm.third_party.openmm.reporters.H5MSMReporter(file=h5_out, reportInterval=10, steps=20)
simulation.reporters.append(reporter)
simulation.step(20)
reporter.close()

print('H5MSM trajectory written. Exists on disk:', os.path.exists(h5_out))
if os.path.exists(h5_out):
    os.remove(h5_out)
H5MSM trajectory written. Exists on disk: True