Skip to main content

Agent-first materials CLI. Build, edit and inspect 2D materials and catalytic interfaces with 1-4 token commands. Auto-renders PNG + Markdown summary after every operation for multimodal-agent self-verification.

Project description

mat — agent-first materials CLI

mat 是一个写给 AI agent 用的材料结构 CLI。它把构造、扰动、解释 2D 材料和催化界面所需的全部原子级操作,压缩到 1–4 个 token 的命令里,并且每次操作都自动产出 .png 渲染图 + .summary.md 摘要,方便多模态 agent 直接看图判断"这一步做对了没"。

设计灵感来自 GitHub gh:用 /resource verb 把长尾能力 RESTful 化,用顶层 command 表达高层意图,用 --json / --jq / -q 统一裁剪输出,避免污染 LLM 的 context。


30 秒上手

pip install -e .

mat init -q                              # 起一个 run 目录
mat build mos2 -q                        # 造一个 MoS2 单层
mat motifs                               # 看配位 motif
mat strain 2% -q                         # 施 2% 双轴应变
mat perturb vacancy=S:1 -q               # 抠掉 1 个 S 原子
mat                                      # 看当前 context + 下一步建议

每条会改/造结构的命令完成后,run 目录里自动多出三个文件:

runs/001-run/mos2.vasp           ← 结构
runs/001-run/mos2.png            ← 自动渲染
runs/001-run/mos2.summary.md     ← 摘要(formula / lattice / motifs / sites)

mos2


为什么是 agent-first

痛点(普通 CLI) mat 的设计
命令爆炸,agent 要记 50+ 个子命令 顶层只 ~20 个高层命令 + /resource verb 路径覆盖长尾
输出动辄上千 token,污染 context 默认人类可读、--json --jq 精确裁剪
每个命令都要重传文件路径 隐式 context:上一步的输出自动是下一步的输入
操作完不知道做对没 每次自动出 .png 让多模态 agent 自检
没有可复现的日志 run 目录 + .summary.md 自动落盘

命令家族(一句话各自做什么)

命令 作用
mat 0 参数 = 当前 context 状态 + 下一步建议(像 git status
mat init 起一个编号 run 目录
`mat build <kind alias>`
mat get [file] 看结构信息(智能路由:file / mp-id / run-id 都行)
mat list <thing> 列资源(motifs / runs / recipes / ...
mat motifs 列当前结构的配位 motif
mat sites 列当前结构的原子 (idx, element, cart, frac)
mat strain <spec> 对当前结构施应变(2% / a:1%,b:-0.5%
mat vacuum <Å> 改 2D 真空层厚度
mat recenter 把 slab 重新居中
mat perturb <ops...> 复合编辑(vacancy / substitute / displace / shift / rotate / interlayer / strain / vacuum,可链式)
mat verify rules.yaml 按规则校验结构
mat explain profile.yaml 按 profile 解释结构
mat reproduce x.recipe.yaml 跑一篇论文的复现 recipe
mat materials 列内置 material 别名表
mat status 看当前 run 的进度

资源(长尾能力):mat /<path> <verb>,5 个动词收敛:list / get / create / update / delete(recipes 多一个 run)。

mat /motifs list center=Mo ligand=S
mat /lattice update strain=2%
mat /sites update set=0=z:7.5
mat /vasp-inputs create profile=mp-relax-pbe
mat /mp/mp-2815 get

单字母缩写:/m /s /l /r /a /d /b /si /v /rec


自动产物(写给 agent 看)

每个会写结构的命令完成后,CLI 在结构文件旁边生成 2 个附属文件:

文件 给谁看 内容
*.vasp 下游 DFT 计算 标准 POSCAR
*.png 多模态 agent / 人 VESTA 风格 3D 渲染,含 motif 多面体、cell box、元素图例
*.summary.md 文本 agent formula / lattice / 2D slab+vacuum / motifs / sites 表

*.summary.md 长这样(示例为 mos2.summary.md):

# mos2.vasp

*Produced by* `build.monolayer` *at* `2026-05-25 07:06:10`

![structure](mos2.png)

## Composition
- formula: **MoS2**
- sites: 3  (2 species)
- elements: Mo S

## Lattice
- a, b, c: `3.1600  3.1600  15.0000` Å
- angles : α=`90.00` β=`90.00` γ=`120.00`°
- volume : `129.7167` ų

## 2D layer (along c)
- slab z range: `[5.94, 9.06]` Å
- slab thickness: `3.12` Å
- vacuum (c − slab): `11.88` Å

## Motifs
- `SMo3_trigonal` × 2
- `MoS6_octahedral` × 1

## Sites (first 20) ...

CI / 批处理中关闭:export MAT_NO_ARTIFACTS=1


文档

详细文档在 docs/site/(12 页,每页配示意图):

  1. Overview — 为什么是 agent-first
  2. Quickstart — 5 分钟跑完一个完整流程
  3. Implicit context — 一次设定全程跟随
  4. Build — 8 种 builder + 9 种 material 别名
  5. Motifs — 配位环境抽象 + connectivity graph
  6. Lattice ops — strain / vacuum / recenter
  7. Perturb — 缺陷、掺杂、错位、层间
  8. Resource layer — 长尾能力的 RESTful 路径
  9. Auto-artifacts — PNG + summary.md 机制
  10. Agent recipes — 给 agent 的可复用调用模式
  11. VASP inputs & paper recipes — 上游连接 DFT
  12. Reference — 全部命令、资源、flag 速查
  13. Complex gallery — 10 个真实复杂界面 / 表面 / 缺陷案例

安装

git clone <repo> vasp-cli
cd vasp-cli
python -m venv .venv && source .venv/bin/activate
pip install -e .
mat --help

依赖:Python ≥ 3.10、pymatgennumpymatplotlib(渲染图用)、PyYAML


环境变量

变量 作用
MAT_STRUCTURE 强制覆盖"当前结构"(任何命令都优先用它)
MAT_RUN_DIR 覆盖"当前 run 目录"(auto-out 路径会落在这里)
MAT_NO_ARTIFACTS=1 跳过 PNG + summary.md 生成(CI 用)
MP_API_KEY Materials Project API key(/mp 资源用)

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nku_vasp_cli-0.3.2.tar.gz (203.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nku_vasp_cli-0.3.2-py3-none-any.whl (470.0 kB view details)

Uploaded Python 3

File details

Details for the file nku_vasp_cli-0.3.2.tar.gz.

File metadata

  • Download URL: nku_vasp_cli-0.3.2.tar.gz
  • Upload date:
  • Size: 203.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for nku_vasp_cli-0.3.2.tar.gz
Algorithm Hash digest
SHA256 cab176cf5f8b7b148387c7a566df5e52edea79de9d473a846c85b800cb83a91a
MD5 96c12b0de1c236b2e3c00e15cc5e0087
BLAKE2b-256 fa331dc74bc808ab187451137fdbbfb0e3439607a54375df658c5a5d691d73e0

See more details on using hashes here.

File details

Details for the file nku_vasp_cli-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: nku_vasp_cli-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 470.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for nku_vasp_cli-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b4e1a80ad3cd528371998c95c9a6d6fb50754ac664c61514480c0766b5c4572
MD5 b56d009e2370254579c5081604d00822
BLAKE2b-256 9b374039b8cae78e879a0fc89a57be1fe39e519b1d47d7b503f9c42b5766408b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page