@delta-infra/cli 1.0.96 → 1.0.97
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 +471 -471
- package/checksums.txt +5 -5
- package/package.json +1 -1
- package/scripts/install-wizard.js +701 -701
- package/scripts/install.js +442 -442
- package/scripts/run.js +65 -65
- package/skills/delta-sandbox/SKILL.md +356 -345
- package/skills/delta-sandbox/agents/openai.yaml +4 -4
- package/skills/delta-sandbox/references/commands.md +56 -58
- package/skills/delta-sandbox/references/lifecycle.md +92 -98
- package/skills/delta-sandbox/references/recipes.md +133 -138
- package/skills/delta-science/AGENTS.md +49 -49
- package/skills/delta-science/SKILL.md +141 -129
- package/skills/delta-science/agents/openai.yaml +4 -4
- package/skills/delta-science/references/antbo.md +100 -100
- package/skills/delta-science/references/cli-contract.md +53 -53
- package/skills/delta-science/references/delta-bo.md +89 -89
- package/skills/delta-science/references/generated-catalog.md +48 -0
- package/skills/delta-science/references/gsasii.md +116 -116
- package/skills/delta-science/references/lammps.md +66 -66
- package/skills/delta-science/references/ldm-bo.md +129 -129
- package/skills/delta-science/references/ldm.md +73 -73
- package/skills/delta-science/references/materials-design.md +109 -0
- package/skills/delta-science/references/molecule-enrich.md +59 -0
- package/skills/delta-science/references/operation-contracts.md +137 -0
- package/skills/delta-science/references/pubchem.md +126 -126
- package/skills/delta-science/references/pymatgen.md +68 -68
- package/skills/delta-science/references/qe-dft.md +123 -0
- package/skills/delta-science/references/rdkit.md +138 -138
- package/skills/delta-science/references/routing-index.md +35 -26
- package/skills/delta-science/references/services.md +112 -0
- package/skills/delta-science/references/strbo.md +87 -87
- package/skills/delta-science/references/synbo.md +198 -198
- package/skills/delta-science/references/workflows.md +86 -49
- package/skills/delta-science/scripts/catalog.py +92 -0
- package/skills/delta-science/scripts/generated_catalog.py +69 -0
- package/skills/delta-science/scripts/invoke.py +346 -0
- package/skills/delta-shared/SKILL.md +95 -97
- package/skills/delta-shared/agents/openai.yaml +4 -4
- package/skills/manifest.json +19 -19
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Delta Science operation 最小契约
|
|
2
|
+
|
|
3
|
+
本文只记录当前 CLI catalog 已暴露的 9 个 tools、42 个 operations。选择 operation 后
|
|
4
|
+
只读取对应小节。代码示例均在同一个 `python_repl` 中先定义以下函数;禁止 Bash、
|
|
5
|
+
目录探测、直接 HTTP 和字面 CLI 命令。
|
|
6
|
+
|
|
7
|
+
调用 `python_repl` 时工具参数必须严格为 `{"code":"..."}`;禁止添加 `deps`、
|
|
8
|
+
`dependencies`、`packages` 或任何其他字段。
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
import json, os, subprocess, sys
|
|
12
|
+
|
|
13
|
+
wrapper = os.path.join(os.environ["SKILLS_ROOT"], "delta-science", "scripts", "invoke.py")
|
|
14
|
+
|
|
15
|
+
def invoke(tool, endpoint, data=None, params=None):
|
|
16
|
+
argv = [sys.executable, wrapper, "--tool", tool, "--endpoint", endpoint]
|
|
17
|
+
if data is not None:
|
|
18
|
+
argv += ["--data-json", json.dumps(data)]
|
|
19
|
+
if params is not None:
|
|
20
|
+
argv += ["--params-json", json.dumps(params)]
|
|
21
|
+
p = subprocess.run(argv, capture_output=True, text=True, shell=False)
|
|
22
|
+
if p.returncode != 0:
|
|
23
|
+
raise RuntimeError(p.stderr or p.stdout)
|
|
24
|
+
r = json.loads(p.stdout)
|
|
25
|
+
if r.get("ok") is not True or r.get("transport") != "delta-cli":
|
|
26
|
+
raise RuntimeError(r)
|
|
27
|
+
return r["native"]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
每个代码示例只调用一次。将返回值投影成用户要求的有界 JSON 并显式 `print`,然后
|
|
31
|
+
调用 `step_finish(status="done", summary=<同一 JSON>)` 恰好一次。失败则
|
|
32
|
+
`step_finish(status="failed", summary=<原始错误短摘要>)`,禁止重试或改走其他链路。
|
|
33
|
+
|
|
34
|
+
## PubChem(tool=`pubchem`)
|
|
35
|
+
|
|
36
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `health` | “PubChem 服务现在能用吗?” | `n=invoke("pubchem","health")` | status、availability、metadata、limits、warnings |
|
|
39
|
+
| `compound-resolve-cids` | “把 aspirin 解析成 CID。” | `n=invoke("pubchem","compound-resolve-cids",data={"identifier":"aspirin","namespace":"name","max_records":20})` | identifier、valid、cids、error |
|
|
40
|
+
| `compound-properties` | “查 aspirin 的分子式和分子量。” | `n=invoke("pubchem","compound-properties",data={"identifier":"aspirin","namespace":"name","properties":["MolecularFormula","MolecularWeight"]})` | cid、valid、properties、aliases、error |
|
|
41
|
+
| `compound-synonyms` | “列出 aspirin 的前 5 个同义词。” | `n=invoke("pubchem","compound-synonyms",data={"identifier":"aspirin","namespace":"name","max_synonyms":5})` | cid、valid、synonyms、error |
|
|
42
|
+
| `compound-summary` | “查阿司匹林的基础身份信息。” | `n=invoke("pubchem","compound-summary",data={"identifier":"aspirin","namespace":"name"})` | valid、cid、properties 中用户要求的键 |
|
|
43
|
+
| `compound-batch-summary` | “一次比较 aspirin 和 caffeine 的基础属性。” | `n=invoke("pubchem","compound-batch-summary",data={"identifiers":["aspirin","caffeine"],"namespace":"name"})` | results[*].input、valid/error、properties |
|
|
44
|
+
|
|
45
|
+
## RDKit(tool=`rdkit`)
|
|
46
|
+
|
|
47
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `health` | “RDKit 服务可用吗?” | `n=invoke("rdkit","health")` | status、availability、metadata、limits、warnings |
|
|
50
|
+
| `parse` | “这个 SMILES 合法吗?” | `n=invoke("rdkit","parse",data={"input":"CCO","format":"smiles","sanitize":True})` | valid、canonical_smiles、formula、inchi_key、warnings/error |
|
|
51
|
+
| `descriptors` | “计算乙醇的基础 RDKit 描述符。” | `n=invoke("rdkit","descriptors",data={"smiles":"CCO","descriptor_set":"basic","sanitize":True})` | valid、descriptors、warnings/error |
|
|
52
|
+
| `batch-descriptors` | “批量算几个 SMILES 的描述符。” | `n=invoke("rdkit","batch-descriptors",data={"smiles":["CCO","c1ccccc1"],"descriptor_set":"basic","sanitize":True})` | results 中输入、valid、descriptors、error |
|
|
53
|
+
| `batch-parse-describe` | “校验阿司匹林并给基础描述符。” | `n=invoke("rdkit","batch-parse-describe",data={"molecules":[{"id":"aspirin","smiles":"CC(=O)OC1=CC=CC=C1C(=O)O"}],"descriptor_set":"basic","sanitize":True})` | results[*].id、valid、canonical_smiles、descriptors、warnings/error |
|
|
54
|
+
| `render` | “画一张乙醇结构图。” | `n=invoke("rdkit","render",data={"smiles":"CCO","image_format":"png","width":500,"height":400})` | 指定图像字段;PNG 解码后验证 magic bytes |
|
|
55
|
+
| `fingerprint` | “生成乙醇 Morgan 指纹。” | `n=invoke("rdkit","fingerprint",data={"smiles":"CCO","radius":2,"n_bits":2048})` | valid、fingerprint_metadata、on_bits、warnings/error |
|
|
56
|
+
| `similarity` | “比较乙醇和乙胺的结构相似度。” | `n=invoke("rdkit","similarity",data={"query_smiles":"CCO","target_smiles":"CCN","radius":2,"n_bits":2048})` | similarity、metric、fingerprint metadata |
|
|
57
|
+
| `similarity-matrix` | “比较一组分子的两两相似度。” | `n=invoke("rdkit","similarity-matrix",data={"molecules":[{"id":"a","smiles":"CCO"},{"id":"b","smiles":"CCN"}],"fingerprint":{"type":"morgan","radius":2,"n_bits":2048},"sanitize":True})` | matrix、ranked_pairs[{a,b,similarity}] |
|
|
58
|
+
| `substructure` | “筛出含羧酸子结构的分子。” | `n=invoke("rdkit","substructure",data={"query_smarts":"C(=O)O","target_smiles":["CC(=O)O","CCO"]})` | query 与每个目标的 match/matches、valid/error |
|
|
59
|
+
|
|
60
|
+
## pymatgen(tool=`pymatgen`)
|
|
61
|
+
|
|
62
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
63
|
+
| --- | --- | --- | --- |
|
|
64
|
+
| `health` | “pymatgen 服务是否正常?” | `n=invoke("pymatgen","health")` | status、availability、metadata、limits、warnings |
|
|
65
|
+
| `composition-parse` | “解析 LiFePO4 的组成和式量。” | `n=invoke("pymatgen","composition-parse",data={"formula":"LiFePO4","format":"formula"})` | valid、formula、reduced_formula、chemical_system、weight、element_amounts |
|
|
66
|
+
| `structure-parse` | “校验这段 CIF 能否解析。” | `n=invoke("pymatgen","structure-parse",data={"input":cif_text,"format":"cif","primitive":False})` | valid、formula、nsites、lattice、warnings/error |
|
|
67
|
+
| `structure-summary` | “总结这段 CIF 的结构信息。” | `n=invoke("pymatgen","structure-summary",data={"input":cif_text,"format":"cif","primitive":False})` | formula、reduced_formula、density、volume、lattice、species |
|
|
68
|
+
| `structure-convert` | “把 CIF 转成 POSCAR。” | `n=invoke("pymatgen","structure-convert",data={"input":cif_text,"input_format":"cif","output_format":"poscar","primitive":False})` | valid、output_format、转换后的结构文本、warnings/error |
|
|
69
|
+
| `structure-symmetry` | “分析这段 CIF 的空间群。” | `n=invoke("pymatgen","structure-symmetry",data={"input":cif_text,"format":"cif","primitive":False,"symprec":0.01,"angle_tolerance":5.0})` | space_group_symbol/number、crystal_system、point_group_symbol、hall、nsites |
|
|
70
|
+
|
|
71
|
+
## GSAS-II(tool=`gsasii`)
|
|
72
|
+
|
|
73
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| `health` | “GSAS-II 服务能做衍射计算吗?” | `n=invoke("gsasii","health")` | status、gsasii_available、metadata、limits、warnings |
|
|
76
|
+
| `powder-simulate` | “用这个 CIF 模拟 Cu Kα 粉末衍射。” | `n=invoke("gsasii","powder-simulate",data={"cif":cif_text,"phase_name":"phase","radiation":"CuKa","t_min":10.0,"t_max":80.0,"t_step":0.02,"include_profile":True,"max_profile_points":1000,"include_reflections":True,"max_reflections":1000,"return_refined_cif":False,"return_project":False})` | valid、profile、reflections、metadata、warnings |
|
|
77
|
+
| `powder-refine` | “用真实粉末数据和仪器文件做 Rietveld 精修。” | `n=invoke("gsasii","powder-refine",data={"powder_data":powder_text,"powder_format":"xy","instrument_parameters":instrument_text,"phases":[{"name":"phase","cif":cif_text}],"refinement_mode":"rietveld","refinement_steps":[],"max_cycles":3,"histogram_name":"powder","include_profile":True,"max_profile_points":1000,"include_reflections":True,"max_reflections":1000,"return_refined_cif":False,"return_project":False})` | valid、residuals、phase summaries、profile、reflections、warnings |
|
|
78
|
+
|
|
79
|
+
## LAMMPS(tool=`lammps`)
|
|
80
|
+
|
|
81
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
| `health` | “LAMMPS 服务可用吗?” | `n=invoke("lammps","health")` | status、lammps_available、metadata、limits、warnings |
|
|
84
|
+
| `lj-melt-example` | “给我跑部署自带的最小 LJ 示例做检查。” | `n=invoke("lammps","lj-melt-example")` | 示例说明与精确 `request`;此调用本身不执行模拟 |
|
|
85
|
+
| `run` | “执行刚才返回的最小 LJ 请求。” | `example=invoke("lammps","lj-melt-example"); n=invoke("lammps","run",data=example["request"])` | valid、last_thermo、thermo rows、warnings、请求的输出文件;此场景固定两次依赖调用 |
|
|
86
|
+
|
|
87
|
+
`run` 也可接收用户明确提供的 `input_script`、相对路径 files、timeout 和有界输出配置;
|
|
88
|
+
不得从化学式猜力场。长任务需明确授权,失败后不得重试。
|
|
89
|
+
|
|
90
|
+
## Delta-BO(tool=`delta-bo`)
|
|
91
|
+
|
|
92
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| `commands` | “当前 Delta-BO 支持哪些命令?” | `n=invoke("delta-bo","commands")` | 当前部署返回的命令列表,不从旧文档补充 |
|
|
95
|
+
| `generate` | “在 0 到 1 之间给两个随机初始实验点。” | `n=invoke("delta-bo","generate",data={"params":[{"name":"x","type":"numeric","low":0.0,"high":1.0}],"num_suggestions":2,"algorithm":"random-search","seed":42})` | suggestions、suggestion_metadata、warnings、diversity |
|
|
96
|
+
|
|
97
|
+
有历史观测且用户明确要求 BO 时,`generate` 可加入 objectives、object-form histories、
|
|
98
|
+
model/acquisition/solver;历史少于 5 条默认 random-search,不编造观测。
|
|
99
|
+
|
|
100
|
+
## LDM-BO(tool=`ldm-bo`)
|
|
101
|
+
|
|
102
|
+
只用于小分子 SMILES/PDF2Dock,不用于抗体、CDRH3 或 AntBO。
|
|
103
|
+
|
|
104
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| `health` | “分子 LDM-BO 服务可用吗?” | `n=invoke("ldm-bo","health")` | availability、Vina/ReaSyn/模型/LLM 配置状态、warnings |
|
|
107
|
+
| `recommend` | “从候选池给下一条小分子 SMILES。” | `n=invoke("ldm-bo","recommend",data={"method":"bo-tanimoto","pool":["CCO","CCN","CCC"],"history":[{"smiles":"CCO","scores":[-7.1]},{"smiles":"CCN","scores":[-6.8]}],"batch_size":1})` | recommendations、acquisition_values、n_objectives、llm diagnostics |
|
|
108
|
+
| `trajectory` | “跑一个有界的小分子 BO 轨迹。” | `n=invoke("ldm-bo","trajectory",data={"method":"bo-tanimoto","seed":42,"seed-smiles":"CCO,CCN,CCC","num-evaluations":4,"batch-size":1,"objective":"vina+nn"})` | config、history、summary、llm_trajectory;保留连字符字段 |
|
|
109
|
+
|
|
110
|
+
## SynBO(tool=`synbo`)
|
|
111
|
+
|
|
112
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
113
|
+
| --- | --- | --- | --- |
|
|
114
|
+
| `health` | “SynBO 服务当前可用吗?” | `n=invoke("synbo","health")` | status、synbo_available、metadata、limits、runtime、warnings |
|
|
115
|
+
| `initialize` | “没有实验历史,先选三组反应条件。” | `n=invoke("synbo","initialize",data={"condition_dict":{"catalyst":["Pd(OAc)2","Pd(PPh3)4"],"solvent":["THF","Toluene"],"base":["K2CO3","DBU"]},"opt_metrics":["yield"],"opt_metric_settings":[{"opt_direct":"max","opt_range":[0,100],"metric_weight":1.0}],"batch_size":3,"sampling_method":"random","desc_normalize":"minmax","random_seed":42})` | recommendations/initial conditions、warnings、metadata |
|
|
116
|
+
| `optimize` | “根据真实历史收率推荐下一批条件。” | `n=invoke("synbo","optimize",data={"condition_dict":{"catalyst":["Pd(OAc)2","Pd(PPh3)4","Pd2(dba)3"],"solvent":["THF","Dioxane","Toluene"],"base":["K2CO3","NaOEt","DBU"]},"opt_metrics":["yield"],"previous_results":[{"batch":0,"catalyst":"Pd(OAc)2","solvent":"THF","base":"K2CO3","yield":42.0},{"batch":0,"catalyst":"Pd(PPh3)4","solvent":"Dioxane","base":"NaOEt","yield":55.0},{"batch":0,"catalyst":"Pd2(dba)3","solvent":"Toluene","base":"DBU","yield":63.0}],"batch_size":2,"accuracy":"tiny","device":"cpu","random_seed":42})` | recommendations、model/acquisition metadata、warnings;失败/空结果不得本地替代 |
|
|
117
|
+
|
|
118
|
+
## AntBO(tool=`antbo`)
|
|
119
|
+
|
|
120
|
+
抗体/CDRH3 场景即使出现 “LDM” 也必须路由到 AntBO,不得改用分子 LDM-BO。
|
|
121
|
+
|
|
122
|
+
| operation | 人类情景 | 最小代码 | native 投影 |
|
|
123
|
+
| --- | --- | --- | --- |
|
|
124
|
+
| `health` | “AntBO 环境可用吗?” | `n=invoke("antbo","health")` | status、antbo_available、metadata、limits、warnings |
|
|
125
|
+
| `run-default-job` | “启动标准 AntBO 后台任务。” | `n=invoke("antbo","run-default-job",params={"log_name":"antbo_<唯一时间戳>.log","append":False,"timeout_seconds":86400})` | started、pid、log_name/log_path、timeout_seconds |
|
|
126
|
+
| `run` | “用明确的受限配置同步跑一次 AntBO。” | `n=invoke("antbo","run",data={"script_path":"./bo/main.py","config_path":"./bo/config.yaml","n_trials":1,"seed":42,"antigens_file":"<项目根内路径>","extra_args":[],"timeout_seconds":86400,"cuda_visible_devices":"0","conda_env":"DGM","log_name":"antbo_custom.log","append":False})` | ok、returncode、timed_out、log_path、log_truncated |
|
|
127
|
+
| `log` | “查看 antbo_run.log 的尾部。” | `n=invoke("antbo","log",params={"log_name":"antbo_run.log"})` | log_name、log、log_truncated |
|
|
128
|
+
| `jobs` | “查看当前活动 AntBO 作业。” | `n=invoke("antbo","jobs")` | jobs[*].pid/running/returncode/log_name/log_path |
|
|
129
|
+
| `stop` | “停止 PID 12345。” | `n=invoke("antbo","stop",params={"pid":12345})` | stopped、pid、message |
|
|
130
|
+
|
|
131
|
+
`run-default-job`、`run`、`stop` 是远程变更,必须有用户明确授权,未知结果不得重试。
|
|
132
|
+
AntBO `ldm/suggest`、`ldm/initialize`、`ldm/evaluate` 当前不在 catalog:不调用工具,
|
|
133
|
+
固定报告“未暴露该 operation;未发送远端请求”。
|
|
134
|
+
|
|
135
|
+
注意:AntBO `health` 可能公布公司服务内部的 `ldm_suggest` 等 endpoint,但它们并不
|
|
136
|
+
因此成为 Delta CLI operation;禁止调用不存在的 `antbo/catalog`,也禁止根据 health
|
|
137
|
+
为 Memento 推导新的 endpoint。
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
# PubChem 详细规则
|
|
2
|
-
|
|
3
|
-
只能通过 `delta-cli science invoke` 调用。本文件中的业务响应位于 CLI 顶层 `data`;
|
|
4
|
-
只按本文件说明读取字段,不得递归搜索。本文件中的 URL 只用于说明 endpoint schema,
|
|
5
|
-
不授权直接 HTTP。普通名称基础查询只调用一次 `compound-summary`;多个名称
|
|
6
|
-
只调用一次 `compound-batch-summary`,默认 body 仅包含 `identifiers` 和
|
|
7
|
-
`namespace:"name"`,不得先调用 health/schema。
|
|
8
|
-
|
|
9
|
-
结果直接从 `data` 投影。批量记录位于 `data.results[*]`,原始标签在 `input`,
|
|
10
|
-
属性在嵌套 `properties`。SMILES 回退顺序固定为
|
|
11
|
-
`CanonicalSMILES -> ConnectivitySMILES -> SMILES -> IsomericSMILES`。
|
|
12
|
-
PubChem `XLogP` 与 RDKit `MolLogP` 不得互换;not_found 不得用本地计算补值。
|
|
13
|
-
|
|
14
|
-
Namespaces: `cid`, `name`, `smiles`, `inchi`, `inchikey`, `formula`.
|
|
15
|
-
|
|
16
|
-
## Health
|
|
17
|
-
|
|
18
|
-
operation:`health`,无 body。
|
|
19
|
-
|
|
20
|
-
## Resolve CIDs
|
|
21
|
-
|
|
22
|
-
operation:`compound-resolve-cids`。
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
{"identifier": "aspirin", "namespace": "name", "max_records": 20}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`max_records`: 1-100.
|
|
29
|
-
|
|
30
|
-
## Properties
|
|
31
|
-
|
|
32
|
-
operation:`compound-properties`。
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"identifier": "2244",
|
|
37
|
-
"namespace": "cid",
|
|
38
|
-
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "IUPACName"]
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Allowed properties include `MolecularFormula`, `MolecularWeight`,
|
|
43
|
-
`CanonicalSMILES`, `IsomericSMILES`, `SMILES`, `ConnectivitySMILES`,
|
|
44
|
-
`IUPACName`, `InChI`, `InChIKey`, `XLogP`, `TPSA`, `HBondDonorCount`,
|
|
45
|
-
`HBondAcceptorCount`, `RotatableBondCount`, `ExactMass`, `MonoisotopicMass`,
|
|
46
|
-
`Charge`, `HeavyAtomCount`, `Complexity`, `CovalentUnitCount`,
|
|
47
|
-
`DefinedAtomStereoCount`, `UndefinedAtomStereoCount`, `DefinedBondStereoCount`,
|
|
48
|
-
`UndefinedBondStereoCount`, and `IsotopeAtomCount`.
|
|
49
|
-
|
|
50
|
-
## Synonyms
|
|
51
|
-
|
|
52
|
-
operation:`compound-synonyms`。
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{"identifier": "2244", "namespace": "cid", "max_synonyms": 50}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`max_synonyms`: 1-500.
|
|
59
|
-
|
|
60
|
-
## Summary
|
|
61
|
-
|
|
62
|
-
operation:`compound-summary`。
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"identifier": "aspirin",
|
|
67
|
-
"namespace": "name",
|
|
68
|
-
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "IUPACName"],
|
|
69
|
-
"synonym_limit": 20
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
`synonym_limit`: 0-100. Use this endpoint for general compound lookup because
|
|
74
|
-
it resolves CID, selected properties, and synonyms in one call.
|
|
75
|
-
|
|
76
|
-
Response fields include `valid`, `cid`, `properties`, `properties_raw`,
|
|
77
|
-
`aliases`, `synonyms`, and `metadata`. Numeric properties are coerced to JSON
|
|
78
|
-
numbers when possible. Requested SMILES aliases are filled when PubChem returns
|
|
79
|
-
an equivalent key such as `ConnectivitySMILES`.
|
|
80
|
-
|
|
81
|
-
## Batch Summary
|
|
82
|
-
|
|
83
|
-
operation:`compound-batch-summary`。
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"identifiers": ["aspirin", "ibuprofen", "caffeine"],
|
|
88
|
-
"namespace": "name",
|
|
89
|
-
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "XLogP", "TPSA"],
|
|
90
|
-
"synonym_limit": 5
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Limits: 1-100 identifiers. The response preserves input order and includes
|
|
95
|
-
per-item errors:
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"valid": false,
|
|
100
|
-
"namespace": "name",
|
|
101
|
-
"properties_requested": ["CanonicalSMILES"],
|
|
102
|
-
"results": [
|
|
103
|
-
{
|
|
104
|
-
"input": "aspirin",
|
|
105
|
-
"valid": true,
|
|
106
|
-
"cid": 2244,
|
|
107
|
-
"properties": {
|
|
108
|
-
"CanonicalSMILES": "CC(=O)Oc1ccccc1C(=O)O",
|
|
109
|
-
"ConnectivitySMILES": "CC(=O)Oc1ccccc1C(=O)O",
|
|
110
|
-
"_aliases": {"CanonicalSMILES": "ConnectivitySMILES"},
|
|
111
|
-
"properties_raw": {}
|
|
112
|
-
},
|
|
113
|
-
"properties_raw": {},
|
|
114
|
-
"aliases": {"CanonicalSMILES": "ConnectivitySMILES"},
|
|
115
|
-
"synonyms": []
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"input": "bad-name",
|
|
119
|
-
"valid": false,
|
|
120
|
-
"error": "not found"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"count": 2,
|
|
124
|
-
"failed_count": 1
|
|
125
|
-
}
|
|
126
|
-
```
|
|
1
|
+
# PubChem 详细规则
|
|
2
|
+
|
|
3
|
+
只能通过 `delta-cli science invoke` 调用。本文件中的业务响应位于 CLI 顶层 `data`;
|
|
4
|
+
只按本文件说明读取字段,不得递归搜索。本文件中的 URL 只用于说明 endpoint schema,
|
|
5
|
+
不授权直接 HTTP。普通名称基础查询只调用一次 `compound-summary`;多个名称
|
|
6
|
+
只调用一次 `compound-batch-summary`,默认 body 仅包含 `identifiers` 和
|
|
7
|
+
`namespace:"name"`,不得先调用 health/schema。
|
|
8
|
+
|
|
9
|
+
结果直接从 `data` 投影。批量记录位于 `data.results[*]`,原始标签在 `input`,
|
|
10
|
+
属性在嵌套 `properties`。SMILES 回退顺序固定为
|
|
11
|
+
`CanonicalSMILES -> ConnectivitySMILES -> SMILES -> IsomericSMILES`。
|
|
12
|
+
PubChem `XLogP` 与 RDKit `MolLogP` 不得互换;not_found 不得用本地计算补值。
|
|
13
|
+
|
|
14
|
+
Namespaces: `cid`, `name`, `smiles`, `inchi`, `inchikey`, `formula`.
|
|
15
|
+
|
|
16
|
+
## Health
|
|
17
|
+
|
|
18
|
+
operation:`health`,无 body。
|
|
19
|
+
|
|
20
|
+
## Resolve CIDs
|
|
21
|
+
|
|
22
|
+
operation:`compound-resolve-cids`。
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{"identifier": "aspirin", "namespace": "name", "max_records": 20}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`max_records`: 1-100.
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
operation:`compound-properties`。
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"identifier": "2244",
|
|
37
|
+
"namespace": "cid",
|
|
38
|
+
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "IUPACName"]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Allowed properties include `MolecularFormula`, `MolecularWeight`,
|
|
43
|
+
`CanonicalSMILES`, `IsomericSMILES`, `SMILES`, `ConnectivitySMILES`,
|
|
44
|
+
`IUPACName`, `InChI`, `InChIKey`, `XLogP`, `TPSA`, `HBondDonorCount`,
|
|
45
|
+
`HBondAcceptorCount`, `RotatableBondCount`, `ExactMass`, `MonoisotopicMass`,
|
|
46
|
+
`Charge`, `HeavyAtomCount`, `Complexity`, `CovalentUnitCount`,
|
|
47
|
+
`DefinedAtomStereoCount`, `UndefinedAtomStereoCount`, `DefinedBondStereoCount`,
|
|
48
|
+
`UndefinedBondStereoCount`, and `IsotopeAtomCount`.
|
|
49
|
+
|
|
50
|
+
## Synonyms
|
|
51
|
+
|
|
52
|
+
operation:`compound-synonyms`。
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{"identifier": "2244", "namespace": "cid", "max_synonyms": 50}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`max_synonyms`: 1-500.
|
|
59
|
+
|
|
60
|
+
## Summary
|
|
61
|
+
|
|
62
|
+
operation:`compound-summary`。
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"identifier": "aspirin",
|
|
67
|
+
"namespace": "name",
|
|
68
|
+
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "IUPACName"],
|
|
69
|
+
"synonym_limit": 20
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`synonym_limit`: 0-100. Use this endpoint for general compound lookup because
|
|
74
|
+
it resolves CID, selected properties, and synonyms in one call.
|
|
75
|
+
|
|
76
|
+
Response fields include `valid`, `cid`, `properties`, `properties_raw`,
|
|
77
|
+
`aliases`, `synonyms`, and `metadata`. Numeric properties are coerced to JSON
|
|
78
|
+
numbers when possible. Requested SMILES aliases are filled when PubChem returns
|
|
79
|
+
an equivalent key such as `ConnectivitySMILES`.
|
|
80
|
+
|
|
81
|
+
## Batch Summary
|
|
82
|
+
|
|
83
|
+
operation:`compound-batch-summary`。
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"identifiers": ["aspirin", "ibuprofen", "caffeine"],
|
|
88
|
+
"namespace": "name",
|
|
89
|
+
"properties": ["MolecularFormula", "MolecularWeight", "CanonicalSMILES", "XLogP", "TPSA"],
|
|
90
|
+
"synonym_limit": 5
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Limits: 1-100 identifiers. The response preserves input order and includes
|
|
95
|
+
per-item errors:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"valid": false,
|
|
100
|
+
"namespace": "name",
|
|
101
|
+
"properties_requested": ["CanonicalSMILES"],
|
|
102
|
+
"results": [
|
|
103
|
+
{
|
|
104
|
+
"input": "aspirin",
|
|
105
|
+
"valid": true,
|
|
106
|
+
"cid": 2244,
|
|
107
|
+
"properties": {
|
|
108
|
+
"CanonicalSMILES": "CC(=O)Oc1ccccc1C(=O)O",
|
|
109
|
+
"ConnectivitySMILES": "CC(=O)Oc1ccccc1C(=O)O",
|
|
110
|
+
"_aliases": {"CanonicalSMILES": "ConnectivitySMILES"},
|
|
111
|
+
"properties_raw": {}
|
|
112
|
+
},
|
|
113
|
+
"properties_raw": {},
|
|
114
|
+
"aliases": {"CanonicalSMILES": "ConnectivitySMILES"},
|
|
115
|
+
"synonyms": []
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"input": "bad-name",
|
|
119
|
+
"valid": false,
|
|
120
|
+
"error": "not found"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"count": 2,
|
|
124
|
+
"failed_count": 1
|
|
125
|
+
}
|
|
126
|
+
```
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
# pymatgen 详细规则
|
|
2
|
-
|
|
3
|
-
所有调用直接使用 `delta-cli science invoke`。无机化学式、组成和式量优先使用 pymatgen,不用 PubChem
|
|
4
|
-
或本地元素表替代。结构 operation 必须发送完整结构文本,不能发送本地文件路径;
|
|
5
|
-
支持 `cif`、`poscar`、`json`、`cssr`、`xsf`,不接收 LAMMPS data/dump。
|
|
6
|
-
|
|
7
|
-
## Health
|
|
8
|
-
|
|
9
|
-
operation:`health`,无 body。
|
|
10
|
-
|
|
11
|
-
## Composition Parse
|
|
12
|
-
|
|
13
|
-
operation:`composition-parse`。
|
|
14
|
-
|
|
15
|
-
```json
|
|
16
|
-
{"formula": "LiFePO4", "format": "formula"}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Key response fields in `data`: `valid`, `formula`, `reduced_formula`,
|
|
20
|
-
`alphabetic_formula`, `anonymous_formula`, `chemical_system`,
|
|
21
|
-
`number_of_atoms`, `weight`, `element_amounts`, `atomic_fractions`,
|
|
22
|
-
`weight_fractions`, `error`.
|
|
23
|
-
|
|
24
|
-
## Structure Parse / Summary
|
|
25
|
-
|
|
26
|
-
operation:`structure-parse` 或 `structure-summary`。
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{"input": "<CIF text>", "format": "cif", "primitive": false}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Input formats: `cif`, `poscar`, `json`, `cssr`, `xsf`.
|
|
33
|
-
|
|
34
|
-
Summary fields include `formula`, `reduced_formula`, `chemical_system`,
|
|
35
|
-
`nsites`, `nelements`, `density`, `volume`, `lattice`, `element_amounts`, and
|
|
36
|
-
`species`.
|
|
37
|
-
|
|
38
|
-
## Structure Convert
|
|
39
|
-
|
|
40
|
-
operation:`structure-convert`。
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"input": "<CIF text>",
|
|
45
|
-
"input_format": "cif",
|
|
46
|
-
"output_format": "poscar",
|
|
47
|
-
"primitive": false
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Output formats: `cif`, `poscar`, `json`, `cssr`, `xsf`.
|
|
52
|
-
|
|
53
|
-
## Symmetry
|
|
54
|
-
|
|
55
|
-
operation:`structure-symmetry`。
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
"input": "<CIF text>",
|
|
60
|
-
"format": "cif",
|
|
61
|
-
"primitive": false,
|
|
62
|
-
"symprec": 0.01,
|
|
63
|
-
"angle_tolerance": 5.0
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Returns `space_group_symbol`, `space_group_number`, `crystal_system`,
|
|
68
|
-
`point_group_symbol`, `hall`, and `nsites`.
|
|
1
|
+
# pymatgen 详细规则
|
|
2
|
+
|
|
3
|
+
所有调用直接使用 `delta-cli science invoke`。无机化学式、组成和式量优先使用 pymatgen,不用 PubChem
|
|
4
|
+
或本地元素表替代。结构 operation 必须发送完整结构文本,不能发送本地文件路径;
|
|
5
|
+
支持 `cif`、`poscar`、`json`、`cssr`、`xsf`,不接收 LAMMPS data/dump。
|
|
6
|
+
|
|
7
|
+
## Health
|
|
8
|
+
|
|
9
|
+
operation:`health`,无 body。
|
|
10
|
+
|
|
11
|
+
## Composition Parse
|
|
12
|
+
|
|
13
|
+
operation:`composition-parse`。
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{"formula": "LiFePO4", "format": "formula"}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Key response fields in `data`: `valid`, `formula`, `reduced_formula`,
|
|
20
|
+
`alphabetic_formula`, `anonymous_formula`, `chemical_system`,
|
|
21
|
+
`number_of_atoms`, `weight`, `element_amounts`, `atomic_fractions`,
|
|
22
|
+
`weight_fractions`, `error`.
|
|
23
|
+
|
|
24
|
+
## Structure Parse / Summary
|
|
25
|
+
|
|
26
|
+
operation:`structure-parse` 或 `structure-summary`。
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{"input": "<CIF text>", "format": "cif", "primitive": false}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Input formats: `cif`, `poscar`, `json`, `cssr`, `xsf`.
|
|
33
|
+
|
|
34
|
+
Summary fields include `formula`, `reduced_formula`, `chemical_system`,
|
|
35
|
+
`nsites`, `nelements`, `density`, `volume`, `lattice`, `element_amounts`, and
|
|
36
|
+
`species`.
|
|
37
|
+
|
|
38
|
+
## Structure Convert
|
|
39
|
+
|
|
40
|
+
operation:`structure-convert`。
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"input": "<CIF text>",
|
|
45
|
+
"input_format": "cif",
|
|
46
|
+
"output_format": "poscar",
|
|
47
|
+
"primitive": false
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Output formats: `cif`, `poscar`, `json`, `cssr`, `xsf`.
|
|
52
|
+
|
|
53
|
+
## Symmetry
|
|
54
|
+
|
|
55
|
+
operation:`structure-symmetry`。
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"input": "<CIF text>",
|
|
60
|
+
"format": "cif",
|
|
61
|
+
"primitive": false,
|
|
62
|
+
"symprec": 0.01,
|
|
63
|
+
"angle_tolerance": 5.0
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Returns `space_group_symbol`, `space_group_number`, `crystal_system`,
|
|
68
|
+
`point_group_symbol`, `hall`, and `nsites`.
|