MDMC.exporters.trajectories package
Submodules
MDMC.exporters.trajectories.H5MD_build module
A module for writing and saving a H5MD file.
- MDMC.exporters.trajectories.H5MD_build.H5MD_DATA = {'creator_name': 'MDMC', 'creator_version': [0, 2], 'h5md_version': [1, 1], 'loc': 'h5md', 'module_name': ['units'], 'module_version': [[1, 0]]}
Generic H5MD information like, version of H5MD and any H5MD modules used.
- MDMC.exporters.trajectories.H5MD_build.create_box_data(open_file: File, trajectory: CompactTrajectory)[source]
Create the box group and add all attributes associated with this group.
- Parameters:
trajectory (CompactTrajectory) – The compact trajectory the file is being built from
open_file (h5py.File) – A pre-opened file that the data is being written into
- MDMC.exporters.trajectories.H5MD_build.create_empty_groups(open_file: File, groups: list[str])[source]
Create all groups and subgroups that make up the main base structure of the file format.
- MDMC.exporters.trajectories.H5MD_build.create_metadata_group(open_file: File, *, creator_name: str, creator_email: str)[source]
Create the H5MD group that contains all Metadata information.
- MDMC.exporters.trajectories.H5MD_build.create_parameter_data(open_file: File, data: array)[source]
Create and store the remaining parameter data in the H5MD file.
- Parameters:
open_file (h5py.File) – A pre-opened file that the data is being written into
data (np.array) – The data being stored
- MDMC.exporters.trajectories.H5MD_build.create_simulation_data(open_file: File, group_name: str, value: int | float | str | ndarray, unit: str = None, time_increment: int = None, step_increment: int = None, time_offset: int = None, step_offset: int = None)[source]
Store data about the simulation.
- Parameters:
open_file (h5py.File) – A pre-opened file that the data is being written into
group_name (str) – The group name for the data being stored
value (int | float | str | np.ndarray) – The data being stored in the H5MD file
unit (str, optional) – The units for the data being stored. Default is None.
time_increment (int, optional) – The increment in time between each simulation step, by default None
step_increment (int, optional) – The increment in between steps in a simulation, by default None
time_offset (int, optional) – The offset that the time starts at, by default None
step_offset (int, optional) – The offset what is where the steps start at, by default None
- MDMC.exporters.trajectories.H5MD_build.write_H5MD(trajectory: CompactTrajectory, filename: str = 'trajectory.h5', *, timestamp: bool = True, file_loc: Path = PosixPath('.'), **settings)[source]
Write a CompactTrajectory to a H5MD file.
In MDMC, an H5MD trajectory File is built from a
CompactTrajectory
. Once aCompactTrajectory
is generated, an H5MD trajectory file can be created by passing it to thebuild_full()
function. Once executed the a H5MD (.h5
) file is created with the name “trajectory<timestamp>”- Parameters:
trajectory (CompactTrajectory) – The compact trajectory the file is being built from.
filename (str, optional) – The name of the H5MD file, standards suggest it ends with .h5, by default “trajectory.h5”.
timestamp (bool, optional) – If true adds time timestamp to file name, by default True.
file_loc (Path, optional) – The directory where the H5MD file should be stored, by default Path(‘.’).