dpdata.formats.deepmd package#
Submodules#
dpdata.formats.deepmd.comp module#
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.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
datahas not already been converted to mixed type, it is copied and converted first. The converted data stores the original element names inreal_atom_namesand the per-frame real atom type table inreal_atom_types; the backend writer receives the converted data withreal_atom_namesexposed asatom_namesso it is written totype_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.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/mixeddirectory layout throughdpdata.formats.deepmd.comp. Other storage backends can passload_functo reuse the same mixed-type reconstruction logic. The loader must return the same data dict shape asdeepmd/npyand includereal_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.