科研 Skill
计算材料工作流引擎选型
workflow-engine-mapper
Maps computational materials tasks onto workflow engines (atomate2, jobflow, AiiDA, pyiron) or a one-off script. Use when deciding how to structure a reproducible campaign or DAG.
SKILL.md
Workflow Engine Mapper
Goal
Choose the smallest workflow structure that preserves reproducibility, restartability, and provenance for a materials simulation task.
Requirements
- Python 3.10+
- No external dependencies
- Works on Linux, macOS, and Windows
Inputs to Gather
| Input | Description | Example |
|---|---|---|
| Task | Workflow purpose | VASP relax-static-DOS for 200 structures |
| Code | Main simulation engine | vasp, qe, lammps, ase |
| Runs | Approximate number of calculations | 200 |
| Provenance | Whether audit trail matters | true |
| Restart | Whether jobs may resume after failure | true |
| HPC | Whether remote scheduler is required | true |
Decision Guidance
- Use one-off scripts for fewer than 5 local exploratory runs (no provenance, no HPC).
- Use jobflow/atomate2 when the workflow is Python-native and Materials Project style input sets are useful.
- Use AiiDA when provenance-critical work is also remote (HPC) or large (>= 50 runs) — i.e. long-lived, database-backed campaigns. For smaller local provenance needs, atomate2 (Materials Project codes, >= 10 runs) or jobflow stores already capture inputs, outputs, code version, and environment, so the mapper recommends those instead of the heavier AiiDA stack.
- Use pyiron when interactive atomistic workflows, notebooks, and job management are the primary user surface (ASE/LAMMPS without strict provenance).
The recommendations are emitted in a fixed precedence so the prose and the implemented thresholds agree: an explicit --preferred engine overrides everything; otherwise one-off (small local, no provenance/HPC) -> AiiDA (provenance AND remote/large) -> atomate2 (VASP/QE/CP2K/force-field, >= 10 runs) -> pyiron (ASE/LAMMPS, no provenance) -> jobflow (fallback).
Script Outputs
scripts/workflow_engine_mapper.py emits:
recommended_enginedag_patternprovenance_requirementsrestart_strategystorage_layoutmigration_triggersnotes
Workflow
python3 skills/simulation-workflow/workflow-engine-mapper/scripts/workflow_engine_mapper.py \
--task "relax static dos for 200 oxides" \
--code vasp \
--runs 200 \
--needs-provenance \
--needs-restart \
--hpc \
--json
Use the output to scaffold the workflow before writing engine-specific code.
Error Handling
If the task has too few details, choose the conservative pattern and ask for engine, run count, and restart needs before implementation.
Limitations
The skill does not replace the official APIs of atomate2, jobflow, AiiDA, or pyiron; it selects and explains the workflow shape.
Verification checklist
- Recorded the full
--jsonpayload fromworkflow_engine_mapper.py(includinginputs) and confirmed the echoedruns,code,needs_provenance,needs_restart, andhpcmatch the task you actually intend, not a guessed default. - Confirmed
recommended_enginefollows the documented precedence for these inputs:--preferredoverride -> one-off (runs<5, no provenance, no HPC) -> aiida (provenance AND (hpcorruns>=50)) -> atomate2 (codein vasp/qe/cp2k/forcefield ANDruns>=10) -> pyiron (ase/lammps, no provenance) -> jobflow fallback; if the result surprises you, re-check which branch the inputs hit rather than overriding blindly. - Verified
dag_patternreflects the task keywords: branch terms (dos/band/phonon/static) and sweep terms (screen/sweep/campaign/many/batch) compose into the map+branch pattern, andwith restart checkpointsis appended only when--needs-restartwas passed. - Checked
provenance_requirementsandrestart_strategyagainst intent:store_code_version/store_environment,checkpoint_jobs(also auto-true atruns>=20), andresume_by_job_id_or_name(false for one-off) are consistent with how the campaign will actually be audited and resumed. - Read
migration_triggers; for a one-off recommendation, confirmed the forward-looking "migrate once results are compared/published/screened/resumed or runs reach ~5+" entry is present and planned for, rather than treating one-off as permanent. - Used
storage_layout(inputs/,runs/<job-id>/,outputs/,metadata/workflow.json,reports/) as the on-disk scaffold and confirmed it maps onto the chosen engine's native store before writing engine-specific code. - Confirmed the mapper exit code was
0(a2means input validation rejected the args and no recommendation was produced) before trusting any output.
Common pitfalls & rationalizations
| Tempting shortcut | Why it's wrong / what to do |
|---|---|
| "It's only a few runs now, so a one-off script is fine forever." | The mapper emits a migration_triggers entry precisely because one-off is exploratory-only; once results are compared, published, screened, or resumed (or runs reach ~5+), promote to an engine. Treat one-off as a starting point, not a destination. |
| "I need provenance, so the answer must be AiiDA." | AiiDA is gated on provenance AND (HPC or runs>=50). For smaller/local provenance needs the mapper deliberately picks atomate2 or jobflow, whose stores already capture inputs, outputs, code version, and environment. Do not reach for the heavier stack when the lighter store suffices. |
| "The engine ran and printed a recommendation, so the inputs were right." | The script validates bounds, not intent. A forgotten --needs-provenance or --hpc flag, or a defaulted --code general, silently changes the branch taken. Re-read the echoed inputs block in the JSON and confirm each flag matches the real task. |
| "It's a screening campaign, so the DAG is just a map over structures." | If the task also names a property (dos/band/phonon/static), the correct pattern composes both: map over structures -> (relax -> static -> property branches) -> collect -> rank. Check that branch and sweep keywords both surfaced in dag_pattern. |
| "Restart isn't critical, so I can skip checkpointing." | checkpoint_jobs is also forced true at runs>=20 independent of --needs-restart, because large sweeps fail partway. Honor the emitted restart_strategy rather than your gut feel about restart importance. |
"The recommended engine doesn't match what I'd have picked, so I'll just use --preferred." | --preferred overrides everything before any heuristic runs, so it can mask a genuine mismatch in your inputs. First confirm runs/code/provenance/HPC are stated correctly; only override when you have a specific reason, and record it. |
Security
Input Validation
- The script accepts only scalar CLI inputs and boolean flags (
--needs-provenance,--needs-restart,--hpc,--jsonviastore_true). runsmust be a positive integer (rejects booleans, non-integers, and values<= 0) and is capped atMAX_RUNS = 1,000,000;main()also rejects non-finite values viamath.isfinite.- Free-text fields are length-bounded:
task<= 2000 characters (MAX_TASK_LEN) and must be non-empty after stripping;codeandpreferred<= 100 characters each (MAX_FIELD_LEN). preferredmust be one of the allowed engine names:auto,one-off,jobflow,atomate2,aiida,pyiron.- The
taskandcodestrings are not otherwise restricted by an allowlist; only their length and (fortask) emptiness are validated. - All invalid input raises
ValueError, which is printed to stderr and exits with code 2 before any recommendation is computed.
File Access
- The script reads and writes no files; all I/O is CLI args in -> stdout (JSON or two summary lines) out.
- It accepts no path arguments, so there is no path-sandboxing concern; there are no on-disk size limits because nothing is read from disk.
Tool Restrictions
- The frontmatter declares
allowed-tools: Read, Bash, Write, Grep, Glob. Bashis used only to run the bundledscripts/workflow_engine_mapper.py.Read/Grep/Globare used to inspect the skill's own files and references (e.g.references/workflow_engines.md) and the user's task context;Writeis available to scaffold workflow files from the recommended structure.
Safety Measures
- No
eval/exec, nosubprocess, and no shell invocation inside the script. - No network access: it does not connect to remote services, submit jobs, or deserialize untrusted data.
- Output is emitted as structured JSON via
json.dumps(with--json) or plain text summary lines. - DoS caps bound resource use: the
runsceiling (1,000,000) and thetask/code/preferredlength caps prevent unbounded input.
References
- See
references/workflow_engines.mdfor engine selection heuristics.
Version History
- 1.2.2: Add a Verification checklist (evidence tied to the mapper's JSON outputs, precedence, DAG composition, and exit code) and a Common pitfalls & rationalizations table covering one-off permanence, AiiDA over-selection, unread input flags, and forced checkpointing.
- 1.2.0: Strengthen evals with deterministic
script_checksthat pin the mapper's exact output (recommended_engine, dag_pattern, provenance_requirements, restart_strategy, migration_triggers) so each case discriminates the skill from a from-memory baseline. - 1.1.0: Compose branch+sweep DAG patterns instead of overwriting; emit a forward-looking migration trigger for one-off runs; document AiiDA gating/precedence; add input-validation safeguards (bounds, length caps) matching the Security section.
- 1.0.0: Initial workflow engine mapping skill.
示例提示词
帮我决定这个高通量计算项目该用atomate2还是AiiDA来组织流程。
所属插件
安装该插件会一并获得同领域的 23 个 Skill / MCP。
同插件的其他科研 Skill
- 制造解法验证与基准测试规划Plans verification and validation campaigns using manufactured solutions, canonical benchmarks. Use when an agent must prove a solver is correct before trusting results.
- 数值解空间时间收敛性分析Performs spatial/temporal convergence analysis for solution verification: observed order, Richardson extrapolation. Use when checking that a simulation result is grid/timestep independent.
- PDE数值微分格式选择Selects and applies numerical differentiation schemes for PDE/ODE discretization: finite-difference stencils. Use when choosing a spatial discretization scheme.
- 仿真结果FAIR归档打包Creates FAIR-minded reproducibility bundles for simulations: file inventories, hashes, units, engine versions. Use before publishing or archiving a simulation dataset.
- HPC作业运行诊断Diagnoses HPC runtime and scheduler problems for materials simulations: MPI/OpenMP/GPU layout, modules, scratch paths, walltime. Use when a cluster job fails, hangs, or underperforms.
- 线性方程组求解器选型Selects and configures linear solvers for Ax=b systems: direct (LU, Cholesky) versus iterative (CG, GMRES, BiCGSTAB) methods, sparsity. Use when choosing a linear solver for a simulation.
- 分子动力学分析方案规划Plans molecular dynamics post-processing for materials simulations: RDF, MSD/diffusion, VACF/VDOS, coordination numbers. Use when deciding which MD analysis to run and in what order.
- 数值模拟网格生成规划Plans and evaluates mesh generation for numerical simulations: grid resolution from physics scales, aspect ratio/skewness checks. Use when designing or auditing a simulation mesh.
- 非线性方程组求解器选型Selects and configures nonlinear solvers for root-finding, optimization, and least-squares problems: Newton, quasi-Newton, Broyden, Anderson acceleration. Use when choosing a nonlinear solver.
- 时间积分方法选择Selects and configures time-integration methods for ODE/PDE simulations: explicit Runge-Kutta, BDF, Rosenbrock. Use when choosing a time-stepping scheme for a solver.
- 偏微分方程数值稳定性分析Analyzes numerical stability for time-dependent PDE simulations: CFL/Fourier criteria, von Neumann analysis. Use when a simulation blows up or to check a scheme’s stability limits.
- 材料科学本体浏览查询Parses, navigates, and queries materials science ontology structures: class hierarchies, property domain/range lookup. Use when exploring an unfamiliar materials ontology.
- 材料术语本体映射Maps materials science terms, crystal structures, and sample descriptions to standardized ontology classes with confidence scores. Use when annotating data for ontology interoperability.
- 本体标注一致性校验Validates material sample annotations against ontology constraints: class/property existence, domain/range consistency. Use before publishing ontology-annotated materials data.
- 仿真参数优化与敏感性分析Explores and optimizes simulation parameters via design of experiments, sensitivity analysis, and optimizer selection: Latin Hypercube, quasi-random. Use when calibrating simulation parameters.
- 仿真计算性能剖析Identifies computational bottlenecks, parallel scaling, and memory requirements for materials simulations: parses timing logs for dominant phases. Use when a simulation is slow or scales poorly.
- 仿真输出数据后处理Extracts, analyzes, and summarizes simulation output data: spatial fields at timesteps, time-series trends, steady-state detection. Use when turning raw simulation output into summary statistics.
- 多代码仿真故障分诊Provides first-response triage for cross-code LAMMPS/VASP/QE/MOOSE simulation failures: classifies nonconvergence, NaN/Inf. Use when a simulation crashes and the cause is unclear.
- 多任务仿真批量编排Orchestrates multi-simulation campaigns: generates parameter sweeps (grid, linspace, Latin Hypercube), tracks batch job status. Use when running and managing many related simulation jobs.
- 仿真三阶段有效性校验Validates simulations across three stages: pre-flight config checks, runtime log monitoring for NaN/Inf and residual growth. Use to catch simulation errors before, during, and after a run.
- SLURM作业脚本生成Generates correct SLURM sbatch job scripts and sanity-checks HPC resource requests: nodes, MPI/OpenMP layout, memory, GPUs, walltime. Use when writing or debugging a SLURM submission script.
- 瞬态仿真时间步策略Plans and controls time-step policies for transient simulations: CFL and physics-based stability limits, adaptive stepping. Use when setting up a time-stepping strategy for a solver.
常见问题
计算材料工作流引擎选型能做什么?
Maps computational materials tasks onto workflow engines (atomate2, jobflow, AiiDA, pyiron) or a one-off script. Use when deciding how to structure a reproducible campaign or DAG。
如何安装计算材料工作流引擎选型?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「计算材料工作流引擎选型」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
计算材料工作流引擎选型需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
计算材料工作流引擎选型经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。