deepmd/hdf5 format

Class: DeePMDHDF5Format

HDF5 format for DeePMD-kit.

Examples

Dump a MultiSystems to a HDF5 file:

>>> import dpdata
>>> dpdata.MultiSystems().from_deepmd_npy("data").to_deepmd_hdf5("data.hdf5")

Conversions

Convert from this format to System

dpdata.System(file_name: 'str | (h5py.Group | h5py.File)', type_map: 'list[str] | None' = None, fmt: Literal['deepmd/hdf5'] = None) dpdata.system.System
dpdata.System.from_deepmd_hdf5(file_name: 'str | (h5py.Group | h5py.File)', type_map: 'list[str] | None' = None) dpdata.system.System

Convert HDF5 file to System data.

Parameters:
file_namestr or h5py.Group or h5py.File

file name of the HDF5 file or HDF5 object. If it is a string, hashtag is used to split path to the HDF5 file and the HDF5 group

type_mapdict[str]

type map

Returns:
System

converted system

Raises:
TypeError

file_name is not str or h5py.Group or h5py.File

Convert from System to this format

dpdata.System.to(fmt: Literal['deepmd/hdf5'], file_name: 'str | (h5py.Group | h5py.File)', set_size: 'int' = 5000, comp_prec: 'np.dtype' = <class 'numpy.float64'>)
dpdata.System.to_deepmd_hdf5(file_name: 'str | (h5py.Group | h5py.File)', set_size: 'int' = 5000, comp_prec: 'np.dtype' = <class 'numpy.float64'>)

Convert System data to HDF5 file.

Parameters:
file_namestr or h5py.Group or h5py.File

file name of the HDF5 file or HDF5 object. If it is a string, hashtag is used to split path to the HDF5 file and the HDF5 group

set_sizeint, default=5000

set size

comp_precnp.dtype

data precision

Convert from LabeledSystem to this format

dpdata.LabeledSystem.to(fmt: Literal['deepmd/hdf5'], file_name: 'str | (h5py.Group | h5py.File)', set_size: 'int' = 5000, comp_prec: 'np.dtype' = <class 'numpy.float64'>)
dpdata.LabeledSystem.to_deepmd_hdf5(file_name: 'str | (h5py.Group | h5py.File)', set_size: 'int' = 5000, comp_prec: 'np.dtype' = <class 'numpy.float64'>)

Convert System data to HDF5 file.

Parameters:
file_namestr or h5py.Group or h5py.File

file name of the HDF5 file or HDF5 object. If it is a string, hashtag is used to split path to the HDF5 file and the HDF5 group

set_sizeint, default=5000

set size

comp_precnp.dtype

data precision

Convert from this format to LabeledSystem

dpdata.LabeledSystem(file_name: 'str | (h5py.Group | h5py.File)', type_map: 'list[str] | None' = None, fmt: Literal['deepmd/hdf5'] = None) dpdata.system.LabeledSystem
dpdata.LabeledSystem.from_deepmd_hdf5(file_name: 'str | (h5py.Group | h5py.File)', type_map: 'list[str] | None' = None) dpdata.system.LabeledSystem

Convert HDF5 file to LabeledSystem data.

Parameters:
file_namestr or h5py.Group or h5py.File

file name of the HDF5 file or HDF5 object. If it is a string, hashtag is used to split path to the HDF5 file and the HDF5 group

type_mapdict[str]

type map

Returns:
LabeledSystem

converted system

Raises:
TypeError

file_name is not str or h5py.Group or h5py.File

Convert from this format to MultiSystems

dpdata.MultiSystems.from_deepmd_hdf5(directory: 'str') dpdata.system.MultiSystems

Generate HDF5 groups from a HDF5 file, which will be passed to from_system.

Parameters:
directorystr

HDF5 file name

Returns:
MultiSystems

converted system

Convert from MultiSystems to this format

dpdata.MultiSystems.to(fmt: Literal['deepmd/hdf5'], directory: 'str') dpdata.system.MultiSystems
dpdata.MultiSystems.to_deepmd_hdf5(directory: 'str') dpdata.system.MultiSystems

Generate HDF5 groups, which will be passed to to_system.

Parameters:
directorystr

HDF5 file name

Returns:
MultiSystems

this system