deepmd/hdf5/mixed format#
Class: DeePMDHDF5MixedFormat
Mixed type HDF5 format for DeePMD-kit.
Mixed type data stores frames with the same atom count in one dataset even when their formulas differ. The placeholder type.raw contains only the mixed token type, while set.*/real_atom_types.npy stores the real atom type layout for each frame. Loading reconstructs regular Systems by splitting frames with different real_atom_types rows.
The HDF5 layout mirrors deepmd/npy/mixed inside HDF5 groups. For dpdata.MultiSystems, each top-level mixed group is keyed by the number of atoms after optional padding, such as "4" or "8". A string path may include "#group/path" to read or write mixed data under a nested HDF5 group.
Examples
Dump a dpdata.MultiSystems object to a mixed HDF5 file:
>>> systems.to_deepmd_hdf5_mixed("mixed.hdf5")
Dump with atom-count padding:
>>> systems.to_deepmd_hdf5_mixed("mixed.hdf5", atom_numb_pad=8)
Load a mixed HDF5 file into dpdata.MultiSystems:
>>> dpdata.MultiSystems().from_deepmd_hdf5_mixed("mixed.hdf5")
Conversions#
Convert from System to this format#
- dpdata.System.to(fmt: Literal['deepmd/hdf5/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, comp_prec=None)
- dpdata.System.to_deepmd_hdf5_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, comp_prec=None)
Dump a System data dict in mixed HDF5 format.
- Parameters:
- file_namestr or h5py.Group or h5py.File
HDF5 file, HDF5 group, or string in
"file.hdf5#group"form. Strings open the target file in write mode. HDF5 objects are written in place.- set_sizeint, default=2000
Maximum number of frames per
set.*group.- precnumpy.dtype, default=numpy.float64
Floating point precision for dumped frame data. Kept for consistency with
deepmd/npy/mixed.- comp_precnumpy.dtype, optional
Explicit floating point precision. When provided, this overrides
prec.
- Raises:
- TypeError
If
file_nameis not a string, HDF5 group, or HDF5 file.
Convert from LabeledSystem to this format#
- dpdata.LabeledSystem.to(fmt: Literal['deepmd/hdf5/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, comp_prec=None)
- dpdata.LabeledSystem.to_deepmd_hdf5_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, comp_prec=None)
Dump a System data dict in mixed HDF5 format.
- Parameters:
- file_namestr or h5py.Group or h5py.File
HDF5 file, HDF5 group, or string in
"file.hdf5#group"form. Strings open the target file in write mode. HDF5 objects are written in place.- set_sizeint, default=2000
Maximum number of frames per
set.*group.- precnumpy.dtype, default=numpy.float64
Floating point precision for dumped frame data. Kept for consistency with
deepmd/npy/mixed.- comp_precnumpy.dtype, optional
Explicit floating point precision. When provided, this overrides
prec.
- Raises:
- TypeError
If
file_nameis not a string, HDF5 group, or HDF5 file.
Convert from this format to MultiSystems#
- dpdata.MultiSystems.from_deepmd_hdf5_mixed(directory) dpdata.system.MultiSystems
Generate mixed HDF5 groups for MultiSystems loading.
- Parameters:
- directorystr or h5py.Group or h5py.File
HDF5 file, HDF5 group, or string in
"file.hdf5#group"form. The selected object may be either one mixed system group or a container of mixed groups.
- Returns:
- MultiSystems
converted system
- Raises:
- TypeError
If
directoryis not a string, HDF5 group, or HDF5 file.
Convert from MultiSystems to this format#
- dpdata.MultiSystems.to(fmt: Literal['deepmd/hdf5/mixed'], directory) dpdata.system.MultiSystems
- dpdata.MultiSystems.to_deepmd_hdf5_mixed(directory) dpdata.system.MultiSystems
Generate HDF5 groups for MultiSystems mixed dumping.
- Parameters:
- directorystr or h5py.Group or h5py.File
HDF5 file, HDF5 group, or string in
"file.hdf5#group"form. Strings open the target file in write mode.
- Returns:
- MultiSystems
this system
- Raises:
- TypeError
If
directoryis not a string, HDF5 group, or HDF5 file.