{
  "experiment": "sanity card v4: prototype-aware gate + template-independence audit",
  "date": "2026-08-06/07",
  "gate_design": {
    "inputs": "candidate structure + declared prototype name",
    "templates": "built via ASE spacegroup Wyckoff tables (independent of pymatgen), scaled to candidate volume/atom",
    "verdicts": [
      "PASS",
      "PASS(inverted roles)",
      "INSPECT(species)",
      "INSPECT(geometry)"
    ],
    "note": "pymatgen StructureMatcher stol is normalized by the average free length per atom; stol=0.35 at 9.4 A^3/atom tolerates ~0.7 A. Geometry leg is a prototype-FAMILY check; u-parameter variation within a family passes."
  },
  "battery": {
    "NaCl_control__rocksalt": {
      "prototype": "rocksalt",
      "verdict": "PASS",
      "best_assignment": {
        "A": "Na",
        "B": "Cl"
      },
      "mismatched_atoms": 0,
      "total_atoms": 8
    },
    "NaCl_swap__rocksalt": {
      "prototype": "rocksalt",
      "verdict": "INSPECT(species)",
      "best_assignment": {
        "A": "Na",
        "B": "Cl"
      },
      "mismatched_atoms": 2,
      "total_atoms": 8,
      "note": "Geometry matches the declared prototype but species occupy each other's roles. Either a label swap (file corruption) or genuine antisite disorder (real physics, e.g. spinel inversion). Inspect, do not auto-reject.",
      "mismatches": [
        {
          "candidate_site": 3,
          "candidate_species": "Na",
          "template_site": 4,
          "template_species": "Cl"
        },
        {
          "candidate_site": 4,
          "candidate_species": "Cl",
          "template_site": 0,
          "template_species": "Na"
        }
      ]
    },
    "ZnS_control__zincblende": {
      "prototype": "zincblende",
      "verdict": "PASS",
      "best_assignment": {
        "A": "Zn",
        "B": "S"
      },
      "mismatched_atoms": 0,
      "total_atoms": 8
    },
    "ZnS_swap__zincblende": {
      "prototype": "zincblende",
      "verdict": "INSPECT(species)",
      "best_assignment": {
        "A": "Zn",
        "B": "S"
      },
      "mismatched_atoms": 2,
      "total_atoms": 8,
      "note": "Geometry matches the declared prototype but species occupy each other's roles. Either a label swap (file corruption) or genuine antisite disorder (real physics, e.g. spinel inversion). Inspect, do not auto-reject.",
      "mismatches": [
        {
          "candidate_site": 3,
          "candidate_species": "Zn",
          "template_site": 7,
          "template_species": "S"
        },
        {
          "candidate_site": 4,
          "candidate_species": "S",
          "template_site": 1,
          "template_species": "Zn"
        }
      ]
    },
    "NaCl_control__cesium_chloride": {
      "prototype": "cesium_chloride",
      "verdict": "INSPECT(geometry)",
      "best_assignment": {
        "A": "Na",
        "B": "Cl"
      },
      "mismatched_atoms": null,
      "total_atoms": null
    },
    "Co3O4_CORRUPTED__spinel": {
      "prototype": "spinel",
      "verdict": "INSPECT(geometry)",
      "best_assignment": {
        "A": "Co",
        "B": "Co",
        "X": "O"
      },
      "mismatched_atoms": null,
      "total_atoms": null
    },
    "Co3O4_corrected__spinel": {
      "prototype": "spinel",
      "verdict": "PASS",
      "best_assignment": {
        "A": "Co",
        "B": "Co",
        "X": "O"
      },
      "mismatched_atoms": 0,
      "total_atoms": 56
    },
    "MgAl2O4_normal__spinel": {
      "prototype": "spinel",
      "verdict": "PASS",
      "best_assignment": {
        "A": "Mg",
        "B": "Al",
        "X": "O"
      },
      "mismatched_atoms": 0,
      "total_atoms": 56
    },
    "MgAl2O4_inverse_0.25__spinel": {
      "prototype": "spinel",
      "verdict": "INSPECT(species)",
      "best_assignment": {
        "A": "Mg",
        "B": "Al",
        "X": "O"
      },
      "mismatched_atoms": 4,
      "total_atoms": 56,
      "note": "Geometry matches the declared prototype but species occupy each other's roles. Either a label swap (file corruption) or genuine antisite disorder (real physics, e.g. spinel inversion). Inspect, do not auto-reject.",
      "mismatches": [
        {
          "candidate_site": 0,
          "candidate_species": "Al",
          "template_site": 0,
          "template_species": "Mg"
        },
        {
          "candidate_site": 1,
          "candidate_species": "Al",
          "template_site": 1,
          "template_species": "Mg"
        },
        {
          "candidate_site": 8,
          "candidate_species": "Mg",
          "template_site": 8,
          "template_species": "Al"
        },
        {
          "candidate_site": 9,
          "candidate_species": "Mg",
          "template_site": 9,
          "template_species": "Al"
        }
      ]
    },
    "Co3O4_spinel_Fd-3m_corrected.cif": {
      "verdict": "PASS",
      "detail": null
    },
    "CoFe2O4_spinel_Fd-3m_corrected.cif": {
      "verdict": "PASS",
      "detail": null
    },
    "FeCo2O4_spinel_Fd-3m_corrected.cif": {
      "verdict": "PASS",
      "detail": null
    },
    "NiCo2O4_spinel_Fd-3m_corrected.cif": {
      "verdict": "PASS",
      "detail": null
    },
    "ZnCo2O4_spinel_Fd-3m_corrected.cif": {
      "verdict": "PASS",
      "detail": null
    }
  },
  "antisite_demo": {
    "MgAl2O4_partial_inverse": "2 Mg/Al pairs swapped (inversion degree 0.25) -> INSPECT(species), 4/56 atoms on the other role's sites; verdict text names genuine antisite disorder as the physical alternative. Never auto-reject."
  },
  "template_independence_audit": {
    "trigger": "first v4 template (pymatgen Structure.from_spacegroup('Fd-3m', choice-2 coords)) PASSed the corrupted Co3O4",
    "finding_1": "pymatgen from_spacegroup('Fd-3m') uses origin choice 1; feeding textbook choice-2 Wyckoff coords silently yields a 56-atom Fd-3m cell with overlapping O (O-O 0.286 A). A@(1/8,1/8,1/8) gives 16 atoms, not the 8 of diamond.",
    "finding_2": "the corrupted Co3O4 of the July spinel saga tight-matches that exact broken construction at u~0.24 (max displacement 0.056 A over 56 atoms) -> the corruption was almost certainly born from this call, not from a coordinate permutation of a real CIF",
    "finding_3": "ASE spacegroup tables (setting=2) generate the textbook orbit (O-O 2.67 A); templates rebuilt via ASE",
    "finding_4": "corrected Co3O4 family (mlip-benchmark/corrected_cifs) are honest spinels: u~0.236, tet Co at 8b origin choice; all five PASS the fixed gate",
    "lesson": "a reference that shares the generator's bug validates the corruption. v3's matcher referenced the structure's own detected symmetry; v4's first template referenced the same broken generator. Independence of the reference is the whole game."
  },
  "prior_context": {
    "species_swap_post": "019fd98c-d160-7c39-a0a9-e9406adeeb30",
    "corrupted_file": "projects/spinel/spinel_cifs/Co3O4.cif == cifs/misc/co3o4.cif (O-O 0.320 A, robust Fd-3m)"
  }
}