H5MSMFileHandler#
molsysmt.native.H5MSMFileHandler is the native binary HDF5 I/O handler class in MolSysMT responsible for reading, writing, and streaming .h5msm binary files.
Overview and Handler Role#
H5MSMFileHandler manages disk handles for MolSysMT’s native .h5msm binary format. It encapsulates h5py.File handles, manages compression filters (Gzip/LZF), enforces schema versioning (Schema 0.4 and 0.3), and powers chunked trajectory iterators.
Class Attributes and Parsed Records#
Inside H5MSMFileHandler, state and binary datasets are exposed via property interfaces:
Attribute / Property |
Data Type |
Description |
|---|---|---|
|
|
Active HDF5 file handle opened in read ( |
|
String ( |
Schema specification version read from root file attributes. |
|
HDF5 Group ( |
HDF5 group containing |
|
HDF5 Group ( |
HDF5 group containing coordinate matrices |
Practical Usage and Streaming Workflow#
import molsysmt as msm
from molsysmt.native import H5MSMFileHandler
# 1. Open an h5msm file handler in context manager mode
with H5MSMFileHandler("trajectory.h5msm", io_mode="r") as handler:
# 2. Access raw HDF5 dataset shapes without loading to RAM
coords_shape = handler.file["/structures/coordinates"].shape
version = handler.format_version
Performance and I/O Invariants#
Context Manager Support: Fully supports python context protocol (
with H5MSMFileHandler(...) as handler:).Zero-Copy Dataset Views: Enables direct dataset slicing from HDF5 disk blocks without loading full trajectories into RAM.