skills/dpdata-plugin/SKILL.md
Create and install dpdata plugins (especially custom Format readers/writers) using Format.register(...) and pyproject.toml entry_points under 'dpdata.plugins'. Use when extending dpdata with new formats or distributing plugins as separate Python packages.
npx skillsauth add deepmodeling/dpdata dpdata-pluginInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
dpdata loads plugins in two ways:
dpdata.plugins.* (imported automatically)dpdata.pluginsThis skill focuses on external plugin packages, the recommended way to add new formats without modifying dpdata itself.
Most commonly: add a new Format (file reader/writer) via:
from dpdata.format import Format
@Format.register("myfmt")
class MyFormat(Format): ...
dpdata imports dpdata.plugins during normal use (e.g. dpdata.system imports it). That module:
dpdata/plugins/*.pydpdata.pluginsSo an external plugin package only needs to ensure that importing the entry-point target triggers the @Format.register(...) side effects.
Example layout:
dpdata_random/
pyproject.toml
dpdata_random/
__init__.py
In dpdata_random/__init__.py (shortened example):
from __future__ import annotations
import numpy as np
from dpdata.format import Format
@Format.register("random")
class RandomFormat(Format):
def from_system(self, file_name, **kwargs):
nframes = int(file_name)
return {
"atom_numbs": [20],
"atom_names": ["X"],
"atom_types": np.zeros(20, dtype=int),
"cells": np.repeat(np.eye(3)[None, ...], nframes, axis=0) * 100.0,
"coords": np.random.rand(nframes, 20, 3) * 100.0,
"orig": np.zeros(3),
"nopbc": False,
}
Return dicts must match dpdata’s expected schema (cells/coords/atom_names/atom_types/...).
Here file_name is the argument dpdata passes into from_system; this example interprets it as an integer frame count.
In pyproject.toml:
[project]
name = "dpdata_random"
version = "0.0.0"
dependencies = ["numpy", "dpdata"]
[project.entry-points.'dpdata.plugins']
random = "dpdata_random:RandomFormat"
Any importable target works; this pattern points directly at the class.
In a clean env (recommended via uv):
uv venv
. .venv/bin/activate
uv pip install -e . dpdata numpy
python - <<'PY'
import dpdata
from dpdata.format import Format
# importing dpdata will load entry points (dpdata.plugins)
print('random' in Format.get_formats())
PY
If it prints True, your plugin was discovered.
pyproject.toml contain [project.entry-points.'dpdata.plugins']?@Format.register(...) decorator?random, check Format.get_formats() to avoid colliding with an existing built-in or previously loaded plugin key.uv run, remember each command runs in its own environment unless you’re in a uv project (or you rely on uv run --with ...).tools
Minimize geometries with dpdata minimizer plugins via System.minimize(), including how minimizers relate to drivers (ASEMinimizer needs a dpdata Driver) and how to list supported minimizers (ase/sqm). Use when doing geometry optimization/minimization through dpdata Python API.
tools
Use dpdata Python Driver plugins to label systems (energies/forces/virials) via System.predict(), list available drivers, and build Driver objects (ase/deepmd/gaussian/sqm/hybrid). Use when working with dpdata Python API (not CLI) and you need driver-based energy/force prediction, plugin registration keys, or examples of using dpdata with ASE calculators or DeePMD models.
tools
Convert and manipulate atomic simulation data formats using dpdata CLI. Use when converting between DFT/MD output formats (VASP, LAMMPS, QE, CP2K, Gaussian, ABACUS, etc.), preparing training data for DeePMD-kit, or working with DeePMD formats. Supports 50+ formats including deepmd/raw, deepmd/comp, deepmd/npy, deepmd/hdf5.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.