deepmd/npy/mixed format#
Aliases#
deepmd/npy/mixed
Implementation: DeePMDMixedFormat
Overview#
Mixed-type NumPy dataset for DeePMD-kit.
DeePMD-kit is a deep learning package for training interatomic potentials. Unlike regular deepmd/npy, this layout can combine frames that have the same atom count but different formulas. Per-frame real atom types keep each composition recoverable for models that use type embeddings. Optional atom-count padding can reduce the number of output groups when a dpdata.MultiSystems contains many system sizes.
Examples
Dump a MultiSystems into a mixed type numpy directory:
>>> import dpdata
>>> dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir")
Dump with atom_numb_pad to reduce the number of subdirectories. Systems are padded with virtual atoms (type -1) so that atom counts are rounded up to the nearest multiple of the given number:
>>> dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir", atom_numb_pad=8)
Load a mixed type data into a MultiSystems:
>>> import dpdata
>>> dpdata.MultiSystems().load_systems_from_file("mixed_dir", fmt="deepmd/npy/mixed")
Quick examples#
The examples use the preferred alias deepmd/npy/mixed; any alias listed above is equivalent.
import dpdata
# Multiple compositions or calculation directories
systems = dpdata.MultiSystems.from_file("input_directory", fmt="deepmd/npy/mixed")
# Load or construct the system to write
system = dpdata.System("input_file")
# Write geometry-only data
system.to("deepmd/npy/mixed", "output_path")
# Write multiple systems
systems.to("deepmd/npy/mixed", "output_path")
Conversions#
Convert from System to this format#
- dpdata.System.to(fmt: Literal['deepmd/npy/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, **kwargs)
- dpdata.System.to_deepmd_npy_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, **kwargs)
Dump the system in deepmd mixed type format (numpy binary) to folder.
- The frames were already split to different systems, so these frames can be dumped to one single subfolders
named as folder/set.000, containing less than set_size frames.
- Parameters:
- file_namestr
The output folder
- set_sizeint, default=2000
set size
- prec{numpy.float32, numpy.float64}
The floating point precision of the compressed data
- **kwargsdict
other parameters
Convert from LabeledSystem to this format#
- dpdata.LabeledSystem.to(fmt: Literal['deepmd/npy/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, **kwargs)
- dpdata.LabeledSystem.to_deepmd_npy_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>, **kwargs)
Dump the system in deepmd mixed type format (numpy binary) to folder.
- The frames were already split to different systems, so these frames can be dumped to one single subfolders
named as folder/set.000, containing less than set_size frames.
- Parameters:
- file_namestr
The output folder
- set_sizeint, default=2000
set size
- prec{numpy.float32, numpy.float64}
The floating point precision of the compressed data
- **kwargsdict
other parameters
Convert from this format to MultiSystems#
- dpdata.MultiSystems.from_deepmd_npy_mixed(directory, **kwargs) dpdata.system.MultiSystems
Find mixed-type DeePMD NumPy systems below a directory.
- Parameters:
- directorystr or os.PathLike
Root directory containing one or more mixed datasets.
- **kwargsdict
Additional format arguments forwarded when each dataset is read.
- Returns:
- MultiSystems
converted system
Convert from MultiSystems to this format#
- dpdata.MultiSystems.to(fmt: Literal['deepmd/npy/mixed'], directory, **kwargs) dpdata.system.MultiSystems
- dpdata.MultiSystems.to_deepmd_npy_mixed(directory, **kwargs) dpdata.system.MultiSystems
Convert MultiSystems to this format.
- Parameters:
- directorystr
directory to save systems
- Returns:
- MultiSystems
this system