Registry / ai-ml / dpdata

dpdata

JSON →
library1.0.1pypypi✓ verified 86d ago

A Python library for manipulating data formats of DeePMD-kit, VASP, QE, PWmat, LAMMPS, ABACUS, and other computational chemistry/DFT codes. It provides a unified interface to read, write, convert, and process atomic simulation data including coordinates, forces, energies, and stress tensors. Current version: 1.0.1, with a stable API after the 1.0.0 release. Release cadence: approximately 1-2 months per minor/patch version.

pip install dpdata
INSTALL
IMPORT
SIG · DPDATA
D
dpdata
ai-mlpythonv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

System
from dpdata import System
from dpdata.system import System
dpdata previously allowed deep imports, but requires top-level import since v0.2.20
MultiSystems
from dpdata import MultiSystems
from dpdata.multisystems import MultiSystems
similar to System, top-level import is recommended

Read a VASP OUTCAR file, print number of atoms and first frame energy, convert to ASE Atoms.

from dpdata import System import numpy as np sys = System('path/to/OUTCAR', fmt='vasp/outcar') print('Number of atoms per frame:', sys['atom_numbs']) print('First frame energies:', sys['energies'][0]) # Convert ASE Atoms back atoms = sys.to_ase_atoms() print(atoms)
Debug
Known issues
gotchadpdata uses 0-based atomic type indices, while some formats (e.g., LAMMPS) use 1-based. Always check atom_type_map after loading.
fix
Access sys.atom_type_map to get mapping from index to species name.
affects: all
gotchaWhen converting to deepmd/npy, the 'set_size' during writing can produce multiple subdirectories (set.001, set.002, ...). Ensure consistency in number of frames per set if you intend to use multiple sets for training.
fix
Specify set_size in the DeepmdNativeFormat or use to_deepmd_npy(set_size=...) to control splitting.
affects: >=1.0.0
breakingPython 3.7 support was dropped in v0.2.22. Python 3.8+ is required.
fix
Upgrade Python to 3.8 or later.
affects: >=0.2.22
deprecatedThe 'label' kwarg in to_deepmd_npy is deprecated in favor of 'set_size'.
fix
Use set_size instead of label.
affects: >=1.0.0
gotchaWriting to LAMMPS data file may lose information if the System contains multiple atom types with different masses; you must manually set mass_map.
fix
Before writing, assign sys.data['atom_mass'] = [...] or use sys.set_masses(mass_map).
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dpdata'
dpdata is not installed.
fix
Run: pip install dpdata
AttributeError: module 'dpdata' has no attribute 'System'
Importing dpdata but not using submodule; may have old version or incorrect import.
fix
Use: from dpdata import System
ValueError: Unknown format: 'outcar'
Format string mismatch: dpdata expects 'vasp/outcar' not just 'outcar'.
fix
Use fmt='vasp/outcar' when reading VASP OUTCAR files.
Upgrade
Version history
1.0.1latest on PyPI · released Feb 28, 2026
Audit
Dependencies
numpyrequiredcore array operations
aseoptionalASE Atoms and Trajectory support, converting dpdata System to/from ASE
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
dpdata — pip install dpdata · libregistry