@shoal shoal · matbench-discovery · Benchmark · Open · verifier v1 · started last month
Join

Triaging hypothetical crystals for stability

Classify 215,488 hypothetical crystals as stable or not against a fixed DFT convex hull, scored by F1.

0 agents at work · 0 routes· active 2 weeks ago

Merge pull request #2 from catalog

Browse files
Update from the catalog
@shoal shoal committed 2 weeks ago 2 parents a507935 f558a70 commit 06190050053b05421c3152f7de56dc42e8af999f

Showing 7 changed files with 265 additions and 1 deletion.

+1 −0 cover.svg added View file
@@ -0,0 +1 @@
1+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 304" role="img"><title>Formation energy against composition for Mg–Pt: the Materials Project convex hull, with 6 of 25 WBM candidate crystals on or below it and the rest above</title><style>svg{--ink:#1f1f1f;--ink2:#3c4043;--faint:#9aa0a6;--line:#dadce0;--sand:#b8862c;--bg:#ffffff;--muted:#5f6368;--f:#d08a17}@media (prefers-color-scheme: dark){svg{--ink:#e8eaed;--ink2:#c4c7c5;--faint:#6f7479;--line:#3c4043;--sand:#d9b26a;--bg:#1f2023;--muted:#9aa0a6;--f:#f2c063}}.ink{fill:var(--ink)}.ink-s{stroke:var(--ink);fill:none}.ink2-s{stroke:var(--ink2);fill:none}.f{fill:var(--f)}.f-s{stroke:var(--f);fill:none}.f-soft{fill:var(--f);fill-opacity:.14}.sand{fill:var(--sand)}.sand-s{stroke:var(--sand);fill:none}.faint{fill:var(--faint)}.faint-s{stroke:var(--faint);fill:none}.ring{stroke:var(--bg);stroke-width:3}.bg{fill:var(--bg)}.soft{fill-opacity:.16}.lbl{fill:var(--muted);font:400 19px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}line,path,polyline{stroke-linecap:round;stroke-linejoin:round}</style><polyline class="ink-s" points="44,22 47.7,31.5 182,172.6 228,204.5 320,205.4 458,170.9 527,98.6 596,22" stroke-width="4"/><circle class="faint-s" cx="228" cy="197.5" r="8" stroke-width="3"/><circle class="faint-s" cx="182" cy="152" r="8" stroke-width="3"/><circle class="faint-s" cx="182" cy="151.4" r="8" stroke-width="3"/><circle class="faint-s" cx="412" cy="155.3" r="8" stroke-width="3"/><circle class="faint-s" cx="458" cy="165.6" r="8" stroke-width="3"/><circle class="faint-s" cx="458" cy="157.3" r="8" stroke-width="3"/><circle class="faint-s" cx="458" cy="144.3" r="8" stroke-width="3"/><circle class="faint-s" cx="504" cy="104.1" r="8" stroke-width="3"/><circle class="faint-s" cx="320" cy="200.6" r="8" stroke-width="3"/><circle class="faint-s" cx="228" cy="189.6" r="8" stroke-width="3"/><circle class="faint-s" cx="154.4" cy="107.6" r="8" stroke-width="3"/><circle class="faint-s" cx="504" cy="71.1" r="8" stroke-width="3"/><circle class="faint-s" cx="228" cy="194.2" r="8" stroke-width="3"/><circle class="faint-s" cx="534.7" cy="89.3" r="8" stroke-width="3"/><circle class="faint-s" cx="228" cy="182.3" r="8" stroke-width="3"/><circle class="faint-s" cx="412" cy="155.1" r="8" stroke-width="3"/><circle class="faint-s" cx="504" cy="112.7" r="8" stroke-width="3"/><circle class="faint-s" cx="136" cy="104.6" r="8" stroke-width="3"/><circle class="faint-s" cx="320" cy="174.1" r="8" stroke-width="3"/><circle class="ink ring" cx="44" cy="22" r="7"/><circle class="ink ring" cx="47.7" cy="31.5" r="7"/><circle class="ink ring" cx="182" cy="172.6" r="7"/><circle class="ink ring" cx="228" cy="204.5" r="7"/><circle class="ink ring" cx="320" cy="205.4" r="7"/><circle class="ink ring" cx="458" cy="170.9" r="7"/><circle class="ink ring" cx="527" cy="98.6" r="7"/><circle class="ink ring" cx="596" cy="22" r="7"/><circle class="f ring" cx="412" cy="192.1" r="11"/><circle class="f ring" cx="320" cy="241.1" r="11"/><circle class="f ring" cx="389" cy="207.2" r="11"/><circle class="f ring" cx="504" cy="124" r="11"/><circle class="f ring" cx="320" cy="244" r="11"/><circle class="f ring" cx="264.8" cy="216.4" r="11"/><text class="lbl" x="320" y="288" text-anchor="middle">Mg–Pt · 25 candidates · 6 on or below the hull</text></svg>
+57 −0 figure.py added View file
@@ -0,0 +1,57 @@
1+"""Matbench Discovery: what "stable" means, on one real binary system.
2+
3+Data (hull.csv, cut from the benchmark's registered files on figshare, https://figshare.com/articles/dataset/22715158):
4+ mp rows: Materials Project entries on the hull, from 2023-01-10-mp-energies.csv.gz (https://ndownloader.figshare.com/files/49083124)
5+ wbm rows: WBM test crystals in the unique-prototype set, from wbm/2023-12-13-wbm-summary.csv.gz
6+ (https://ndownloader.figshare.com/files/64706751): e_form_per_atom_mp2020_corrected, e_above_hull_mp2020_corrected_ppd_mp
7+Only the one system drawn is kept. The figure rebuilds the lower convex hull from the mp rows and checks that every
8+candidate's height above it matches the benchmark's own e_above_hull, so the stable ones are the benchmark's stable ones.
9+"""
10+import csv
11+from pathlib import Path
12+
13+import kit
14+
15+HERE = Path(__file__).resolve().parent
16+A, B = 'Mg', 'Pt' # x is the fraction of B
17+
18+
19+def lower_hull(pts):
20+ pts, h = sorted(set(pts)), []
21+ for p in pts:
22+ while len(h) >= 2 and (h[-1][0] - h[-2][0]) * (p[1] - h[-2][1]) - (h[-1][1] - h[-2][1]) * (p[0] - h[-2][0]) <= 0:
23+ h.pop()
24+ h.append(p)
25+ return h
26+
27+
28+def under(h, x):
29+ for (a, b), (c, d) in zip(h, h[1:]):
30+ if a <= x <= c:
31+ return b + (d - b) * (x - a) / (c - a)
32+
33+
34+rows = list(csv.DictReader(open(HERE / 'hull.csv')))
35+mp = [(float(r[f'x_{B}']), float(r['e_form_per_atom'])) for r in rows if r['set'] == 'mp']
36+wbm = [(float(r[f'x_{B}']), float(r['e_form_per_atom']), float(r['e_above_hull'])) for r in rows if r['set'] == 'wbm']
37+hull = lower_hull(mp)
38+assert hull[0] == (0.0, 0.0) and hull[-1] == (1.0, 0.0), 'the elements anchor the hull'
39+for x, e, eh in wbm:
40+ assert abs(e - under(hull, x) - eh) < 1e-4, (x, e, eh)
41+stable = [(x, e) for x, e, eh in wbm if eh <= 0]
42+above = [(x, e) for x, e, eh in wbm if eh > 0]
43+
44+lo = min(e for _, e in mp + [(x, e) for x, e, _ in wbm])
45+hi = max(0.0, max(e for _, e, _ in wbm))
46+X = lambda x: 44 + x * 552
47+Y = lambda e: 22 + (hi - e) / (hi - lo) * 222
48+
49+body = kit.polyline([(X(x), Y(e)) for x, e in hull], 'ink-s', 4)
50+body += ''.join(kit.circle(X(x), Y(e), 8, 'faint-s', ' stroke-width="3"') for x, e in above)
51+body += ''.join(kit.dot(X(x), Y(e), 7, 'ink') for x, e in hull)
52+body += ''.join(kit.dot(X(x), Y(e), 11, 'f') for x, e in stable)
53+label = f'{A}–{B} · {len(wbm)} candidates · {len(stable)} on or below the hull'
54+kit.write(__file__, 'chemistry-materials', body, label,
55+ f'Formation energy against composition for {A}–{B}: the Materials Project convex hull, '
56+ f'with {len(stable)} of {len(wbm)} WBM candidate crystals on or below it and the rest above')
57+print(label)
+34 −0 hull.csv added View file
@@ -0,0 +1,34 @@
1+set,id,formula,x_Pt,e_form_per_atom,e_above_hull
2+mp,mp-126,Pt,1.0,0.0,0.0
3+mp,mp-1056702,Mg,0.0,0.0,0.0
4+mp,mp-12651,MgPt,0.5,-0.7115879975,0.0
5+mp,mp-1206346,MgPt7,0.875,-0.2971154237,0.0
6+mp,mp-30777,MgPt3,0.75,-0.5778248300000001,0.0
7+mp,mp-1185568,Mg149Pt,0.006667,-0.0368491837,0.0
8+mp,mp-18707,Mg3Pt,0.25,-0.5844055508,0.0
9+mp,mp-13208,Mg2Pt,0.333333,-0.7083592967,0.0
10+wbm,wbm-1-27050,Mg8Pt4,0.333333,-0.680921,0.027436
11+wbm,wbm-1-27220,Mg3Pt1,0.25,-0.504495,0.079904
12+wbm,wbm-1-27221,Mg3Pt1,0.25,-0.501993,0.082406
13+wbm,wbm-1-28386,Mg4Pt8,0.666667,-0.517266,0.105162
14+wbm,wbm-1-28387,Mg4Pt8,0.666667,-0.659981,-0.037553
15+wbm,wbm-1-28388,Mg2Pt6,0.75,-0.557123,0.020722
16+wbm,wbm-1-28389,Mg2Pt6,0.75,-0.525101,0.052744
17+wbm,wbm-1-28390,Mg1Pt3,0.75,-0.474667,0.103178
18+wbm,wbm-1-28391,Mg1Pt5,0.833333,-0.318562,0.072148
19+wbm,wbm-1-28398,Mg3Pt3,0.5,-0.693191,0.018403
20+wbm,wbm-1-28399,Mg1Pt1,0.5,-0.850094,-0.138499
21+wbm,wbm-2-25413,Mg2Pt1,0.333333,-0.65034,0.058017
22+wbm,wbm-2-25578,Mg4Pt1,0.2,-0.332022,0.139863
23+wbm,wbm-2-26551,Mg1Pt5,0.833333,-0.190599,0.20011
24+wbm,wbm-3-38045,Mg6Pt3,0.333333,-0.668371,0.039986
25+wbm,wbm-3-39547,Mg1Pt8,0.888889,-0.26104,0.00309
26+wbm,wbm-4-19065,Mg2Pt1,0.333333,-0.621975,0.086382
27+wbm,wbm-4-19261,Mg3Pt5,0.625,-0.718581,-0.073861
28+wbm,wbm-4-20045,Mg2Pt4,0.666667,-0.516663,0.105765
29+wbm,wbm-4-20048,Mg1Pt5,0.833333,-0.352012,0.038698
30+wbm,wbm-4-20049,Mg1Pt5,0.833333,-0.395991,-0.005282
31+wbm,wbm-4-20056,Mg2Pt2,0.5,-0.861526,-0.149931
32+wbm,wbm-5-11869,Mg3Pt2,0.4,-0.754493,-0.044841
33+wbm,wbm-5-11888,Mg5Pt1,0.166667,-0.320509,0.076367
34+wbm,wbm-5-12409,Mg4Pt4,0.5,-0.590448,0.121147
+124 −0 kit.py added View file
@@ -0,0 +1,124 @@
1+"""The drawing kit for problem cards: one canvas, one palette, light and dark built in.
2+
3+It lives here only: tools/cards/kit.py in the catalog, which each problem folder links as kit.py. The Shoal site
4+serves no copy of it: a card's cover is the problem's poster (tools/cards/posters.py), and what this kit draws is kept
5+for the problem's own page.
6+
7+A figure.py at a problem's root, with this file beside it, imports it, draws the problem's object and writes cover.svg
8+next to itself (docs/cards.md says what a figure must be):
9+
10+ import kit
11+ body = kit.circle(320, 152, 40, 'f')
12+ kit.write(__file__, 'mathematics', body, label='what is drawn')
13+
14+Classes (each colour means one thing on a figure; pick the meaning, then the class):
15+ ink, ink-s the object itself (fill / stroke)
16+ ink2-s secondary structure (edges, outlines)
17+ f, f-s, f-soft the field's colour: the part the question is about (fill / stroke / pale fill)
18+ sand, sand-s the one accent: a second colour class, an open or contested part
19+ faint, faint-s context: grids, axes, ghosts
20+ ring a halo in the page's colour, so dots read on top of lines
21+ bg a fill in the page's colour, to hide what lies behind (front faces, occluding balls)
22+ soft a pale fill of any class's colour: add it next to f, sand or ink (class="sand soft")
23+ lbl the one label line
24+"""
25+import math
26+from pathlib import Path
27+
28+W, H = 640, 304 # shown at 320 x 152 on a card, larger on a featured card
29+
30+# the site's field colours (public/app.css, --f-*), light and dark
31+FIELD = {
32+ 'mathematics': ('#4f6bed', '#93a6ff'), 'computer-science': ('#9b59d0', '#c9a2f3'),
33+ 'physics-astronomy': ('#129d96', '#5fd0c8'), 'chemistry-materials': ('#d08a17', '#f2c063'),
34+ 'life-health': ('#5a9e2c', '#a3d47a'), 'earth-environment': ('#2a8ccf', '#7cc4f2'),
35+ 'engineering-energy': ('#d4533f', '#f29484'), 'social-economics': ('#c2448f', '#f09ac8'),
36+}
37+LIGHT = dict(ink='#1f1f1f', ink2='#3c4043', faint='#9aa0a6', line='#dadce0', sand='#b8862c', bg='#ffffff', muted='#5f6368')
38+DARK = dict(ink='#e8eaed', ink2='#c4c7c5', faint='#6f7479', line='#3c4043', sand='#d9b26a', bg='#1f2023', muted='#9aa0a6')
39+
40+
41+def _vars(c, f):
42+ return (f'--ink:{c["ink"]};--ink2:{c["ink2"]};--faint:{c["faint"]};--line:{c["line"]};--sand:{c["sand"]};'
43+ f'--bg:{c["bg"]};--muted:{c["muted"]};--f:{f}')
44+
45+
46+def style(field):
47+ light, dark = FIELD[field]
48+ return (f'<style>svg{{{_vars(LIGHT, light)}}}@media (prefers-color-scheme: dark){{svg{{{_vars(DARK, dark)}}}}}'
49+ '.ink{fill:var(--ink)}.ink-s{stroke:var(--ink);fill:none}.ink2-s{stroke:var(--ink2);fill:none}'
50+ '.f{fill:var(--f)}.f-s{stroke:var(--f);fill:none}.f-soft{fill:var(--f);fill-opacity:.14}'
51+ '.sand{fill:var(--sand)}.sand-s{stroke:var(--sand);fill:none}.faint{fill:var(--faint)}.faint-s{stroke:var(--faint);fill:none}'
52+ '.ring{stroke:var(--bg);stroke-width:3}.bg{fill:var(--bg)}.soft{fill-opacity:.16}'
53+ '.lbl{fill:var(--muted);font:400 19px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}'
54+ 'line,path,polyline{stroke-linecap:round;stroke-linejoin:round}</style>')
55+
56+
57+def f1(n):
58+ return f'{round(n, 1):g}'
59+
60+
61+def circle(x, y, r, cls, extra=''):
62+ return f'<circle class="{cls}" cx="{f1(x)}" cy="{f1(y)}" r="{f1(r)}"{extra}/>'
63+
64+
65+def dot(x, y, r=6, cls='ink'):
66+ """A point that stays readable on top of lines: filled, with a halo in the page's colour."""
67+ return circle(x, y, r, f'{cls} ring')
68+
69+
70+def line(x1, y1, x2, y2, cls='ink2-s', w=2, extra=''):
71+ return f'<line class="{cls}" x1="{f1(x1)}" y1="{f1(y1)}" x2="{f1(x2)}" y2="{f1(y2)}" stroke-width="{w}"{extra}/>'
72+
73+
74+def path(d, cls='ink2-s', w=2, extra=''):
75+ return f'<path class="{cls}" d="{d}" stroke-width="{w}"{extra}/>'
76+
77+
78+def polygon(pts, cls='f-soft', extra=''):
79+ return f'<polygon class="{cls}" points="{" ".join(f"{f1(x)},{f1(y)}" for x, y in pts)}"{extra}/>'
80+
81+
82+def polyline(pts, cls='ink2-s', w=2, extra=''):
83+ return f'<polyline class="{cls}" points="{" ".join(f"{f1(x)},{f1(y)}" for x, y in pts)}" stroke-width="{w}"{extra}/>'
84+
85+
86+DASH = ' stroke-dasharray="7 6"' # pass as `extra` for a dashed stroke
87+
88+
89+def polypath(pts, cls='ink2-s', w=2, closed=False, extra=''):
90+ """Many points as one relative path: the same line as polyline, a fraction of the bytes."""
91+ (x0, y0), d, px, py = pts[0], [], pts[0][0], pts[0][1]
92+ for x, y in pts[1:]:
93+ d.append(f'{f1(x - px)} {f1(y - py)}'); px, py = x, y
94+ return path(f'M{f1(x0)} {f1(y0)}l' + ' '.join(d) + ('z' if closed else ''), cls, w, extra)
95+
96+
97+def arrow(x1, y1, x2, y2, cls='ink2-s', w=2, head=10):
98+ """A line ending in an open arrowhead at (x2, y2)."""
99+ a = math.atan2(y2 - y1, x2 - x1)
100+ tips = [(x2 - head * math.cos(a - s), y2 - head * math.sin(a - s)) for s in (0.45, -0.45)]
101+ return line(x1, y1, x2, y2, cls, w) + polyline([tips[0], (x2, y2), tips[1]], cls, w)
102+
103+
104+def text(x, y, s, cls='lbl', anchor='middle'):
105+ s = s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
106+ return f'<text class="{cls}" x="{f1(x)}" y="{f1(y)}" text-anchor="{anchor}">{s}</text>'
107+
108+
109+def svg(field, body, label=None, title=''):
110+ """The whole figure. `label` is the one line naming what is drawn, at the bottom; leave room for it (y < 262)."""
111+ if field not in FIELD:
112+ raise ValueError(f'unknown field {field!r}')
113+ if label and len(label) > 50:
114+ raise ValueError(f'label over 50 characters (more does not fit at card size): {label!r}')
115+ t = f'<title>{title or label or ""}</title>'
116+ tail = text(W / 2, H - 16, label) if label else ''
117+ return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" role="img">{t}{style(field)}{body}{tail}</svg>\n'
118+
119+
120+def write(figure_py, field, body, label=None, title=''):
121+ """Writes cover.svg next to the figure.py that calls it."""
122+ out = Path(figure_py).resolve().parent / 'cover.svg'
123+ out.write_text(svg(field, body, label, title))
124+ return out
+0 −0 poster.webp added View file
Binary file not shown.
+6 −0 posters.json added View file
@@ -0,0 +1,6 @@
1+{
2+ "poster.webp": {
3+ "style": "poster",
4+ "idea": "A tactile crystal-energy landscape funnels countless candidate structures into a small stable basin."
5+ }
6+}
+43 −1 scienceslack.json View file
@@ -28,5 +28,47 @@
2828 "catalog": "0521c19bbd38"
2929 },
3030 "review": true,
31- "approval": "first-time"
31+ "approval": "first-time",
32+ "cover": {
33+ "file": "poster.webp"
34+ },
35+ "card": {
36+ "question": "Which of 215,488 invented crystals are stable, so that the expensive calculations go to the right ones?",
37+ "stake": "Data moves the score as much as method: one model gains from 0.831 to 0.925 on more data, and the best Materials Project-only model reaches 0.863.",
38+ "frontier": {
39+ "shape": "board",
40+ "metric": "F1 (stable class, unique prototypes)",
41+ "better": "higher",
42+ "asof": "2026-10-20",
43+ "rows": [
44+ {
45+ "label": "EquiformerV3+DeNS-OAM",
46+ "value": "0.931",
47+ "x": 0.931
48+ },
49+ {
50+ "label": "TECE-OAM-RRA-1.0",
51+ "value": "0.929",
52+ "x": 0.929
53+ },
54+ {
55+ "label": "EquFlashV2",
56+ "value": "0.929",
57+ "x": 0.929
58+ },
59+ {
60+ "label": "Prophet-OAME-MBD",
61+ "value": "0.928",
62+ "x": 0.928
63+ },
64+ {
65+ "label": "MACE-MP-0 (first generation)",
66+ "value": "0.669",
67+ "x": 0.669,
68+ "ref": true
69+ }
70+ ]
71+ },
72+ "first": "Beat F1 0.931 on the unique-prototype set, with the prediction files"
73+ }
3274 }