@delta-infra/cli 1.0.75 → 1.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +427 -411
- package/checksums.txt +5 -5
- package/package.json +2 -1
- package/scripts/install-wizard.js +596 -596
- package/scripts/install.js +400 -400
- package/scripts/run.js +65 -65
- package/skills/antbo-ldm-guard/SKILL.md +58 -54
- package/skills/antbo-ldm-guard/agents/openai.yaml +4 -4
- package/skills/antbo-service/SKILL.md +79 -74
- package/skills/antbo-service/agents/openai.yaml +4 -4
- package/skills/antbo-service/references/operations.md +45 -45
- package/skills/delta-bo/SKILL.md +36 -31
- package/skills/delta-bo/agents/openai.yaml +4 -4
- package/skills/delta-bo/references/endpoints.md +263 -263
- package/skills/delta-sandbox/SKILL.md +356 -356
- package/skills/delta-sandbox/agents/openai.yaml +4 -4
- package/skills/delta-sandbox/references/commands.md +56 -56
- package/skills/delta-sandbox/references/lifecycle.md +92 -92
- package/skills/delta-sandbox/references/recipes.md +133 -133
- package/skills/delta-science/SKILL.md +171 -166
- package/skills/delta-science/agents/openai.yaml +4 -4
- package/skills/delta-science/references/cli-contract.md +84 -84
- package/skills/delta-science/references/generated-catalog.md +48 -0
- package/skills/delta-science/references/services.md +112 -112
- package/skills/delta-science/references/workflows.md +44 -44
- package/skills/delta-science/scripts/generated_catalog.py +69 -0
- package/skills/delta-science/scripts/invoke.py +263 -329
- package/skills/delta-shared/SKILL.md +95 -95
- package/skills/delta-shared/agents/openai.yaml +4 -4
- package/skills/gsasii/SKILL.md +42 -37
- package/skills/gsasii/agents/openai.yaml +4 -4
- package/skills/gsasii/references/endpoints.md +130 -130
- package/skills/lammps/SKILL.md +39 -34
- package/skills/lammps/agents/openai.yaml +4 -4
- package/skills/lammps/references/endpoints.md +61 -61
- package/skills/ldm-bo/SKILL.md +35 -30
- package/skills/ldm-bo/agents/openai.yaml +4 -4
- package/skills/ldm-bo/references/endpoints.md +127 -127
- package/skills/manifest.json +17 -17
- package/skills/pubchem/SKILL.md +93 -88
- package/skills/pubchem/agents/openai.yaml +4 -4
- package/skills/pubchem/references/endpoints.md +122 -122
- package/skills/pubchem/references/operations.md +41 -41
- package/skills/pymatgen/SKILL.md +54 -49
- package/skills/pymatgen/agents/openai.yaml +4 -4
- package/skills/pymatgen/references/endpoints.md +66 -66
- package/skills/rdkit/SKILL.md +112 -107
- package/skills/rdkit/agents/openai.yaml +4 -4
- package/skills/rdkit/references/endpoints.md +133 -133
- package/skills/rdkit/references/operations.md +64 -64
- package/skills/science-tools.json +127 -0
- package/skills/synbo-service/SKILL.md +36 -31
- package/skills/synbo-service/agents/openai.yaml +4 -4
- package/skills/synbo-service/references/endpoints.md +157 -157
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: delta-shared
|
|
3
|
-
description: "delta-cli 全局共享规则:配置/认证检查、安全红线、错误处理、sandbox 销毁。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# delta-cli 共享规则
|
|
7
|
-
|
|
8
|
-
指导 AI 使用 `delta-cli` 的通用规则。核心原则:**只检查、不猜测、不泄露密钥**。
|
|
9
|
-
|
|
10
|
-
## 执行任何操作之前
|
|
11
|
-
|
|
12
|
-
1. 确认服务端地址:
|
|
13
|
-
```bash
|
|
14
|
-
delta-cli config show
|
|
15
|
-
```
|
|
16
|
-
2. 确认认证状态:
|
|
17
|
-
```bash
|
|
18
|
-
delta-cli auth status
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
- 若 `auth status` 显示 `method: token`,**直接执行目标命令**,不要重复登录或初始化配置。
|
|
22
|
-
- 若显示 `method: none`,或操作返回 `error.type: auth` / `permission`,才进入下面的“补全配置”流程。
|
|
23
|
-
|
|
24
|
-
## 补全配置
|
|
25
|
-
|
|
26
|
-
缺少服务端地址或凭证时,**向用户询问一次**,然后用 flag 初始化:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
delta-cli config init --base-url <server-url> --token <token>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
不要用交互式 `config init`(无 flag),避免在 stdin 不可用时卡住。
|
|
33
|
-
|
|
34
|
-
### 信息来源优先级
|
|
35
|
-
|
|
36
|
-
1. 环境变量:`DELTA_INFRA_BASE_URL`、`DELTA_INFRA_TOKEN`
|
|
37
|
-
2. `~/.delta-infra/config.json` 中的 `base_url` / `token`
|
|
38
|
-
3. 默认值:仅 `base_url` 有内部默认值
|
|
39
|
-
4. 以上都缺失时,**必须询问用户**,禁止虚构
|
|
40
|
-
|
|
41
|
-
### 运行时凭证
|
|
42
|
-
|
|
43
|
-
CLI 使用 `token` 发送请求头 `Authorization: Bearer <token>`,并自动从 JWT 中提取 `uid` 作为 `X-User-Uid`。
|
|
44
|
-
|
|
45
|
-
## 安全红线
|
|
46
|
-
|
|
47
|
-
- **禁止输出密钥**:`token` 不得出现在日志、消息、终端。
|
|
48
|
-
- **禁止自己拼 URL / 构造 HTTP 请求**:所有请求都走 `delta-cli`。
|
|
49
|
-
- **不要主动安装 CLI**:如果用户说没装,建议他去 README 或 install.sh,不要自己选安装方式。
|
|
50
|
-
- **写入/删除操作前确认意图**:`sandbox kill`、`sandbox finish`、`sandbox write` 等必须告诉用户影响。
|
|
51
|
-
- `~/.delta-infra/config.json` 权限为 `0600`,不要手动放宽。
|
|
52
|
-
- **sandbox 必须销毁**:调用 `sandbox create` 后,当前任务结束前必须调用 `sandbox kill`。server 端无自动清理,不销毁 = 永久占用 GPU;即使出错也不得跳过。
|
|
53
|
-
|
|
54
|
-
## JSON 输出约定
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
{"ok":true,"data":{...}}
|
|
58
|
-
{"ok":false,"error":{"type":"auth","message":"...","hint":"..."}}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
AI Agent 解析规则:
|
|
62
|
-
- 始终检查 `ok`,不要只看 exit code。
|
|
63
|
-
- `error.type` 是稳定分支字段:`auth`, `permission`, `not_found`, `validation`, `network`, `api`, `internal`。
|
|
64
|
-
- `error.hint` 可展示给用户。
|
|
65
|
-
|
|
66
|
-
## 退出码约定
|
|
67
|
-
|
|
68
|
-
| Type | Exit Code | 场景 |
|
|
69
|
-
|------|-----------|------|
|
|
70
|
-
| validation | 2 | flag / 参数错误 |
|
|
71
|
-
| auth | 3 | 未认证或认证失败 |
|
|
72
|
-
| permission | 4 | 权限不足 |
|
|
73
|
-
| not_found | 5 | sandbox/file 不存在 |
|
|
74
|
-
| network | 6 | DNS、超时、连接失败 |
|
|
75
|
-
| api | 7 | 服务端非 2xx |
|
|
76
|
-
| internal | 10 | 客户端内部错误 |
|
|
77
|
-
|
|
78
|
-
## 升级检查
|
|
79
|
-
|
|
80
|
-
完成用户请求后,如果 JSON 中有 `_notice.update`,可建议:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
delta-cli upgrade
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## 常见恢复
|
|
87
|
-
|
|
88
|
-
| 错误 / 现象 | 恢复动作 |
|
|
89
|
-
|-------------|----------|
|
|
90
|
-
| `error.type: auth` / `method: none` | 询问用户后执行 `config init --base-url <url> --token <token>` |
|
|
91
|
-
| `error.type: permission` | 确认当前认证是否有权限;必要时换 token |
|
|
92
|
-
| `error.type: not_found` | 检查 `sandbox_id` / path |
|
|
93
|
-
| `error.type: network` | 检查 `base_url` 和网络连通性 |
|
|
94
|
-
| `error.type: validation` | 检查必填 flag 和参数格式 |
|
|
95
|
-
| 配置文件解析失败 | 检查 `~/.delta-infra/config.json` 是否为有效 JSON |
|
|
1
|
+
---
|
|
2
|
+
name: delta-shared
|
|
3
|
+
description: "delta-cli 全局共享规则:配置/认证检查、安全红线、错误处理、sandbox 销毁。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# delta-cli 共享规则
|
|
7
|
+
|
|
8
|
+
指导 AI 使用 `delta-cli` 的通用规则。核心原则:**只检查、不猜测、不泄露密钥**。
|
|
9
|
+
|
|
10
|
+
## 执行任何操作之前
|
|
11
|
+
|
|
12
|
+
1. 确认服务端地址:
|
|
13
|
+
```bash
|
|
14
|
+
delta-cli config show
|
|
15
|
+
```
|
|
16
|
+
2. 确认认证状态:
|
|
17
|
+
```bash
|
|
18
|
+
delta-cli auth status
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- 若 `auth status` 显示 `method: token`,**直接执行目标命令**,不要重复登录或初始化配置。
|
|
22
|
+
- 若显示 `method: none`,或操作返回 `error.type: auth` / `permission`,才进入下面的“补全配置”流程。
|
|
23
|
+
|
|
24
|
+
## 补全配置
|
|
25
|
+
|
|
26
|
+
缺少服务端地址或凭证时,**向用户询问一次**,然后用 flag 初始化:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
delta-cli config init --base-url <server-url> --token <token>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
不要用交互式 `config init`(无 flag),避免在 stdin 不可用时卡住。
|
|
33
|
+
|
|
34
|
+
### 信息来源优先级
|
|
35
|
+
|
|
36
|
+
1. 环境变量:`DELTA_INFRA_BASE_URL`、`DELTA_INFRA_TOKEN`
|
|
37
|
+
2. `~/.delta-infra/config.json` 中的 `base_url` / `token`
|
|
38
|
+
3. 默认值:仅 `base_url` 有内部默认值
|
|
39
|
+
4. 以上都缺失时,**必须询问用户**,禁止虚构
|
|
40
|
+
|
|
41
|
+
### 运行时凭证
|
|
42
|
+
|
|
43
|
+
CLI 使用 `token` 发送请求头 `Authorization: Bearer <token>`,并自动从 JWT 中提取 `uid` 作为 `X-User-Uid`。
|
|
44
|
+
|
|
45
|
+
## 安全红线
|
|
46
|
+
|
|
47
|
+
- **禁止输出密钥**:`token` 不得出现在日志、消息、终端。
|
|
48
|
+
- **禁止自己拼 URL / 构造 HTTP 请求**:所有请求都走 `delta-cli`。
|
|
49
|
+
- **不要主动安装 CLI**:如果用户说没装,建议他去 README 或 install.sh,不要自己选安装方式。
|
|
50
|
+
- **写入/删除操作前确认意图**:`sandbox kill`、`sandbox finish`、`sandbox write` 等必须告诉用户影响。
|
|
51
|
+
- `~/.delta-infra/config.json` 权限为 `0600`,不要手动放宽。
|
|
52
|
+
- **sandbox 必须销毁**:调用 `sandbox create` 后,当前任务结束前必须调用 `sandbox kill`。server 端无自动清理,不销毁 = 永久占用 GPU;即使出错也不得跳过。
|
|
53
|
+
|
|
54
|
+
## JSON 输出约定
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{"ok":true,"data":{...}}
|
|
58
|
+
{"ok":false,"error":{"type":"auth","message":"...","hint":"..."}}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
AI Agent 解析规则:
|
|
62
|
+
- 始终检查 `ok`,不要只看 exit code。
|
|
63
|
+
- `error.type` 是稳定分支字段:`auth`, `permission`, `not_found`, `validation`, `network`, `api`, `internal`。
|
|
64
|
+
- `error.hint` 可展示给用户。
|
|
65
|
+
|
|
66
|
+
## 退出码约定
|
|
67
|
+
|
|
68
|
+
| Type | Exit Code | 场景 |
|
|
69
|
+
|------|-----------|------|
|
|
70
|
+
| validation | 2 | flag / 参数错误 |
|
|
71
|
+
| auth | 3 | 未认证或认证失败 |
|
|
72
|
+
| permission | 4 | 权限不足 |
|
|
73
|
+
| not_found | 5 | sandbox/file 不存在 |
|
|
74
|
+
| network | 6 | DNS、超时、连接失败 |
|
|
75
|
+
| api | 7 | 服务端非 2xx |
|
|
76
|
+
| internal | 10 | 客户端内部错误 |
|
|
77
|
+
|
|
78
|
+
## 升级检查
|
|
79
|
+
|
|
80
|
+
完成用户请求后,如果 JSON 中有 `_notice.update`,可建议:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
delta-cli upgrade
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 常见恢复
|
|
87
|
+
|
|
88
|
+
| 错误 / 现象 | 恢复动作 |
|
|
89
|
+
|-------------|----------|
|
|
90
|
+
| `error.type: auth` / `method: none` | 询问用户后执行 `config init --base-url <url> --token <token>` |
|
|
91
|
+
| `error.type: permission` | 确认当前认证是否有权限;必要时换 token |
|
|
92
|
+
| `error.type: not_found` | 检查 `sandbox_id` / path |
|
|
93
|
+
| `error.type: network` | 检查 `base_url` 和网络连通性 |
|
|
94
|
+
| `error.type: validation` | 检查必填 flag 和参数格式 |
|
|
95
|
+
| 配置文件解析失败 | 检查 `~/.delta-infra/config.json` 是否为有效 JSON |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Delta CLI
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Delta CLI 共享规则"
|
|
3
|
+
short_description: "处理 Delta CLI 的配置、认证、错误与安全边界"
|
|
4
|
+
default_prompt: "使用 $delta-shared 检查并处理 Delta CLI 的配置或认证问题。"
|
package/skills/gsasii/SKILL.md
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gsasii
|
|
3
|
-
description: 当用户要求使用真实 CIF 模拟粉末 XRD/中子衍射,或使用真实粉末数据、仪器参数与相模型执行 GSAS-II Rietveld 精修时使用。所有实时请求只走 Delta CLI wrapper;禁止伪造 CIF、粉末数据或仪器文件。
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
---
|
|
2
|
+
name: gsasii
|
|
3
|
+
description: 当用户要求使用真实 CIF 模拟粉末 XRD/中子衍射,或使用真实粉末数据、仪器参数与相模型执行 GSAS-II Rietveld 精修时使用。所有实时请求只走 Delta CLI wrapper;禁止伪造 CIF、粉末数据或仪器文件。
|
|
4
|
+
metadata:
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- read_file
|
|
7
|
+
- python_repl
|
|
8
|
+
- step_finish
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# GSAS-II 服务
|
|
12
|
+
|
|
13
|
+
## 强制规则
|
|
14
|
+
|
|
15
|
+
- 第一个且唯一实时执行工具是 `python_repl`,通过
|
|
16
|
+
`$SKILLS_ROOT/delta-science/scripts/invoke.py`,tool=`gsasii`。
|
|
17
|
+
- `python_repl` 工具参数只能包含 `code`,禁止 `deps/dependencies/packages`。
|
|
18
|
+
- 禁止 Bash、目录/路径探测、字面 CLI 命令、直接 HTTP 和本地 GSAS-II。
|
|
19
|
+
- 业务结果直接位于 `r["native"]`,禁止 `native.data`。
|
|
20
|
+
- 输入不是 CIF 时先由 pymatgen 成功转换;精修必须有真实 powder data、真实
|
|
21
|
+
instrument parameters 和真实 phase CIF,任何失败都不得用合成数据补齐。
|
|
22
|
+
|
|
23
|
+
## operation 选择
|
|
24
|
+
|
|
25
|
+
- `health`:明确检查服务状态,无 body。
|
|
26
|
+
- `powder-simulate`:最小有界请求包含 `cif`、`phase_name`、`radiation:"CuKa"`、
|
|
27
|
+
`t_min/t_max/t_step`、profile/reflection 开关和上限;`t_step` 与 `n_points` 二选一。
|
|
28
|
+
- `powder-refine`:包含 `powder_data`、`powder_format`、
|
|
29
|
+
`instrument_parameters`、`phases:[{name,cif}]`、`refinement_mode:"rietveld"`、
|
|
30
|
+
`refinement_steps`、`max_cycles` 和有界输出上限。
|
|
31
|
+
|
|
32
|
+
完整最小 payload 与字段见同级 `references/endpoints.md`。`pawley`/`lebail` 在当前
|
|
33
|
+
服务未实现时原样报告,不改成 rietveld。长 profile/reflections/project 不在最终答复
|
|
34
|
+
展开,只报告点数、范围、残差、警告和用户要求的有界字段。
|
|
35
|
+
|
|
36
|
+
## 调用与完成
|
|
37
|
+
|
|
38
|
+
在一个 `python_repl` 中用 `subprocess.run(..., shell=False)` 调 wrapper,使用
|
|
39
|
+
`--data-json`(health 省略),校验退出码、`ok=true`、`transport="delta-cli"`,
|
|
40
|
+
显式打印从 native 投影的有界 JSON。成功后立即
|
|
41
|
+
`step_finish(status="done", summary=<同一 JSON>)`;失败则 `status="failed"`。
|
|
42
|
+
只调用一次,不调试打印,不自动重试。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "GSAS-II
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GSAS-II 衍射分析"
|
|
3
|
+
short_description: "通过 Delta CLI 进行粉末衍射模拟或 Rietveld 精修"
|
|
4
|
+
default_prompt: "使用 $gsasii 完成这项粉末衍射模拟或精修任务。"
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
# GSAS-II Endpoint Reference
|
|
2
|
-
|
|
3
|
-
All paths are relative to `http://111.2.199.31:52317/api/v1`.
|
|
4
|
-
|
|
5
|
-
## Health
|
|
6
|
-
|
|
7
|
-
`GET /chem/gsasii/health`
|
|
8
|
-
|
|
9
|
-
Key response fields in `data`: `status`, `service`, `gsasii_available`,
|
|
10
|
-
`metadata`, and `limits`.
|
|
11
|
-
|
|
12
|
-
Use this before long simulations/refinements. A healthy service should report
|
|
13
|
-
`data.status == "ok"` and `data.gsasii_available == true`.
|
|
14
|
-
|
|
15
|
-
## Powder Simulation
|
|
16
|
-
|
|
17
|
-
`POST /chem/gsasii/powder/simulate`
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"cif": "<CIF text>",
|
|
22
|
-
"phase_name": "phase",
|
|
23
|
-
"instrument_parameters": "<GSAS-II instrument parameter text>",
|
|
24
|
-
"histogram_name": "simulation",
|
|
25
|
-
"t_min": 10.0,
|
|
26
|
-
"t_max": 80.0,
|
|
27
|
-
"t_step": 0.02,
|
|
28
|
-
"include_profile": true,
|
|
29
|
-
"max_profile_points": 1000,
|
|
30
|
-
"include_reflections": true,
|
|
31
|
-
"max_reflections": 1000,
|
|
32
|
-
"return_refined_cif": false,
|
|
33
|
-
"return_project": false
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Use either `t_step` or `n_points`, not both. Optional fields include
|
|
38
|
-
`wavelength`, `radiation`, `scale`, `include_profile`, `max_profile_points`,
|
|
39
|
-
`include_reflections`, `max_reflections`, `return_refined_cif`, and
|
|
40
|
-
`return_project`.
|
|
41
|
-
|
|
42
|
-
The response includes `profile` points with `x`, `y_calc`, optional background,
|
|
43
|
-
bounded `reflections` with hkl/d-spacing/2theta where available, and metadata.
|
|
44
|
-
If `return_project` is true, `project_base64` contains the GSAS-II `.gpx`
|
|
45
|
-
project. If `return_refined_cif` is true, `refined_cif` contains exported CIF
|
|
46
|
-
text for pymatgen handoff when GSAS-II supports export for the phase.
|
|
47
|
-
|
|
48
|
-
Notes:
|
|
49
|
-
|
|
50
|
-
- `cif` should be valid CIF text. If the input is POSCAR/JSON/CSSR/XSF, use
|
|
51
|
-
`/chem/pymatgen/structure/convert` first with `output_format: "cif"`.
|
|
52
|
-
- `instrument_parameters` should be GSAS-II instrument parameter text such as
|
|
53
|
-
`INST_XRY.PRM` when instrument-specific simulation is needed.
|
|
54
|
-
- For quick simulation only, `instrument_parameters` may be omitted. The service
|
|
55
|
-
then generates a simple CW X-ray instrument model from `wavelength` or
|
|
56
|
-
`radiation` (`CuKa` by default; also supports aliases such as `MoKa`, `CoKa`,
|
|
57
|
-
`CrKa`, and explicit numeric wavelength).
|
|
58
|
-
- Refinement still requires real `instrument_parameters`.
|
|
59
|
-
- `max_profile_points` controls response sampling. Use small values for smoke
|
|
60
|
-
tests and larger values for profile comparison.
|
|
61
|
-
- Older deployed gateway images may require `max_profile_points >= 10`.
|
|
62
|
-
|
|
63
|
-
## Powder Refinement
|
|
64
|
-
|
|
65
|
-
`POST /chem/gsasii/powder/refine`
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"powder_data": "<two-column or three-column powder data text>",
|
|
70
|
-
"powder_format": "xy",
|
|
71
|
-
"instrument_parameters": "<GSAS-II instrument parameter text>",
|
|
72
|
-
"phases": [
|
|
73
|
-
{"name": "phase", "cif": "<CIF text>"}
|
|
74
|
-
],
|
|
75
|
-
"refinement_mode": "rietveld",
|
|
76
|
-
"refinement_steps": [],
|
|
77
|
-
"max_cycles": 3,
|
|
78
|
-
"histogram_name": "powder",
|
|
79
|
-
"include_profile": true,
|
|
80
|
-
"max_profile_points": 1000,
|
|
81
|
-
"include_reflections": true,
|
|
82
|
-
"max_reflections": 1000,
|
|
83
|
-
"return_refined_cif": false,
|
|
84
|
-
"return_project": false
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Supported `powder_format` values: `xy`, `xye`, `fxye`, `gsas`, and `csv`.
|
|
89
|
-
|
|
90
|
-
`refinement_mode: "rietveld"` is currently implemented. `pawley` and `lebail`
|
|
91
|
-
return a clear not-implemented response until the service wires the
|
|
92
|
-
mode-specific GSAS-II setup.
|
|
93
|
-
|
|
94
|
-
The response includes fit `residuals` when available, phase summaries, sampled
|
|
95
|
-
profile points, bounded `reflections`, warnings, optional `refined_cif`, and
|
|
96
|
-
the optional `.gpx` project.
|
|
97
|
-
|
|
98
|
-
Notes:
|
|
99
|
-
|
|
100
|
-
- Use `xy` for simple whitespace-delimited `x y` rows, `xye` for `x y esd`,
|
|
101
|
-
`csv` for numeric comma-separated rows, or `gsas`/`fxye` for GSAS-like powder
|
|
102
|
-
formats.
|
|
103
|
-
- `max_cycles: 0` is useful for project-construction smoke tests. Increase it
|
|
104
|
-
only when the powder data, phase model, instrument file, and refinement steps
|
|
105
|
-
are realistic.
|
|
106
|
-
- `refinement_steps` is passed to `G2Project.do_refinements`. Keep recipes
|
|
107
|
-
incremental and inspect `warnings`, `residuals`, and `lst` output.
|
|
108
|
-
- Refinement may return `valid: false` with partial phase/profile information
|
|
109
|
-
if GSAS-II constructed the project but a refinement step failed.
|
|
110
|
-
|
|
111
|
-
## Recommended Integration Scripts
|
|
112
|
-
|
|
113
|
-
From this skill's `scripts/` directory:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
python3 scripts/smoke_gsasii.py
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Runs health, PbSO4 powder simulation, and project-return smoke tests.
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
python3 scripts/workflow_pymatgen_gsasii.py
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Runs the cross-service workflow:
|
|
126
|
-
|
|
127
|
-
```text
|
|
128
|
-
pymatgen summary/symmetry -> pymatgen CIF conversion -> GSAS-II simulation
|
|
129
|
-
-> profile comparison -> GSAS-II refinement -> pymatgen final check
|
|
130
|
-
```
|
|
1
|
+
# GSAS-II Endpoint Reference
|
|
2
|
+
|
|
3
|
+
All paths are relative to `http://111.2.199.31:52317/api/v1`.
|
|
4
|
+
|
|
5
|
+
## Health
|
|
6
|
+
|
|
7
|
+
`GET /chem/gsasii/health`
|
|
8
|
+
|
|
9
|
+
Key response fields in `data`: `status`, `service`, `gsasii_available`,
|
|
10
|
+
`metadata`, and `limits`.
|
|
11
|
+
|
|
12
|
+
Use this before long simulations/refinements. A healthy service should report
|
|
13
|
+
`data.status == "ok"` and `data.gsasii_available == true`.
|
|
14
|
+
|
|
15
|
+
## Powder Simulation
|
|
16
|
+
|
|
17
|
+
`POST /chem/gsasii/powder/simulate`
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"cif": "<CIF text>",
|
|
22
|
+
"phase_name": "phase",
|
|
23
|
+
"instrument_parameters": "<GSAS-II instrument parameter text>",
|
|
24
|
+
"histogram_name": "simulation",
|
|
25
|
+
"t_min": 10.0,
|
|
26
|
+
"t_max": 80.0,
|
|
27
|
+
"t_step": 0.02,
|
|
28
|
+
"include_profile": true,
|
|
29
|
+
"max_profile_points": 1000,
|
|
30
|
+
"include_reflections": true,
|
|
31
|
+
"max_reflections": 1000,
|
|
32
|
+
"return_refined_cif": false,
|
|
33
|
+
"return_project": false
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use either `t_step` or `n_points`, not both. Optional fields include
|
|
38
|
+
`wavelength`, `radiation`, `scale`, `include_profile`, `max_profile_points`,
|
|
39
|
+
`include_reflections`, `max_reflections`, `return_refined_cif`, and
|
|
40
|
+
`return_project`.
|
|
41
|
+
|
|
42
|
+
The response includes `profile` points with `x`, `y_calc`, optional background,
|
|
43
|
+
bounded `reflections` with hkl/d-spacing/2theta where available, and metadata.
|
|
44
|
+
If `return_project` is true, `project_base64` contains the GSAS-II `.gpx`
|
|
45
|
+
project. If `return_refined_cif` is true, `refined_cif` contains exported CIF
|
|
46
|
+
text for pymatgen handoff when GSAS-II supports export for the phase.
|
|
47
|
+
|
|
48
|
+
Notes:
|
|
49
|
+
|
|
50
|
+
- `cif` should be valid CIF text. If the input is POSCAR/JSON/CSSR/XSF, use
|
|
51
|
+
`/chem/pymatgen/structure/convert` first with `output_format: "cif"`.
|
|
52
|
+
- `instrument_parameters` should be GSAS-II instrument parameter text such as
|
|
53
|
+
`INST_XRY.PRM` when instrument-specific simulation is needed.
|
|
54
|
+
- For quick simulation only, `instrument_parameters` may be omitted. The service
|
|
55
|
+
then generates a simple CW X-ray instrument model from `wavelength` or
|
|
56
|
+
`radiation` (`CuKa` by default; also supports aliases such as `MoKa`, `CoKa`,
|
|
57
|
+
`CrKa`, and explicit numeric wavelength).
|
|
58
|
+
- Refinement still requires real `instrument_parameters`.
|
|
59
|
+
- `max_profile_points` controls response sampling. Use small values for smoke
|
|
60
|
+
tests and larger values for profile comparison.
|
|
61
|
+
- Older deployed gateway images may require `max_profile_points >= 10`.
|
|
62
|
+
|
|
63
|
+
## Powder Refinement
|
|
64
|
+
|
|
65
|
+
`POST /chem/gsasii/powder/refine`
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"powder_data": "<two-column or three-column powder data text>",
|
|
70
|
+
"powder_format": "xy",
|
|
71
|
+
"instrument_parameters": "<GSAS-II instrument parameter text>",
|
|
72
|
+
"phases": [
|
|
73
|
+
{"name": "phase", "cif": "<CIF text>"}
|
|
74
|
+
],
|
|
75
|
+
"refinement_mode": "rietveld",
|
|
76
|
+
"refinement_steps": [],
|
|
77
|
+
"max_cycles": 3,
|
|
78
|
+
"histogram_name": "powder",
|
|
79
|
+
"include_profile": true,
|
|
80
|
+
"max_profile_points": 1000,
|
|
81
|
+
"include_reflections": true,
|
|
82
|
+
"max_reflections": 1000,
|
|
83
|
+
"return_refined_cif": false,
|
|
84
|
+
"return_project": false
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Supported `powder_format` values: `xy`, `xye`, `fxye`, `gsas`, and `csv`.
|
|
89
|
+
|
|
90
|
+
`refinement_mode: "rietveld"` is currently implemented. `pawley` and `lebail`
|
|
91
|
+
return a clear not-implemented response until the service wires the
|
|
92
|
+
mode-specific GSAS-II setup.
|
|
93
|
+
|
|
94
|
+
The response includes fit `residuals` when available, phase summaries, sampled
|
|
95
|
+
profile points, bounded `reflections`, warnings, optional `refined_cif`, and
|
|
96
|
+
the optional `.gpx` project.
|
|
97
|
+
|
|
98
|
+
Notes:
|
|
99
|
+
|
|
100
|
+
- Use `xy` for simple whitespace-delimited `x y` rows, `xye` for `x y esd`,
|
|
101
|
+
`csv` for numeric comma-separated rows, or `gsas`/`fxye` for GSAS-like powder
|
|
102
|
+
formats.
|
|
103
|
+
- `max_cycles: 0` is useful for project-construction smoke tests. Increase it
|
|
104
|
+
only when the powder data, phase model, instrument file, and refinement steps
|
|
105
|
+
are realistic.
|
|
106
|
+
- `refinement_steps` is passed to `G2Project.do_refinements`. Keep recipes
|
|
107
|
+
incremental and inspect `warnings`, `residuals`, and `lst` output.
|
|
108
|
+
- Refinement may return `valid: false` with partial phase/profile information
|
|
109
|
+
if GSAS-II constructed the project but a refinement step failed.
|
|
110
|
+
|
|
111
|
+
## Recommended Integration Scripts
|
|
112
|
+
|
|
113
|
+
From this skill's `scripts/` directory:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
python3 scripts/smoke_gsasii.py
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Runs health, PbSO4 powder simulation, and project-return smoke tests.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python3 scripts/workflow_pymatgen_gsasii.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Runs the cross-service workflow:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
pymatgen summary/symmetry -> pymatgen CIF conversion -> GSAS-II simulation
|
|
129
|
+
-> profile comparison -> GSAS-II refinement -> pymatgen final check
|
|
130
|
+
```
|
package/skills/lammps/SKILL.md
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: lammps
|
|
3
|
-
description: 当用户要求检查 LAMMPS 服务、运行部署自带的有界 LJ melt 示例,或使用明确的 LAMMPS input/data/force-field 配置执行分子动力学、最小化并读取 thermo/log/dump/data 输出时使用。所有实时调用只走 Delta CLI;成功执行不代表物理收敛或生产可用。
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- `
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
---
|
|
2
|
+
name: lammps
|
|
3
|
+
description: 当用户要求检查 LAMMPS 服务、运行部署自带的有界 LJ melt 示例,或使用明确的 LAMMPS input/data/force-field 配置执行分子动力学、最小化并读取 thermo/log/dump/data 输出时使用。所有实时调用只走 Delta CLI;成功执行不代表物理收敛或生产可用。
|
|
4
|
+
metadata:
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- read_file
|
|
7
|
+
- python_repl
|
|
8
|
+
- step_finish
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# LAMMPS 服务
|
|
12
|
+
|
|
13
|
+
## 强制规则
|
|
14
|
+
|
|
15
|
+
- 第一个且唯一实时执行工具是 `python_repl`,通过
|
|
16
|
+
`$SKILLS_ROOT/delta-science/scripts/invoke.py`,tool=`lammps`。
|
|
17
|
+
- `python_repl` 工具参数只能包含 `code`,禁止 `deps/dependencies/packages`。
|
|
18
|
+
- 禁止 Bash、路径探测、字面 CLI 命令、直接 HTTP、本地 LAMMPS 和本地回归替代。
|
|
19
|
+
- 业务结果是 `r["native"]`,禁止 `native.data` 或把外层 envelope 交给 `run`。
|
|
20
|
+
- LAMMPS 不从化学式、CIF 或 POSCAR 自动推断 data、原子类型、势函数与边界条件。
|
|
21
|
+
|
|
22
|
+
## operation 选择
|
|
23
|
+
|
|
24
|
+
- `health`:明确健康检查,无 body。
|
|
25
|
+
- `lj-melt-example`:返回部署自带的精确 `native["request"]`,本身不执行模拟。
|
|
26
|
+
- `run`:只接受前一步已验证的 `native["request"]`,或用户明确提供的
|
|
27
|
+
`input_script`、相对路径 `files`、timeout 与有界输出设置。
|
|
28
|
+
|
|
29
|
+
用户说“用最小示例测试 LAMMPS”时,在同一个 `python_repl` 中严格执行两次依赖调用:
|
|
30
|
+
先 `lj-melt-example`,再把其 `request` 原样作为 `run` 的 `--data-json`。不增加 health、
|
|
31
|
+
日志探测或本地可执行文件检查。普通明确 run 只调用一次。
|
|
32
|
+
|
|
33
|
+
最终只逐字复制当前 native 的 `last_thermo`、final step/temperature/total energy、
|
|
34
|
+
warnings 和用户要求的输出文件摘要。禁止能量除以原子数、换算单位、替换步数或推断
|
|
35
|
+
收敛性/稳定性。详细 run schema 见 `references/endpoints.md`。
|
|
36
|
+
|
|
37
|
+
显式打印有界 JSON 后立即调用
|
|
38
|
+
`step_finish(status="done", summary=<同一 JSON>)` 恰好一次;失败或 timeout 调用
|
|
39
|
+
`step_finish(status="failed", summary=<原始错误短摘要>)`,禁止重试和后续工具。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "LAMMPS
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "LAMMPS 分子动力学"
|
|
3
|
+
short_description: "通过 Delta CLI 运行有界分子动力学和能量最小化"
|
|
4
|
+
default_prompt: "使用 $lammps 运行这项分子动力学任务并报告关键结果。"
|