Skip to content

Commit af14769

Browse files
committed
feat: add DeePMD installation agent skill
1 parent ed691aa commit af14769

22 files changed

Lines changed: 3803 additions & 12 deletions

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,27 @@ plugins. Applications can therefore open the backend required by a model
212212
without directly linking every framework.
213213

214214
> [!NOTE]
215-
> Working with an AI coding or scientific agent? DeePMD-kit ships
215+
> Working with an AI coding or scientific agent? Start with
216+
> [Install with an AI agent][agent-install], or browse the
216217
> [official Agent Skills][agent-skills] for model selection, training,
217218
> fine-tuning, Python inference, and LAMMPS workflows.
219+
>
220+
> ```bash
221+
> npx -y skills add https://github.com/deepmodeling/deepmd-kit/tree/master/skills \
222+
> --skill deepmd-install -y
223+
> ```
224+
>
225+
> If direct GitHub access fails, use `gh-proxy.com` for a public, read-only
226+
> clone, then install from the local checkout. Do not send credentials or
227+
> private repository URLs through the proxy.
228+
>
229+
> ```bash
230+
> git clone --depth 1 \
231+
> https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
232+
> deepmd-kit-skill-source
233+
> npx -y skills add ./deepmd-kit-skill-source/skills \
234+
> --skill deepmd-install -y
235+
> ```
218236
219237
## 📚 Documentation and community
220238
@@ -251,6 +269,7 @@ that matches the version used and the method-specific papers listed in
251269
DeePMD-kit is licensed under the
252270
[GNU Lesser General Public License v3.0 or later](./LICENSE).
253271
272+
[agent-install]: https://docs.deepmodeling.com/projects/deepmd/en/latest/install/install-with-agent.html
254273
[agent-skills]: https://docs.deepmodeling.com/projects/deepmd/en/latest/agent-skills.html
255274
[ase]: https://docs.deepmodeling.com/projects/deepmd/en/latest/third-party/ase.html
256275
[backends]: https://docs.deepmodeling.com/projects/deepmd/en/latest/backend.html

doc/agent-skills.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
DeePMD-kit provides official [Agent Skills](https://agentskills.io/what-are-skills) that help AI agents run
44
DeePMD-kit workflows in a reproducible way. These skills capture
5-
project-specific operating knowledge—such as training inputs, model
5+
project-specific operating knowledge—such as installation, training inputs, model
66
selection, deployment, LAMMPS integration, and Python inference patterns—so an
77
agent can turn a high-level request into concrete files, commands, and
88
validation steps.
@@ -14,6 +14,14 @@ in the DeePMD-kit repository under `skills/`.
1414

1515
## List of skills
1616

17+
- `deepmd-install`: Install DeePMD-kit for users. The skill probes the machine,
18+
records the selected environment and build in a validated plan, then follows
19+
either an easy path (conda, pip, Docker, offline, `dp1s`) or a source build of
20+
the Python package, C/C++ interface, and LAMMPS. Kokkos builds use one
21+
`Kokkos_ARCH_*` flag per binary. DPA4/SeZM uses `deepmd/kk`; DPA4C uses
22+
`dpa4spin/kk` with a compact canonical graph artifact. Detailed recipes live
23+
under `skills/deepmd-install/references/` and are loaded only for the selected
24+
path or a matching failure mode.
1725
- `deepmd-train`: Choose a DeePMD-kit model family, then train from scratch.
1826
The skill uses progressive disclosure: the top-level workflow handles common
1927
training steps and model selection, while model-specific configuration lives
@@ -40,6 +48,10 @@ paper:
4048

4149
## Install skills
4250

51+
To have an agent install DeePMD-kit itself, send
52+
[Install with an AI agent](install/install-with-agent.md) and ask it to load
53+
`deepmd-install`.
54+
4355
### If you are a user
4456

4557
The easiest way is to send this page to your agent and ask it to install the
@@ -51,23 +63,34 @@ If you already have a DeePMD-kit checkout, run this command from the repository
5163
root:
5264

5365
```bash
54-
npx -y skills add ./skills -a openclaw -y
66+
npx -y skills add ./skills --skill '*' -y
5567
```
5668

5769
If you do not have a checkout, the same skills can also be installed directly
5870
from GitHub:
5971

6072
```bash
6173
npx -y skills add https://github.com/deepmodeling/deepmd-kit/tree/master/skills \
62-
-a openclaw -y
74+
--skill '*' -y
75+
```
76+
77+
If direct GitHub access fails, use `gh-proxy.com` for a public, read-only clone
78+
and install from that checkout. Do not send credentials or private repository
79+
URLs through the proxy.
80+
81+
```bash
82+
git clone --depth 1 \
83+
https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
84+
deepmd-kit-skill-source
85+
npx -y skills add ./deepmd-kit-skill-source/skills --skill '*' -y
6386
```
6487

65-
The examples above require Node.js/npm so that `npx` is available, and they
66-
install the skills for OpenClaw. Replace `openclaw` with the target agent name
67-
when installing for another agent. The GitHub command lets the skill CLI fetch
68-
the repository for you. For large repositories or slow networks, this can take
69-
longer than installing from an existing local checkout. Refresh or restart the
70-
session afterward so the installed skills are reloaded.
88+
The examples require Node.js/npm so that `npx` is available. The Skills CLI
89+
installs every official skill for the detected agent. To target one product,
90+
add its agent name, for example `--agent cursor` or `--agent claude-code`. The
91+
GitHub command lets the CLI fetch the repository; installing from an existing
92+
checkout avoids that download. Refresh or restart the session afterward so the
93+
installed skills are reloaded.
7194

7295
## Minimal verification
7396

@@ -80,3 +103,6 @@ without launching an expensive calculation. For example:
80103
water dataset and draft a training input, but do not start training.”
81104
- “Use the `lammps-deepmd` skill to prepare an NVT LAMMPS input file for a
82105
DeePMD-kit model, and explain each command.”
106+
- “Use the `deepmd-install` skill to plan a PyTorch CUDA source install, but
107+
ask me for the CUDA toolkit path, PyTorch wheel, and install prefix first.
108+
Do not start compiling.”

doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ New and noteworthy
276276
:link-type: doc
277277
:shadow: sm
278278

279-
Give AI agents reproducible guidance for training, fine-tuning,
280-
inference, and LAMMPS workflows.
279+
Give AI agents reproducible guidance for installation, training,
280+
fine-tuning, inference, and LAMMPS workflows.
281281

282282
Documentation map
283283
=================

doc/install/easy-install.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
There are various easy methods to install DeePMD-kit. Choose one that you prefer. If you want to build by yourself, jump to the next two sections.
44

5+
An AI agent can perform the same installation. See [Install with an AI agent](install-with-agent.md).
6+
57
After your easy installation, DeePMD-kit (`dp`) and LAMMPS (`lmp`) will be available to execute. You can try `dp -h` and `lmp -h` to see the help. `mpirun` is also available considering you may want to train models or run LAMMPS in parallel.
68

79
> [!NOTE]

doc/install/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Installation
55
:maxdepth: 1
66

77
easy-install
8+
install-with-agent
89
install-from-source
910
install-from-c-library
1011
install-lammps

doc/install/install-from-source.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Install from source code
22

3+
An AI agent can walk through this source build, including the C++ interface
4+
and LAMMPS with Kokkos. See [Install with an AI agent](install-with-agent.md).
5+
36
Please follow our [GitHub](https://github.com/deepmodeling/deepmd-kit) webpage to download the source code of a specific version or the [development version](https://github.com/deepmodeling/deepmd-kit/tree/master).
47

58
Or get the DeePMD-kit source code by `git clone`

doc/install/install-lammps.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Install LAMMPS
22

3+
An AI agent can build LAMMPS with the DeePMD-kit module and Kokkos. DPA4/SeZM
4+
uses `pair_style deepmd/kk`; DPA4C uses `pair_style dpa4spin/kk`. See
5+
[Install with an AI agent](install-with-agent.md).
6+
37
There are two ways to install LAMMPS: the built-in mode and the plugin mode. The built-in mode builds LAMMPS along with the DeePMD-kit and DeePMD-kit will be loaded automatically when running LAMMPS. The plugin mode builds LAMMPS and a plugin separately, so one needs to use `plugin load` command to load the DeePMD-kit's LAMMPS plugin library.
48

59
## Install LAMMPS's DeePMD-kit module (built-in mode)

doc/install/install-with-agent.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Install with an AI agent
2+
3+
DeePMD-kit ships an official Agent Skill, `deepmd-install`, that walks an AI
4+
agent through installing the package. The skill covers easy methods (conda,
5+
pip, Docker, offline installers, `dp1s`) and source builds of the Python
6+
package, the C++ interface, and LAMMPS with Kokkos (`pair_style deepmd/kk`,
7+
used by DPA4/SeZM, and `pair_style dpa4spin/kk`, used by DPA4C).
8+
9+
The skill probes the machine, asks only for decisions required by the selected
10+
installation path, and records concrete paths and versions in a validated
11+
plan. It does not assume a host path, package mirror, CUDA toolkit, or backend
12+
version.
13+
14+
The full skill catalog is in [Agent Skills](../agent-skills.md). For a
15+
manual install, use [Easy install](easy-install.md) or
16+
[Install from source](install-from-source.md).
17+
18+
## If you are a user
19+
20+
Send this page to your agent and ask it to install the official
21+
`deepmd-install` skill, then install DeePMD-kit. You do not need to run the
22+
commands below yourself.
23+
24+
## If you are an agent
25+
26+
Install `deepmd-install` first, then follow its probe, validated plan, and
27+
gate workflow.
28+
29+
If this machine already has a DeePMD-kit checkout, run from the repository
30+
root:
31+
32+
```bash
33+
npx -y skills add ./skills --skill deepmd-install -y
34+
```
35+
36+
If there is no checkout, install the same skill from GitHub:
37+
38+
```bash
39+
npx -y skills add https://github.com/deepmodeling/deepmd-kit/tree/master/skills \
40+
--skill deepmd-install -y
41+
```
42+
43+
If direct GitHub access fails, use `gh-proxy.com` for a public, read-only clone
44+
and install from the local checkout. Do not send credentials or private
45+
repository URLs through the proxy.
46+
47+
```bash
48+
git clone --depth 1 \
49+
https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
50+
deepmd-kit-skill-source
51+
npx -y skills add ./deepmd-kit-skill-source/skills \
52+
--skill deepmd-install -y
53+
```
54+
55+
The examples require Node.js/npm so that `npx` is available. The Skills CLI
56+
uses the detected agent. To target one product, add `--agent cursor`,
57+
`--agent claude-code`, or another supported agent name. Refresh or restart the
58+
session afterward so the skill is reloaded.
59+
60+
Then use the `deepmd-install` skill: probe the machine, ask only for missing
61+
decisions, validate `install-plan.json`, and execute one gate at a time. A
62+
CUDA LAMMPS build uses exactly one `Kokkos_ARCH_*` flag per binary and verifies
63+
the pair styles required by the selected model family.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ runtime-evaluated-base-classes = ["torch.nn.Module"]
493493
"**/*.ipynb" = ["T20"] # printing in a nb file is expected
494494
# Example / demo scripts are run directly: top-level imports and prints are fine.
495495
"examples/**/*.py" = ["T20", "TID253"]
496+
# Skill helper CLIs print probe and verification reports.
497+
"skills/**/*.py" = ["T20"]
496498

497499
[tool.pytest.ini_options]
498500
markers = "run"

skills/deepmd-install/SKILL.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
name: deepmd-install
3+
description: Install or rebuild DeePMD-kit with conda, pip, dp1s, offline packages, Docker, or a source checkout. Use for CPU, NVIDIA CUDA, or ROCm environments; PyTorch, TensorFlow, JAX, or Paddle backends; the C/C++ interface; and DeePMD-enabled LAMMPS, including Kokkos pair styles for DPA4 and DPA4C.
4+
---
5+
6+
# Install DeePMD-kit
7+
8+
Install the smallest runtime that satisfies the user's goal. Probe first, keep
9+
all decisions in a validated plan, execute one self-contained gate at a time,
10+
and verify the requested public interface rather than package presence alone.
11+
12+
## Supported workflows
13+
14+
| Path | Scope |
15+
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |
16+
| conda, pip | Stable Python installs for PyTorch, TensorFlow, JAX, and Paddle; optional packaged host LAMMPS |
17+
| `dp1s`, offline package, Docker | Official release artifacts selected by the user or matching documentation |
18+
| source Python | PyTorch, TensorFlow, JAX, and Paddle with backend-specific dependencies and verification |
19+
| source C/C++ | Backend-enabled C/C++ libraries installed into a dedicated prefix |
20+
| source LAMMPS host | Built-in DeePMD module with exact pair-style verification |
21+
| source LAMMPS Kokkos CUDA | PyTorch graph artifacts: `deepmd/kk` for DPA4/SeZM and `dpa4spin/kk` for DPA4C |
22+
| ROCm source, Windows source, LAMMPS plugin mode | Follow the version-matched documentation in the selected checkout |
23+
24+
## Hard rules
25+
26+
1. Resolve the absolute directory containing this `SKILL.md` as `SKILL_ROOT`.
27+
Invoke every bundled script through that absolute path.
28+
1. Run the read-only probe before choosing versions, paths, or accelerators.
29+
1. Ask only for a missing value that changes the selected path. Do not ask
30+
source, compiler, CUDA, or LAMMPS questions for an unrelated easy install.
31+
1. Record all decisions in `install-plan.json` and validate it before an
32+
install, checkout, compile, download, or environment modification.
33+
1. Use the plan's absolute Python executable. Never substitute a bare
34+
`python`, `pip`, or an assumed conda activation.
35+
1. Make every shell call self-contained. Do not rely on an `export`, `cd`, or
36+
`conda activate` from a previous agent tool call.
37+
1. Render commands with concrete plan values. Stop if a plan placeholder,
38+
empty required value, unexpected path, or shell variable not assigned
39+
earlier in the same command block remains.
40+
1. Never run `git reset --hard`, `git clean`, recursively remove an install
41+
prefix, or edit shell rc files as part of this workflow. Use a new build
42+
directory or versioned install prefix instead.
43+
1. Use documentation from the selected checkout for version-sensitive source
44+
options. Do not apply `latest` documentation blindly to an older ref.
45+
1. Confirm before piping a remote script to a shell. Use fail-on-HTTP-error
46+
downloads and verify a checksum whenever the plan contains one.
47+
1. Check GPU occupancy and bind the confirmed physical device explicitly
48+
before a GPU smoke test.
49+
1. On failure, stop the current gate and read
50+
[`references/failure-modes.md`](references/failure-modes.md). Do not restart
51+
the entire install or wipe caches.
52+
53+
## Workflow
54+
55+
### 0. Probe
56+
57+
Run with an available Python 3.10+ interpreter:
58+
59+
```bash
60+
"<absolute-python>" "<absolute-skill-root>/scripts/probe_env.py" --json
61+
```
62+
63+
Use the report to identify the OS, libc, Python environments, compilers,
64+
toolkits, driver, GPU compute capabilities and visibility mask, disk/RAM, and
65+
existing DeePMD-kit/PyTorch installs. The probe does not select versions.
66+
67+
### 1. Select one path
68+
69+
- Prefer an easy method for a stable release without local source changes,
70+
custom C/C++ libraries, or Kokkos device pair styles.
71+
- Use source Python for a branch/fork, unreleased feature, local toolkit build,
72+
or customized OPs.
73+
- Add source C/C++ only when a C/C++ client, source-built LAMMPS, or i-PI needs
74+
it.
75+
- Add source LAMMPS only after the C/C++ gate passes.
76+
77+
### 2. Create and validate the plan
78+
79+
Read [`references/plan-schema.md`](references/plan-schema.md), write the plan to
80+
a stable scratch path outside the source/build trees, and validate it:
81+
82+
```bash
83+
"<absolute-python>" "<absolute-skill-root>/scripts/validate_plan.py" \
84+
"<absolute-plan-path>"
85+
```
86+
87+
Present a concise summary only when the request or probe leaves a meaningful
88+
choice unresolved. If the user already specified the method, backend, version,
89+
and target, proceed without asking them to reconfirm their own request.
90+
91+
### 3. Execute the selected references
92+
93+
| Selection | Read |
94+
| ----------------------------------- | ------------------------------------------------------------ |
95+
| conda, pip, `dp1s`, offline, Docker | [`references/easy-install.md`](references/easy-install.md) |
96+
| source Python | [`references/source-python.md`](references/source-python.md) |
97+
| source C/C++ | [`references/source-cpp.md`](references/source-cpp.md) |
98+
| source LAMMPS | [`references/source-lammps.md`](references/source-lammps.md) |
99+
| failed gate | [`references/failure-modes.md`](references/failure-modes.md) |
100+
101+
Read only the references required by the plan. Within each gate, render one
102+
command block with absolute values so that directory and environment state
103+
cannot leak across calls.
104+
105+
### 4. Enforce the gates
106+
107+
| Gate | Required evidence |
108+
| ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
109+
| Plan | `validate_plan.py` exits zero and prints the normalized plan |
110+
| Environment | The selected package manager and absolute interpreter target the planned environment |
111+
| Python | `verify_python.py` passes for the selected backend and accelerator; source builds also match the expected build variant |
112+
| C/C++ | Expected libraries and headers exist, dynamic dependencies resolve, and the build cache records the requested accelerator/backend |
113+
| LAMMPS | `verify_lammps.py` finds the exact pair styles required by the model family and no unresolved dynamic dependency |
114+
| Smoke | The selected short example finishes on the explicitly bound device and emits its documented success signal |
115+
116+
For PyTorch source builds, install the intended PyTorch before DeePMD-kit and
117+
use `--no-build-isolation`. Set both `DP_ENABLE_PYTORCH` and
118+
`DP_ENABLE_TENSORFLOW` explicitly in the same command that invokes pip.
119+
120+
## LAMMPS model contract
121+
122+
| Model/runtime | Host pair style | Kokkos CUDA pair style | Artifact requirement |
123+
| ------------------- | --------------- | ----------------------------------------------------------- | --------------------------------------------------------- |
124+
| conventional models | `deepmd` | `deepmd/kk` when the model supports device edge/graph input | Compatible frozen model; `/kk` requires edge/graph `.pt2` |
125+
| DPA4 / SeZM | `deepmd` | `deepmd/kk` | Target-specific graph `.pt2` |
126+
| DPA4C native spin | `dpa4spin` | `dpa4spin/kk` | `atom_style spin` and compact canonical graph `.pt2` |
127+
128+
Do not accept `deepmd/kk` as proof that DPA4C is available. Do not substitute
129+
LAMMPS `PKG_GPU` for Kokkos.
130+
131+
## Completion report
132+
133+
Report:
134+
135+
- plan path and resolved source commit, when applicable;
136+
- environment activation or absolute Python path;
137+
- installed DeePMD-kit/backend versions and accelerator visibility;
138+
- C/C++ prefix and LAMMPS binary, when applicable;
139+
- each gate command and observed result;
140+
- any validation gate that was not run and the concrete reason;
141+
- no claim of success beyond the gates that actually passed.

0 commit comments

Comments
 (0)