dpdata.formats.deepmd package#

Submodules#

dpdata.formats.deepmd.comp module#

dpdata.formats.deepmd.comp.dump(folder, data, set_size=5000, comp_prec=<class 'numpy.float32'>, remove_sets=True)[source]#
dpdata.formats.deepmd.comp.to_system_data(folder, type_map=None, labels=True)[source]#

dpdata.formats.deepmd.hdf5 module#

Utils for deepmd/hdf5 format.

dpdata.formats.deepmd.hdf5.dump(f: h5py.File | h5py.Group, folder: str, data: dict, set_size=5000, comp_prec=<class 'numpy.float32'>) None[source]#

Dump data to a HDF5 file.

Parameters:
fh5py.File or h5py.Group

HDF5 file or group object

folderstr

path in the HDF5 file

datadict

System or LabeledSystem data

set_sizeint, default: 5000

size of a set

comp_precnp.dtype, default: np.float32

precision of data

dpdata.formats.deepmd.hdf5.to_system_data(f: h5py.File | h5py.Group, folder: str, type_map: list | None = None, labels: bool = True)[source]#

Load a HDF5 file.

Parameters:
fh5py.File or h5py.Group

HDF5 file or group object

folderstr

path in the HDF5 file

type_maplist

type map

labelsbool

labels

dpdata.formats.deepmd.mixed module#

dpdata.formats.deepmd.mixed.dump(folder, data, set_size=2000, comp_prec=<class 'numpy.float32'>, remove_sets=True, dump_func=None)[source]#

Dump one System data dict in mixed-type DeePMD layout.

If data has not already been converted to mixed type, it is copied and converted first. The converted data stores the original element names in real_atom_names and the per-frame real atom type table in real_atom_types; the backend writer receives the converted data with real_atom_names exposed as atom_names so it is written to type_map.raw.

Parameters:
folder

Backend-specific destination. For the default npy backend this is a directory; HDF5 callers pass an HDF5 group.

datadict

System or LabeledSystem data dict to dump.

set_sizeint, default=2000

Maximum number of frames per set.* chunk.

comp_precnumpy.dtype, default=numpy.float32

Floating point precision used by the backend writer.

remove_setsbool, default=True

Whether existing npy set.* directories should be removed before dumping. Backends that do not use directories may ignore this argument.

dump_funccallable, optional

Backend writer with signature dump_func(folder, data, set_size, comp_prec, remove_sets).

dpdata.formats.deepmd.mixed.mix_system(*system, type_map, atom_numb_pad=None, **kwargs)[source]#

Mix the systems into mixed_type ones according to the unified given type_map.

Parameters:
*systemSystem

The systems to mix

type_maplist of str

Maps atom type to name

atom_numb_padint, optional

If provided, pad atom counts to the next multiple of this number using virtual atoms (type -1 in real_atom_types). This reduces the number of subdirectories when systems have many different atom counts. For example, atom_numb_pad=8 groups systems into multiples of 8.

**kwargsdict

Other parameters

Returns:
mixed_systems: dict

dict of mixed system with key ‘atom_numbs’

dpdata.formats.deepmd.mixed.split_system(sys, split_num=10000)[source]#
dpdata.formats.deepmd.mixed.to_system_data(folder, type_map=None, labels=True, load_func=None)[source]#

Load mixed-type DeePMD data and split it into regular systems.

By default this function reads the deepmd/npy/mixed directory layout through dpdata.formats.deepmd.comp. Other storage backends can pass load_func to reuse the same mixed-type reconstruction logic. The loader must return the same data dict shape as deepmd/npy and include real_atom_types.

Parameters:
folder

Backend-specific location to load. For the default npy backend this is a directory; HDF5 callers pass an HDF5 group.

type_maplist[str], optional

Type map used to remap atom types while loading.

labelsbool, default=True

Whether labeled data such as energies and forces should be loaded.

load_funccallable, optional

Backend reader with signature load_func(folder, type_map, labels).

Returns:
list[dict]

Regular System/LabeledSystem data dicts split out of the mixed input.

dpdata.formats.deepmd.raw module#

dpdata.formats.deepmd.raw.dump(folder, data)[source]#
dpdata.formats.deepmd.raw.load_type(folder, type_map=None)[source]#
dpdata.formats.deepmd.raw.to_system_data(folder, type_map=None, labels=True)[source]#