tm-spec

TM-Spec — Decision Log

Auditable log of TM-Spec design decisions. Each decision references an authoritative source (or explicitly marks original semantics).

Format: D-NN | <date> | Decision | Source | Breaking?


v0.1 → v0.2 alignment (2026-05-09, after standards-alignment.md)

D-01 | 2026-05-09 | Smearing kind: lowercase enum

D-02 | 2026-05-09 | Basis kind: plane_waves primary, PW alias

D-03 | 2026-05-09 | XC functional: human + LibXC dual

D-04 | 2026-05-09 | OPTIMADE structure interop layer

D-05 | 2026-05-09 | Wyckoff vs cartesian_site_positions

D-06 | 2026-05-09 | Defects: keep Kröger-Vink + add machine layer

D-07 | 2026-05-09 | Magnetic: keep AFM-G shortcut + add BNS optional

D-08 | 2026-05-09 | Environment T: keep K + computed C

D-09 | 2026-05-09 | Environment redox: keep Eh + auto-derive pe

D-10 | 2026-05-09 | Environment composition: PHREEQC element-valence verbatim

D-11 | 2026-05-09 | Reactions: Unicode primary + ASCII alias for export

D-12 | 2026-05-09 | Provenance parents: human IDs + AiiDA lookup

D-13 | 2026-05-09 | Status enum: keep richer 4-value

D-14 | 2026-05-09 | paper_quotable: bool + quote_constraint extension

D-15 | 2026-05-09 | Sanity gates: 4-value pass enum

D-16 | 2026-05-09 | Cost format: structured object

D-17 | 2026-05-09 | MLIP backend schema (for kind: USCalculation, MLIPBenchmark)


Kind conventions (Q-TMSPEC-1, closed 2026-05-09)

D-18 | 2026-05-09 | One sampling family = one kind


v0.2 extension — MetaDynCalculation (2026-05-10)

D-19 | 2026-05-10 | MetaDynCalculation kind with three new sections


D-21 | 2026-05-10 | MDCalculation kind with md_protocol + trajectory_analysis + results_md

D-22 | 2026-05-10 | MLIPBenchmark kind with benchmark_setup + metrics + results_mlip_bench

D-20 | 2026-05-10 | nspin=1 + U=0 confirmed for mack/pent


Open [QUESTION]

Q-TMSPEC-9 [2026-05-10] — Recipe registry for inverse conversion

Concept: TM-Spec → executable Python script via recipe template engine. Inverse tm_spec_extract.py.

Architecture:

# New block in TM-Spec (optional):
recipe:
  name: canonical_neb_qe_vacancy_hop
  version: 1.0
  runtime: native                       # see Q-TMSPEC-10
  overrides:
    hop_mode: diagonal
    pseudo_dir: /opt/pp/oncv_pbe

Do NOT encode algorithm logic in YAML (Turing-complete trap). Only pointer + parameters.

Recipe registry structure:

tools/tm_recipes/
├── canonical_neb_qe_vacancy_hop.py
├── canonical_neb_qe_vfe_proton_pair.py
├── plain_md_cp2k_aimd.py
├── us_pmf_mlip_native.py
├── wt_metad_cp2k.py
└── _builders/                          # shared functions: pick_triple, prewrap, place_h

Each recipe is a Python class with render(doc) → str (jinja2 or f-strings) → ready-to-exec script source.

Orchestrator workflow (runtime.execute_tm_spec(yaml, instance)):

  1. Validate (our tm_spec_validator)
  2. Resolve recipe by name@version
  3. Render → script source + sha256 hash
  4. Deploy to instance
  5. Watch + harvest
  6. Auto-fill (our tm_spec_sanity_fill)
  7. Update provenance (host, walltime, cost, hash)
  8. Return updated YAML

Benefits:

Pitfalls:

PoC plan (~3 hr):

  1. Add recipe block to schema (optional, 10 min)
  2. One recipe canonical_neb_qe_vacancy_hop (port neb_canonical_pyr_96at_qe.py, 90 min)
  3. tools/tm_spec_to_script.py generator (30 min)
  4. Round-trip test pyr_smoke.tm.yaml + recipe → script vs original (20 min)
  5. Orchestrator API stub execute_tm_spec() (30 min)

Status: [DEFERRED] — after paper #1 submission. Recipe registry is a medium-term investment; payoff after 5+ submissions.


Q-TMSPEC-10 [2026-05-10] — Runtime backends (native vs AiiDA vs atomate2)

Question: should we reuse AiiDA WorkChains / atomate2 Makers as backends for recipes?

Reality check (analysis 2026-05-10):

Backend Reusable for NOT reusable
AiiDA + aiida-quantumespresso/aiida-cp2k Standard relax/NEB/MD WorkChains; native provenance graph; aiida-nomad upload ASE issue #1130 fix; custom triple picker (diagonal mode); MLIP US PMF; ephemeral cloud GPU (requires permanent host for daemon + Postgres + RabbitMQ)
atomate2 Makers Pydantic-typed input sets; emmet TaskDoc compat; Maker pattern as design inspiration NEB Maker still in development 2026; VASP-biased (~80%); not for CP2K WT-MetaD / MLIP US

Decision: hybrid runtime — TM-Spec supports multiple backends via recipe.runtime:

What is worth adopting (without full reuse):

  1. Provenance schema: D-12 cement — use AiiDA LinkType enum on export (INPUT_CALC, INPUT_WORK, CALL_CALC, CALL_WORK, CREATE, RETURN).
  2. aiida-common-workflows input conventions — standard keys for cross-code workflows (relax, eos, bands). Use as inspiration for recipe.overrides naming.
  3. aiida-nomad upload mapping — cross-check with our tm_spec_export_nomad.py; align mappings (we have it; reuse validation logic).

Status: [DEFERRED]. Native backend covers paper #1 submission. AiiDA wrapper — v0.5 if demand arises (e.g., reviewer requests a full AiiDA provenance archive).


Q-TMSPEC-12 [2026-05-10] — Strategic positioning vs AiiDA/atomate2/AiiDAlab

Question: are we competing with industry standards (AiiDA) or finding a complementary niche?

Landscape analysis: see landscape.md for a detailed table (10 tools).

Closest competitor — AiiDAlab QE (https://github.com/aiidalab/aiidalab-qe). Web app on top of AiiDA for declarative QE input. Addresses the “scientist without Python” use case, but: web app (not git-tracked text), QE-only, AiiDA daemon required.

Decision: complementary positioning, not head-to-head competition.

4 niches where TM-Spec can claim a position:

  1. Paper SI format — no one provides declarative cross-code SI. Unique value.
  2. Ephemeral cloud compute — AiiDA is not compatible with ephemeral cloud GPU. An ephemeral orchestrator + TM-Spec = niche.
  3. Domain-specific recipes — encyclopedia of patches for Fe-S (extensible to oxides/MOFs).
  4. Educational / reproducibility — bit-exact reproduction via YAML + cloud GPU.

Strategic recommendations:

  1. Do NOT position as “AiiDA-killer”
  2. Paper #1 SI = first publication-grade artefact (test case)
  3. After submission, if reviewer feedback is positive — release TM-Spec on GitHub under MIT
  4. AiiDA-bridge converter — deferred until community request
  5. Long-term: TM-Spec for paper-grade reproducibility, AiiDA for lab-internal provenance. They coexist.

Precedents (how small declarative formats became standards):

All grew from: simple text + tool ecosystem + early adopters. TM-Spec already has the first two.

Main risk: over-scoping to a scale we cannot sustain (AiiDA-killer → failure; narrow Fe-S DSL → may work).

Status: [DECIDED] — complementary positioning. Paper #1 submission = test case for niche validation.


Q-TMSPEC-11 [2026-05-10] — Pydantic recipe inputs (atomate2 reuse?)

Question: should we use atomate2 Pydantic input sets (e.g. MPRelaxSet, NEBSet) as a type-checked structure for recipe.overrides?

Pros:

Cons:

Alternative: a minimal in-house Pydantic layer (pydantic is already in our dependencies via FastAPI/etc). Simple dataclass-like models for each recipe.

Decision (preliminary): in-house Pydantic layer for recipe.overrides validation, but adopt naming conventions from atomate2 (e.g., relax_set.encut_ry, not cutoff_wfc). For cross-code consistency.

Status: [DEFERRED] — resolved at PoC implementation stage of Q-TMSPEC-9.