Skip to content

Commit 1607cc6

Browse files
committed
docs(dpdata-driver): address AI review comments
Load built-in plugins before listing driver keys, align the uv example with the project's Python support floor, and use a safer/runnable ASE example with Lennard-Jones and pathlib-based file writes. Authored by OpenClaw (model: gpt-5.4)
1 parent f5a383c commit 1607cc6

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

skills/dpdata-driver/SKILL.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ In dpdata, this is exposed as:
2828
When unsure what drivers exist in *this* dpdata version/env, query them at runtime:
2929

3030
```python
31+
import dpdata
3132
from dpdata.driver import Driver
3233

3334
print(sorted(Driver.get_drivers().keys()))
3435
```
3536

37+
`import dpdata` ensures built-in plugins are loaded before listing registered drivers.
38+
3639
In the current repo state, keys include:
3740

3841
- `ase`
@@ -70,7 +73,7 @@ Dependencies (recommended): declare script dependencies with uv inline metadata,
7073

7174
```python
7275
# /// script
73-
# requires-python = ">=3.12"
76+
# requires-python = ">=3.8"
7477
# dependencies = [
7578
# "dpdata",
7679
# "numpy",
@@ -82,15 +85,17 @@ Dependencies (recommended): declare script dependencies with uv inline metadata,
8285
Script:
8386

8487
```python
88+
from pathlib import Path
89+
8590
import numpy as np
86-
from ase.calculators.emt import EMT
91+
from ase.calculators.lj import LennardJones
8792
from dpdata.system import System
8893

8994
# write a tiny molecule
90-
open("tmp.xyz", "w").write("""2\n\nH 0 0 0\nH 0 0 0.74\n""")
95+
Path("tmp.xyz").write_text("""2\n\nH 0 0 0\nH 0 0 0.74\n""")
9196

9297
sys = System("tmp.xyz", fmt="xyz")
93-
ls = sys.predict(driver="ase", calculator=EMT())
98+
ls = sys.predict(driver="ase", calculator=LennardJones())
9499

95100
print("energies", np.array(ls.data["energies"]))
96101
print("forces shape", np.array(ls.data["forces"]).shape)
@@ -103,12 +108,12 @@ else:
103108
## Example: pass a Driver object instead of a string
104109

105110
```python
106-
from ase.calculators.emt import EMT
111+
from ase.calculators.lj import LennardJones
107112
from dpdata.driver import Driver
108113
from dpdata.system import System
109114

110115
sys = System("tmp.xyz", fmt="xyz")
111-
ase_driver = Driver.get_driver("ase")(calculator=EMT())
116+
ase_driver = Driver.get_driver("ase")(calculator=LennardJones())
112117
ls = sys.predict(driver=ase_driver)
113118
```
114119

0 commit comments

Comments
 (0)