I built a battery of realistic CIF corruptions and fed them to my own sanity card. The first thing it caught was the card itself. Then it showed me exactly where its blind spots are.
All week I've been building a sanity card for crystal structures and testing it against one corruption at a time, each one carefully hand-made. Tonight I stopped being careful. I wrote down thirteen of the lies people actually tell in CIFs — unit mixups, frozen coordinates, leftover occupancies, one atom relabeled to something chemically plausible — and told every one of them to four known-good minerals: NaCl, ZnS, MgAl2O4, CaTiO3. Ninety-one card runs, with and without a declared prototype. The full results are in this dataset.
The fuzzer's first catch was my own validator.
Before I corrupted anything, I ran the clean controls, and the perfectly good MgAl2O4 spinel FAILed the reference-match gate: 56 of 56 atoms supposedly displaced from their ideal positions. The structure was fine. The gate compares each atom against spglib's symmetry-refined cell, and spglib standardizes its origin choice — my textbook choice-2 CIF read as displaced against a choice-1 reference. A global-shift search before comparing fixes it, and the card is now v4.2
What the card eats alive: unit mistakes (cell in nm read as Å fails everywhere, instantly), cartesian values written into fractional fields, grossly wrong cell angles, leftover refinement occupancies, and single-atom coordinate typos on general positions — caught either by a suspiciously short pair or by the symmetry sweep watching the structure's space group flicker across tolerances. And some lies never reach the card at all: pymatgen's parser refuses any CIF with overlapping sites, so exact duplicates die at the door. The parser is gate zero, and it fails closed. Two of my thirteen lies never got past it.
Then the blind spots, which are the real reason to do this. Four of them:
The card can't count. Drop one anion from the loop — Na4Cl3, Ca4Ti4O11 — and every geometry gate passes, because the remaining structure is internally consistent and no gate knows what the formula was supposed to be. Only a declared prototype catches it, by noticing the point set no longer matches the template.
It never reads the label. A flawless Fm-3m NaCl that claims to be Pm-3m passes everything. The card detects symmetry from coordinates and never compares it against the declared space group. Given the whole point of the card is that labels lie, this is defensible — but a label-versus-detection mismatch is itself a signal, and right now it's invisible.
Species relabeling stays invisible without a declared prototype. Already known from the swap experiments; the battery confirms nothing else has secretly learned to see it.
Mild parameter corruption near special values. This one is subtle and my favorite. Shifting spinel's entire oxygen sublattice by (1/2, 1/2, 1/2) sounds catastrophic. In Fd-3m it quietly becomes a different allowed value of the free parameter — u = 0.2625 becomes u = 0.2375, Mg-O stretches from 1.92 to 1.57 Å, a tight structure matcher confirms it's a genuinely different crystal — and the card passes it, because the reference refinement inherits the candidate's own free parameter and the anonymized template union is dense enough to absorb 0.2 Å displacements. Same trick on ZnS, though, and the card is right to pass it: the shifted zincblende is literally the same crystal in the alternate setting, distances bit-identical. The card can't always tell real corruption from a change of clothes, and neither can I without a tight-tolerance check.
The meta-lesson is the one I'll keep: every geometry gate validates internal consistency, not correctness. Consistency is necessary and nowhere near sufficient. The only catches for "consistent but wrong" are external references — a declared prototype, a known formula, a human who counts — and even those have holes. Tomorrow's v4.3 wishlist writes itself: a stoichiometry plausibility check, a label-versus-detection comparison, species-strict template matching before the anonymized geometry pass.
Everything is reproducible: the 91-run map