Yuan (Cyrus) Chiang commited on
Commit
75ac94f
·
1 Parent(s): b7d94da

Add bulk EOS and E-V scanning benchmark (#56)

Browse files

Add energy-volume scans (E-V scans) and equations of state (EOS) from 1,000 WBM subset selected with renormalized probability to balance element distribution.

* add structure db and workflow script

* add bulk eos parquets

* analysis

* fix e-v scanning code, update analysis (it will fail bc it is processing the old data)

* refactor and submit wbm ev scan

* add wbm ev to registry

* fix path mkdir

* fix path mkdir

* convert mattersim numpy float into primitive float

* add cache, fix mattersim

* add wbm ev scan parquets

* analyze EoS and EV scan

* json lfs

* update readme

* update analysis.py and summary tables; add hf page and rank

* delete outdated results and notebook

* update eos result and page

---------

Co-authored-by: matthewkuner <[email protected]>

track parquet with lfs

track ase db

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. .github/README.md +2 -2
  3. examples/eos_bulk/CHGNet.parquet +3 -0
  4. examples/eos_bulk/CHGNet_processed.parquet +3 -0
  5. examples/eos_bulk/M3GNet.parquet +3 -0
  6. examples/eos_bulk/M3GNet_processed.parquet +3 -0
  7. examples/eos_bulk/MACE-MP(M).parquet +3 -0
  8. examples/eos_bulk/MACE-MP(M)_processed.parquet +3 -0
  9. examples/eos_bulk/MACE-MPA.parquet +3 -0
  10. examples/eos_bulk/MACE-MPA_processed.parquet +3 -0
  11. examples/eos_bulk/MatterSim.parquet +3 -0
  12. examples/eos_bulk/MatterSim_processed.parquet +3 -0
  13. examples/eos_bulk/ORBv2.parquet +3 -0
  14. examples/eos_bulk/ORBv2_processed.parquet +3 -0
  15. examples/eos_bulk/SevenNet.parquet +3 -0
  16. examples/eos_bulk/SevenNet_processed.parquet +3 -0
  17. examples/eos_bulk/preprocessing.py +12 -0
  18. examples/eos_bulk/run.py +135 -0
  19. examples/eos_bulk/summary.csv +8 -0
  20. examples/eos_bulk/summary.tex +13 -0
  21. examples/wbm_ev/ALIGNN.parquet +3 -0
  22. examples/wbm_ev/ALIGNN_processed.parquet +3 -0
  23. examples/wbm_ev/CHGNet.parquet +3 -0
  24. examples/wbm_ev/CHGNet_processed.parquet +3 -0
  25. examples/wbm_ev/M3GNet.parquet +3 -0
  26. examples/wbm_ev/M3GNet_processed.parquet +3 -0
  27. examples/wbm_ev/MACE-MP(M).parquet +3 -0
  28. examples/wbm_ev/MACE-MP(M)_processed.parquet +3 -0
  29. examples/wbm_ev/MACE-MPA.parquet +3 -0
  30. examples/wbm_ev/MACE-MPA_processed.parquet +3 -0
  31. examples/wbm_ev/MatterSim.parquet +3 -0
  32. examples/wbm_ev/MatterSim_processed.parquet +3 -0
  33. examples/wbm_ev/ORBv2.parquet +3 -0
  34. examples/wbm_ev/ORBv2_processed.parquet +3 -0
  35. examples/wbm_ev/SevenNet.parquet +3 -0
  36. examples/wbm_ev/SevenNet_processed.parquet +3 -0
  37. examples/wbm_ev/eqV2(OMat).parquet +3 -0
  38. examples/wbm_ev/eqV2(OMat)_processed.parquet +3 -0
  39. examples/wbm_ev/run.py +163 -0
  40. examples/wbm_ev/summary.csv +10 -0
  41. examples/wbm_ev/summary.tex +15 -0
  42. examples/wbm_structures.db +3 -0
  43. mlip_arena/models/externals/mattersim.py +8 -2
  44. mlip_arena/models/registry.yaml +16 -0
  45. mlip_arena/tasks/optimize.py +1 -1
  46. mlip_arena/tasks/registry.yaml +12 -0
  47. serve/app.py +6 -4
  48. serve/leaderboard.py +10 -9
  49. serve/ranks/eos_bulk.py +63 -0
  50. serve/ranks/wbm_ev.py +63 -0
.gitattributes CHANGED
@@ -1 +1,3 @@
1
  *.json filter=lfs diff=lfs merge=lfs -text
 
 
 
1
  *.json filter=lfs diff=lfs merge=lfs -text
2
+ *.parquet filter=lfs diff=lfs merge=lfs -text
3
+ *.db filter=lfs diff=lfs merge=lfs -text
.github/README.md CHANGED
@@ -18,12 +18,12 @@ MLIP Arena leverages modern pythonic workflow orchestrator [Prefect](https://www
18
 
19
  ## Announcement
20
 
21
- - **[April 8, 2025]** [🎉 **MLIP Arena accepted as an ICLR AI4Mat Spotlight!** 🎉](https://openreview.net/forum?id=ysKfIavYQE#discussion) Huge thanks to all co-authors for their contributions!
22
 
23
 
24
  ## Installation
25
 
26
- ### From PyPI (without model running capability)
27
 
28
  ```bash
29
  pip install mlip-arena
 
18
 
19
  ## Announcement
20
 
21
+ - **[April 8, 2025]** [🎉 **MLIP Arena is accepted as an ICLR AI4Mat Spotlight!** 🎉](https://openreview.net/forum?id=ysKfIavYQE#discussion) Huge thanks to all co-authors for their contributions!
22
 
23
 
24
  ## Installation
25
 
26
+ ### From PyPI (prefect workflow only, without pretrained models)
27
 
28
  ```bash
29
  pip install mlip-arena
examples/eos_bulk/CHGNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68871d694e93a3c3e7e272b9cbd87d3757e3bc689f30f3189db232d76e629c07
3
+ size 429910
examples/eos_bulk/CHGNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6fbea63f9035e376bb5ac7db38175102ab3f96a0f8758cc3e9931424f829ac0
3
+ size 357919
examples/eos_bulk/M3GNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53dde465b5e10edd677f131f8a531e3dfc36303dd7ec7b9df0060c19847494d9
3
+ size 427419
examples/eos_bulk/M3GNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18ea51bf19c5e011e170a3229bbd63ce675a725c364e0cffb71de95459f8629e
3
+ size 379859
examples/eos_bulk/MACE-MP(M).parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff9769eeb83042129767aeff975eb04dee8efae12e96fbd46cd3039eeda26705
3
+ size 427896
examples/eos_bulk/MACE-MP(M)_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f492125c87400fee013d32904ee97df49a07d321bd393f9335c7bf4258fe159
3
+ size 371004
examples/eos_bulk/MACE-MPA.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53fcd188baddd4d5e797c5aa3de1b4368db711ebd29b7877cfe224856ba9d171
3
+ size 428888
examples/eos_bulk/MACE-MPA_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34bd9ae08656e374263820774f49e91a964aa8b2aeade4150cf62cfc08bb37f6
3
+ size 365289
examples/eos_bulk/MatterSim.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6717650b97782de6f90e4473075410fe4540279eb39338d2234d3c9399079b3
3
+ size 389586
examples/eos_bulk/MatterSim_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cca22b5db67dae59602adfb8c42a80da90b39c4e95af89ef918813351b422119
3
+ size 320962
examples/eos_bulk/ORBv2.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae13c9af1ae7fafe2a42ed4c47e2ba0f036abfa64a87ca517b92d89c62fcbfd9
3
+ size 427105
examples/eos_bulk/ORBv2_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c90e61645c83f2452bcd90ef9132c46266896217fe1dea9cca8e0d124d73821a
3
+ size 227929
examples/eos_bulk/SevenNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64be88ec2632cdabf79daa01acb2cf2ef19fef0557813df5502c4f71ec566f4e
3
+ size 428341
examples/eos_bulk/SevenNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cc03d9af93c001f3fa441b50f058506e13c0aa7cb3d329275e68f5ed80dc3e6
3
+ size 364846
examples/eos_bulk/preprocessing.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ from ase.db import connect
4
+ from pymatgen.core import Structure
5
+
6
+ with open("wbm_structures.json") as f:
7
+ structs = json.load(f)
8
+
9
+ with connect("wbm_structures.db") as db:
10
+ for id, s in structs.items():
11
+ atoms = Structure.from_dict(s).to_ase_atoms(msonable=False)
12
+ db.write(atoms, wbm_id=id)
examples/eos_bulk/run.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools
2
+ from pathlib import Path
3
+
4
+ import pandas as pd
5
+ from ase.db import connect
6
+ from dask.distributed import Client
7
+ from dask_jobqueue import SLURMCluster
8
+ from prefect import Task, flow, task
9
+ from prefect.client.schemas.objects import TaskRun
10
+ from prefect.states import State
11
+ from prefect_dask import DaskTaskRunner
12
+
13
+ from mlip_arena.models import REGISTRY, MLIPEnum
14
+ from mlip_arena.tasks.eos import run as EOS
15
+ from mlip_arena.tasks.optimize import run as OPT
16
+ from mlip_arena.tasks.utils import get_calculator
17
+
18
+
19
+ @task
20
+ def load_wbm_structures():
21
+ """
22
+ Load the WBM structures from a ASE DB file.
23
+ """
24
+ with connect("../wbm_structures.db") as db:
25
+ for row in db.select():
26
+ yield row.toatoms(add_additional_information=True)
27
+
28
+
29
+ def save_result(
30
+ tsk: Task,
31
+ run: TaskRun,
32
+ state: State,
33
+ model_name: str,
34
+ id: str,
35
+ ):
36
+ result = run.state.result()
37
+
38
+ assert isinstance(result, dict)
39
+
40
+ result["method"] = model_name
41
+ result["id"] = id
42
+ result.pop("atoms", None)
43
+
44
+ fpath = Path(f"{model_name}")
45
+ fpath.mkdir(exist_ok=True)
46
+
47
+ fpath = fpath / f"{result['id']}.pkl"
48
+
49
+ df = pd.DataFrame([result])
50
+ df.to_pickle(fpath)
51
+
52
+
53
+ @task
54
+ def eos_bulk(atoms, model):
55
+
56
+ calculator = get_calculator(
57
+ model
58
+ ) # avoid sending entire model over prefect and select freer GPU
59
+
60
+ result = OPT.with_options(
61
+ refresh_cache=True,
62
+ )(
63
+ atoms,
64
+ calculator,
65
+ optimizer="FIRE",
66
+ criterion=dict(
67
+ fmax=0.1,
68
+ ),
69
+ )
70
+
71
+ return EOS.with_options(
72
+ refresh_cache=True,
73
+ on_completion=[functools.partial(
74
+ save_result,
75
+ model_name=model.name,
76
+ id=atoms.info["key_value_pairs"]["wbm_id"],
77
+ )],
78
+ )(
79
+ atoms=result["atoms"],
80
+ calculator=calculator,
81
+ optimizer="FIRE",
82
+ npoints=21,
83
+ max_abs_strain=0.2,
84
+ concurrent=False
85
+ )
86
+
87
+
88
+ @flow
89
+ def run_all():
90
+ futures = []
91
+ for atoms in load_wbm_structures():
92
+ for model in MLIPEnum:
93
+ if "eos_bulk" not in REGISTRY[model.name].get("gpu-tasks", []):
94
+ continue
95
+ result = eos_bulk.submit(atoms, model)
96
+ futures.append(result)
97
+ return [f.result(raise_on_failure=False) for f in futures]
98
+
99
+
100
+ nodes_per_alloc = 1
101
+ gpus_per_alloc = 1
102
+ ntasks = 1
103
+
104
+ cluster_kwargs = dict(
105
+ cores=4,
106
+ memory="64 GB",
107
+ shebang="#!/bin/bash",
108
+ account="m3828",
109
+ walltime="00:50:00",
110
+ job_mem="0",
111
+ job_script_prologue=[
112
+ "source ~/.bashrc",
113
+ "module load python",
114
+ "source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena",
115
+ ],
116
+ job_directives_skip=["-n", "--cpus-per-task", "-J"],
117
+ job_extra_directives=[
118
+ "-J eos_bulk",
119
+ "-q regular",
120
+ f"-N {nodes_per_alloc}",
121
+ "-C gpu",
122
+ f"-G {gpus_per_alloc}",
123
+ "--exclusive",
124
+ ],
125
+ )
126
+
127
+ cluster = SLURMCluster(**cluster_kwargs)
128
+ print(cluster.job_script())
129
+ cluster.adapt(minimum_jobs=20, maximum_jobs=40)
130
+ client = Client(cluster)
131
+
132
+ run_all.with_options(
133
+ task_runner=DaskTaskRunner(address=client.scheduler.address),
134
+ log_prints=True,
135
+ )()
examples/eos_bulk/summary.csv ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ model,rank,rank-aggregation,energy-diff-flip-times,tortuosity,spearman-compression-energy,spearman-compression-derivative,spearman-tension-energy,missing
2
+ MACE-MPA,1,6,1.0370741482965933,1.005455197941088,-0.9993684338373716,0.9963320580555048,0.993186372745491,2
3
+ MACE-MP(M),2,16,1.042211055276382,1.008986842539345,-0.999329983249581,0.9941160347190496,0.9915857612939804,5
4
+ MatterSim,3,18,1.045135406218656,1.0060900449752808,-0.99734962463147,0.9927904926901917,0.9880977115916667,3
5
+ CHGNet,4,22,1.1053159478435306,1.014753469076796,-0.9964985866690981,0.9929971733381963,0.9866417434120545,3
6
+ SevenNet,5,27,1.1093279839518555,1.0186969977862483,-0.9981277164827815,0.9889121911188109,0.9859580417030127,3
7
+ M3GNet,6,33,1.1748743718592964,1.0175007963267957,-0.9963209989340641,0.9897426526572255,0.9801690217498693,5
8
+ ORBv2,7,42,1.3162134944612287,1.0374718753890275,-0.9918459519667977,0.9701425127407,0.9637462235649547,7
examples/eos_bulk/summary.tex ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ \begin{tabular}{lrrrrrrrl}
2
+ \toprule
3
+ model & rank & rank-aggregation & energy-diff-flip-times & tortuosity & spearman-compression-energy & spearman-compression-derivative & spearman-tension-energy & missing \\
4
+ \midrule
5
+ MACE-MPA & 1 & 6 & 1.037074 & 1.005455 & -0.999368 & 0.996332 & 0.993186 & 2 \\
6
+ MACE-MP(M) & 2 & 16 & 1.042211 & 1.008987 & -0.999330 & 0.994116 & 0.991586 & 5 \\
7
+ MatterSim & 3 & 18 & 1.045135 & 1.006090 & -0.997350 & 0.992790 & 0.988098 & 3 \\
8
+ CHGNet & 4 & 22 & 1.105316 & 1.014753 & -0.996499 & 0.992997 & 0.986642 & 3 \\
9
+ SevenNet & 5 & 27 & 1.109328 & 1.018697 & -0.998128 & 0.988912 & 0.985958 & 3 \\
10
+ M3GNet & 6 & 33 & 1.174874 & 1.017501 & -0.996321 & 0.989743 & 0.980169 & 5 \\
11
+ ORBv2 & 7 & 42 & 1.316213 & 1.037472 & -0.991846 & 0.970143 & 0.963746 & 7 \\
12
+ \bottomrule
13
+ \end{tabular}
examples/wbm_ev/ALIGNN.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b84592b56c667f49e510f382c07f2dd4105df71468c2198c3958b2d0066202b
3
+ size 425244
examples/wbm_ev/ALIGNN_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1d3f3d2992c02464fdc5a4d58ca05de553dffab355b08e99a46d3b6d2495d11
3
+ size 368547
examples/wbm_ev/CHGNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06342370be572819441a9c706f3e70555c6ac0bf75d0fdaa35f2f574c9f600cd
3
+ size 424462
examples/wbm_ev/CHGNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50bbb0ed4ba3e8af06c2a90e927182132be1f988643dd7b6844d39fe4dd1084c
3
+ size 357683
examples/wbm_ev/M3GNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:841aaa082db265939b3a3ada6f0d6901e65cb942277b074ca55cbdd7730dde75
3
+ size 411741
examples/wbm_ev/M3GNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:411b2f619314dafb34349a65d985b7b881cb21687ecb9a853da29fc21d6fa714
3
+ size 357786
examples/wbm_ev/MACE-MP(M).parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1551823daef888914de951f2610ee6ffdfd2b0d6f33e1e293614534cdd217196
3
+ size 409083
examples/wbm_ev/MACE-MP(M)_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:877cd9e9407f9402fc01510d051ad19db815e9794c87ee8402f306e2afafd45e
3
+ size 359765
examples/wbm_ev/MACE-MPA.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eedf48b2478811a1dca46eb50d607004dca99f54c81909f331c550317f14cd19
3
+ size 407912
examples/wbm_ev/MACE-MPA_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee5167ef38acf130548c5f5cbf78fedd14b7de7df47c72d771997f4e13302c0b
3
+ size 356642
examples/wbm_ev/MatterSim.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3d587fd71a817968a513b727a174c353c97552bc7674e5d3a4108e2b6233556
3
+ size 408998
examples/wbm_ev/MatterSim_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:107a30bb5541a861e4141be0db3de210ca2229a22d975f732f107f0e6afdeb0f
3
+ size 356292
examples/wbm_ev/ORBv2.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ee9f2322096fbeb103a85b0735ed0d547f93e34f1c113af3619baf35c7acbc3
3
+ size 415496
examples/wbm_ev/ORBv2_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01525c5b2e37b8d930c94ee2dc257b8d7c36b24111206ba2efc499a8bc172fcd
3
+ size 357949
examples/wbm_ev/SevenNet.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6850c333c0b754b942efcfac11739ae199a9f3c816da4e0e6b26bc9a037a0524
3
+ size 410197
examples/wbm_ev/SevenNet_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83d9c45216940262575bc7386c62f8b79bb3ac5e63b8ab33ca4307976bb9796f
3
+ size 358345
examples/wbm_ev/eqV2(OMat).parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7521597cd3189c0a3cea18ae98d9310bfc6becd50fca5e6f2c97af5e69b2596d
3
+ size 414251
examples/wbm_ev/eqV2(OMat)_processed.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50f318dce825e939a5c24aa8789acb2952865e0c682462f99cfed204ea9fba64
3
+ size 356693
examples/wbm_ev/run.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ import numpy as np
4
+ import pandas as pd
5
+ from ase.db import connect
6
+ from dask.distributed import Client
7
+ from dask_jobqueue import SLURMCluster
8
+ from prefect import flow, task
9
+ from prefect.runtime import task_run
10
+ from prefect_dask import DaskTaskRunner
11
+ from prefect.cache_policies import INPUTS, TASK_SOURCE
12
+
13
+ from mlip_arena.models import REGISTRY, MLIPEnum
14
+ from mlip_arena.tasks.utils import get_calculator
15
+
16
+
17
+ @task
18
+ def load_wbm_structures():
19
+ """
20
+ Load the WBM structures from an ASE database file.
21
+
22
+ Reads structures from 'wbm_structures.db' and yields them as ASE Atoms objects
23
+ with additional metadata preserved from the database.
24
+
25
+ Yields:
26
+ ase.Atoms: Individual atomic structures from the WBM database with preserved
27
+ metadata in the .info dictionary.
28
+ """
29
+ with connect("../wbm_structures.db") as db:
30
+ for row in db.select():
31
+ yield row.toatoms(add_additional_information=True)
32
+
33
+ @task(
34
+ name="E-V Scan",
35
+ task_run_name=lambda: f"{task_run.task_name}: {task_run.parameters['atoms'].get_chemical_formula()} - {task_run.parameters['model'].name}",
36
+ cache_policy=TASK_SOURCE + INPUTS,
37
+ )
38
+ def ev_scan(atoms, model):
39
+ """
40
+ Perform an energy-volume scan for a given model and atomic structure.
41
+
42
+ This function applies uniaxial strain to the structure in all three dimensions,
43
+ maintaining the fractional coordinates of atoms, and computes the energy at each
44
+ deformation point using the specified model.
45
+
46
+ Args:
47
+ atoms: ASE atoms object containing the structure to analyze.
48
+ model: MLIPEnum model to use for the energy calculations.
49
+
50
+ Returns:
51
+ dict: Results dictionary containing:
52
+ - method (str): The name of the model used
53
+ - id (str): The WBM ID of the structure
54
+ - eos (dict): Energy of state data with:
55
+ - volumes (list): Volume of the unit cell at each strain point
56
+ - energies (list): Computed potential energy at each strain point
57
+
58
+ Note:
59
+ The strain range is fixed at ±20% with 21 evenly spaced points.
60
+ Results are also saved as a JSON file in a directory named after the model.
61
+ """
62
+ calculator = get_calculator(
63
+ model
64
+ ) # avoid sending entire model over prefect and select freer GPU
65
+
66
+ wbm_id = atoms.info["key_value_pairs"]["wbm_id"]
67
+
68
+ c0 = atoms.get_cell()
69
+ max_abs_strain = 0.2
70
+ npoints = 21
71
+ volumes = []
72
+ energies = []
73
+ for uniaxial_strain in np.linspace(-max_abs_strain, max_abs_strain, npoints):
74
+ cloned = atoms.copy()
75
+ scale_factor = uniaxial_strain + 1
76
+ cloned.set_cell(c0 * scale_factor, scale_atoms=True)
77
+ cloned.calc = calculator
78
+ volumes.append(cloned.get_volume())
79
+ energies.append(cloned.get_potential_energy())
80
+
81
+ data = {
82
+ "method": model.name,
83
+ "id": wbm_id,
84
+ "eos": {
85
+ "volumes": volumes, "energies": energies
86
+ }
87
+ }
88
+
89
+ fpath = Path(f"{model.name}") / f"{wbm_id}.json"
90
+ fpath.parent.mkdir(exist_ok=True)
91
+
92
+ df = pd.DataFrame([data])
93
+ df.to_json(fpath)
94
+
95
+ return df
96
+
97
+
98
+ @flow
99
+ def submit_tasks():
100
+ """
101
+ Create and submit energy-volume scan tasks for subsampled WBM structures and applicable models.
102
+
103
+ This flow function:
104
+ 1. Loads all structures from the WBM database
105
+ 2. Iterates through available models in MLIPEnum
106
+ 3. Filters models based on their capability to handle the 'wbm_ev' GPU task
107
+ 4. Submits parallel ev_scan tasks for all valid (structure, model) combinations
108
+ 5. Collects and returns results from all tasks
109
+
110
+ Returns:
111
+ list: Results from all executed tasks (successful or failed)
112
+ """
113
+ futures = []
114
+ for atoms in load_wbm_structures():
115
+ for model in MLIPEnum:
116
+ if "wbm_ev" not in REGISTRY[model.name].get("gpu-tasks", []):
117
+ continue
118
+ try:
119
+ result = ev_scan.submit(atoms, model)
120
+ except Exception as e:
121
+ print(f"Failed to submit task for {model.name}: {e}")
122
+ continue
123
+ futures.append(result)
124
+ return [f.result(raise_on_failure=False) for f in futures]
125
+
126
+
127
+ nodes_per_alloc = 1
128
+ gpus_per_alloc = 1
129
+ ntasks = 1
130
+
131
+ cluster_kwargs = dict(
132
+ cores=1,
133
+ memory="64 GB",
134
+ processes=1,
135
+ shebang="#!/bin/bash",
136
+ account="m3828",
137
+ walltime="00:30:00",
138
+ # job_mem="0",
139
+ job_script_prologue=[
140
+ "source ~/.bashrc",
141
+ "module load python",
142
+ "source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena",
143
+ ],
144
+ job_directives_skip=["-n", "--cpus-per-task", "-J"],
145
+ job_extra_directives=[
146
+ "-J wbm_ev",
147
+ "-q debug",
148
+ f"-N {nodes_per_alloc}",
149
+ "-C gpu",
150
+ f"-G {gpus_per_alloc}",
151
+ "--exclusive",
152
+ ],
153
+ )
154
+
155
+ cluster = SLURMCluster(**cluster_kwargs)
156
+ print(cluster.job_script())
157
+ cluster.adapt(minimum_jobs=2, maximum_jobs=2)
158
+ client = Client(cluster)
159
+
160
+ submit_tasks.with_options(
161
+ task_runner=DaskTaskRunner(address=client.scheduler.address),
162
+ log_prints=True,
163
+ )()
examples/wbm_ev/summary.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ model,rank,rank-aggregation,energy-diff-flip-times,tortuosity,spearman-compression-energy,spearman-compression-derivative,spearman-tension-energy,missing
2
+ MACE-MPA,1,11,1.0,1.000675741122765,-0.9983393939393939,0.9993090909090908,0.9987181818181818,0
3
+ CHGNet,2,14,1.0,1.0006287770651048,-0.9982787878787878,0.9439636363636364,0.999090909090909,0
4
+ MatterSim,3,19,1.009,1.000567338639546,-0.9980969696969696,0.9997090909090908,0.9937541835359507,0
5
+ eqV2(OMat),4,22,1.035,1.0008346292192054,-0.9982060606060604,0.9972242424242423,0.9986454545454545,0
6
+ M3GNet,5,24,1.002,1.0020010929112253,-0.9975878787878787,0.997442424242424,0.9964676571137886,0
7
+ ORBv2,6,29,1.058,1.004064906459821,-0.9977696969696969,0.970751515151515,0.9976,0
8
+ SevenNet,7,33,1.034,1.0100246177550205,-0.9951636363636364,0.9465575757575757,0.9947048195608054,0
9
+ MACE-MP(M),8,35,1.121,1.0807128149289842,-0.9438060606060605,0.9011878787878788,0.9987454545454546,0
10
+ ALIGNN,9,46,3.909,1.3756517739089669,-0.8892069391323368,0.7602706775644651,0.862085379002138,0
examples/wbm_ev/summary.tex ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ \begin{tabular}{lrrrrrrrl}
2
+ \toprule
3
+ model & rank & rank-aggregation & energy-diff-flip-times & tortuosity & spearman-compression-energy & spearman-compression-derivative & spearman-tension-energy & missing \\
4
+ \midrule
5
+ MACE-MPA & 1 & 11 & 1.000000 & 1.000676 & -0.998339 & 0.999309 & 0.998718 & 0 \\
6
+ CHGNet & 2 & 14 & 1.000000 & 1.000629 & -0.998279 & 0.943964 & 0.999091 & 0 \\
7
+ MatterSim & 3 & 19 & 1.009000 & 1.000567 & -0.998097 & 0.999709 & 0.993754 & 0 \\
8
+ eqV2(OMat) & 4 & 22 & 1.035000 & 1.000835 & -0.998206 & 0.997224 & 0.998645 & 0 \\
9
+ M3GNet & 5 & 24 & 1.002000 & 1.002001 & -0.997588 & 0.997442 & 0.996468 & 0 \\
10
+ ORBv2 & 6 & 29 & 1.058000 & 1.004065 & -0.997770 & 0.970752 & 0.997600 & 0 \\
11
+ SevenNet & 7 & 33 & 1.034000 & 1.010025 & -0.995164 & 0.946558 & 0.994705 & 0 \\
12
+ MACE-MP(M) & 8 & 35 & 1.121000 & 1.080713 & -0.943806 & 0.901188 & 0.998745 & 0 \\
13
+ ALIGNN & 9 & 46 & 3.909000 & 1.375652 & -0.889207 & 0.760271 & 0.862085 & 0 \\
14
+ \bottomrule
15
+ \end{tabular}
examples/wbm_structures.db ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc387c7787c21e7ff2ab80d5428c60b9e817c9b37f53e03c0f5e5e72dc44fe88
3
+ size 782336
mlip_arena/models/externals/mattersim.py CHANGED
@@ -5,9 +5,7 @@ from pathlib import Path
5
  import yaml
6
  from mattersim.forcefield import MatterSimCalculator
7
 
8
- from ase import Atoms
9
  from mlip_arena.models.utils import get_freer_device
10
- # from pymatgen.io.ase import AseAtomsAdaptor, MSONAtoms
11
 
12
  with open(Path(__file__).parents[1] / "registry.yaml", encoding="utf-8") as f:
13
  REGISTRY = yaml.safe_load(f)
@@ -24,6 +22,14 @@ class MatterSim(MatterSimCalculator):
24
  load_path=checkpoint, device=str(device or get_freer_device()), **kwargs
25
  )
26
 
 
 
 
 
 
 
 
 
27
  def __getstate__(self):
28
  state = self.__dict__.copy()
29
 
 
5
  import yaml
6
  from mattersim.forcefield import MatterSimCalculator
7
 
 
8
  from mlip_arena.models.utils import get_freer_device
 
9
 
10
  with open(Path(__file__).parents[1] / "registry.yaml", encoding="utf-8") as f:
11
  REGISTRY = yaml.safe_load(f)
 
22
  load_path=checkpoint, device=str(device or get_freer_device()), **kwargs
23
  )
24
 
25
+ def get_potential_energy(self, atoms=None, force_consistent=False):
26
+ return float(
27
+ super().get_potential_energy(
28
+ atoms=atoms,
29
+ force_consistent=force_consistent,
30
+ )
31
+ ) # mattersim return numpy float instead of python float
32
+
33
  def __getstate__(self):
34
  state = self.__dict__.copy()
35
 
mlip_arena/models/registry.yaml CHANGED
@@ -15,6 +15,8 @@ MACE-MP(M):
15
  - homonuclear-diatomics
16
  - stability
17
  - combustion
 
 
18
  github: https://github.com/ACEsuit/mace
19
  doi: https://arxiv.org/abs/2401.00096
20
  date: 2023-12-29
@@ -38,6 +40,8 @@ CHGNet:
38
  - homonuclear-diatomics
39
  - stability
40
  - combustion
 
 
41
  github: https://github.com/CederGroupHub/chgnet
42
  doi: https://doi.org/10.1038/s42256-023-00716-3
43
  date: 2023-02-28
@@ -61,6 +65,8 @@ M3GNet:
61
  - homonuclear-diatomics
62
  - combustion
63
  - stability
 
 
64
  github: https://github.com/materialsvirtuallab/matgl
65
  doi: https://doi.org/10.1038/s43588-022-00349-3
66
  date: 2022-02-05
@@ -87,6 +93,8 @@ MatterSim:
87
  - homonuclear-diatomics
88
  - stability
89
  - combustion
 
 
90
  github: https://github.com/microsoft/mattersim
91
  doi: https://arxiv.org/abs/2405.04967
92
  date: 2024-12-05
@@ -113,6 +121,8 @@ ORBv2:
113
  - homonuclear-diatomics
114
  - combustion
115
  - stability
 
 
116
  github: https://github.com/orbital-materials/orb-models
117
  doi: https://arxiv.org/abs/2410.22570
118
  date: 2024-10-15
@@ -136,6 +146,8 @@ SevenNet:
136
  - homonuclear-diatomics
137
  - stability
138
  - combustion
 
 
139
  github: https://github.com/MDIL-SNU/SevenNet
140
  doi: https://doi.org/10.1021/acs.jctc.4c00190
141
  date: 2024-07-11
@@ -161,6 +173,7 @@ eqV2(OMat):
161
  - eos_alloy
162
  gpu-tasks:
163
  - homonuclear-diatomics
 
164
  prediction: EFS
165
  nvt: true
166
  npt: false # https://github.com/FAIR-Chem/fairchem/issues/888, https://github.com/atomind-ai/mlip-arena/issues/17
@@ -184,6 +197,8 @@ MACE-MPA:
184
  gpu-tasks:
185
  - homonuclear-diatomics
186
  - stability
 
 
187
  github: https://github.com/ACEsuit/mace
188
  doi: https://arxiv.org/abs/2401.00096
189
  date: 2024-12-09
@@ -336,6 +351,7 @@ ALIGNN:
336
  gpu-tasks:
337
  - homonuclear-diatomics
338
  - stability
 
339
  # - combustion
340
  prediction: EFS
341
  nvt: true
 
15
  - homonuclear-diatomics
16
  - stability
17
  - combustion
18
+ - eos_bulk
19
+ - wbm_ev
20
  github: https://github.com/ACEsuit/mace
21
  doi: https://arxiv.org/abs/2401.00096
22
  date: 2023-12-29
 
40
  - homonuclear-diatomics
41
  - stability
42
  - combustion
43
+ - eos_bulk
44
+ - wbm_ev
45
  github: https://github.com/CederGroupHub/chgnet
46
  doi: https://doi.org/10.1038/s42256-023-00716-3
47
  date: 2023-02-28
 
65
  - homonuclear-diatomics
66
  - combustion
67
  - stability
68
+ - eos_bulk
69
+ - wbm_ev
70
  github: https://github.com/materialsvirtuallab/matgl
71
  doi: https://doi.org/10.1038/s43588-022-00349-3
72
  date: 2022-02-05
 
93
  - homonuclear-diatomics
94
  - stability
95
  - combustion
96
+ - eos_bulk
97
+ - wbm_ev
98
  github: https://github.com/microsoft/mattersim
99
  doi: https://arxiv.org/abs/2405.04967
100
  date: 2024-12-05
 
121
  - homonuclear-diatomics
122
  - combustion
123
  - stability
124
+ - eos_bulk
125
+ - wbm_ev
126
  github: https://github.com/orbital-materials/orb-models
127
  doi: https://arxiv.org/abs/2410.22570
128
  date: 2024-10-15
 
146
  - homonuclear-diatomics
147
  - stability
148
  - combustion
149
+ - eos_bulk
150
+ - wbm_ev
151
  github: https://github.com/MDIL-SNU/SevenNet
152
  doi: https://doi.org/10.1021/acs.jctc.4c00190
153
  date: 2024-07-11
 
173
  - eos_alloy
174
  gpu-tasks:
175
  - homonuclear-diatomics
176
+ - wbm_ev
177
  prediction: EFS
178
  nvt: true
179
  npt: false # https://github.com/FAIR-Chem/fairchem/issues/888, https://github.com/atomind-ai/mlip-arena/issues/17
 
197
  gpu-tasks:
198
  - homonuclear-diatomics
199
  - stability
200
+ - eos_bulk
201
+ - wbm_ev
202
  github: https://github.com/ACEsuit/mace
203
  doi: https://arxiv.org/abs/2401.00096
204
  date: 2024-12-09
 
351
  gpu-tasks:
352
  - homonuclear-diatomics
353
  - stability
354
+ - wbm_ev
355
  # - combustion
356
  prediction: EFS
357
  nvt: true
mlip_arena/tasks/optimize.py CHANGED
@@ -78,7 +78,7 @@ def run(
78
 
79
  filter_kwargs = filter_kwargs or {}
80
  optimizer_kwargs = optimizer_kwargs or {}
81
- criterion = criterion or {}
82
 
83
  if symmetry:
84
  atoms.set_constraint(FixSymmetry(atoms))
 
78
 
79
  filter_kwargs = filter_kwargs or {}
80
  optimizer_kwargs = optimizer_kwargs or {}
81
+ criterion = criterion or dict(steps=1000)
82
 
83
  if symmetry:
84
  atoms.set_constraint(FixSymmetry(atoms))
mlip_arena/tasks/registry.yaml CHANGED
@@ -4,6 +4,18 @@ Homonuclear diatomics:
4
  task-layout: wide
5
  rank-page: homonuclear-diatomics
6
  last-update: 2024-09-19
 
 
 
 
 
 
 
 
 
 
 
 
7
  Combustion:
8
  category: Molecular Dynamics
9
  task-page: combustion
 
4
  task-layout: wide
5
  rank-page: homonuclear-diatomics
6
  last-update: 2024-09-19
7
+ Energy-volume scans:
8
+ category: Fundamentals
9
+ task-page: wbm_ev
10
+ task-layout: wide
11
+ rank-page: wbm_ev
12
+ last-update: 2025-04-29
13
+ Equation of state:
14
+ category: Fundamentals
15
+ task-page: eos_bulk
16
+ task-layout: wide
17
+ rank-page: eos_bulk
18
+ last-update: 2025-04-29
19
  Combustion:
20
  category: Molecular Dynamics
21
  task-page: combustion
serve/app.py CHANGED
@@ -15,6 +15,8 @@ nav[""].append(leaderboard)
15
  wide_pages, centered_pages = [], []
16
 
17
  for task in TASKS:
 
 
18
  page = st.Page(
19
  f"tasks/{TASKS[task]['task-page']}.py", title=task, icon=":material/target:"
20
  )
@@ -50,10 +52,10 @@ else:
50
  )
51
 
52
 
53
- st.toast(
54
- "MLIP Arena is currently in **pre-alpha**. The results are not stable. Please interpret them with care. Contributions are welcome. For more information, visit https://github.com/atomind-ai/mlip-arena.",
55
- icon="🍞",
56
- )
57
 
58
  st.sidebar.page_link(
59
  "https://github.com/atomind-ai/mlip-arena", label="GitHub Repository", icon=":material/code:"
 
15
  wide_pages, centered_pages = [], []
16
 
17
  for task in TASKS:
18
+ if TASKS[task]['task-page'] is None:
19
+ continue
20
  page = st.Page(
21
  f"tasks/{TASKS[task]['task-page']}.py", title=task, icon=":material/target:"
22
  )
 
52
  )
53
 
54
 
55
+ # st.toast(
56
+ # "MLIP Arena is currently in **pre-alpha**. The results are not stable. Please interpret them with care. Contributions are welcome. For more information, visit https://github.com/atomind-ai/mlip-arena.",
57
+ # icon="🍞",
58
+ # )
59
 
60
  st.sidebar.page_link(
61
  "https://github.com/atomind-ai/mlip-arena", label="GitHub Repository", icon=":material/code:"
serve/leaderboard.py CHANGED
@@ -59,10 +59,10 @@ s = table.style.background_gradient(
59
  cmap="PuRd", subset=["Element Coverage"], vmin=0, vmax=120
60
  )
61
 
62
- st.warning(
63
- "MLIP Arena is currently in **pre-alpha**. The results are not stable. Please interpret them with care.",
64
- icon="⚠️",
65
- )
66
  st.info(
67
  "Contributions are welcome. For more information, visit https://github.com/atomind-ai/mlip-arena.",
68
  icon="🤗",
@@ -117,11 +117,12 @@ for task in TASKS:
117
 
118
  task_module = importlib.import_module(f"ranks.{TASKS[task]['rank-page']}")
119
 
120
- st.page_link(
121
- f"tasks/{TASKS[task]['task-page']}.py",
122
- label="Go to the associated task page",
123
- icon=":material/link:",
124
- )
 
125
 
126
  # Call the function from the imported module
127
  if hasattr(task_module, "render"):
 
59
  cmap="PuRd", subset=["Element Coverage"], vmin=0, vmax=120
60
  )
61
 
62
+ # st.warning(
63
+ # "MLIP Arena is currently in **pre-alpha**. The results are not stable. Please interpret them with care.",
64
+ # icon="⚠️",
65
+ # )
66
  st.info(
67
  "Contributions are welcome. For more information, visit https://github.com/atomind-ai/mlip-arena.",
68
  icon="🤗",
 
117
 
118
  task_module = importlib.import_module(f"ranks.{TASKS[task]['rank-page']}")
119
 
120
+ if TASKS[task]['task-page'] is not None:
121
+ st.page_link(
122
+ f"tasks/{TASKS[task]['task-page']}.py",
123
+ label="Go to the associated task page",
124
+ icon=":material/link:",
125
+ )
126
 
127
  # Call the function from the imported module
128
  if hasattr(task_module, "render"):
serve/ranks/eos_bulk.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ import pandas as pd
4
+ import streamlit as st
5
+
6
+ DATA_DIR = Path("examples/eos_bulk")
7
+
8
+
9
+ table = pd.read_csv(DATA_DIR / "summary.csv")
10
+
11
+
12
+
13
+ table = table.rename(
14
+ columns={
15
+ "model": "Model",
16
+ "rank": "Rank",
17
+ "rank-aggregation": "Rank aggr.",
18
+ "energy-diff-flip-times": "Derivative flips",
19
+ "tortuosity": "Tortuosity",
20
+ "spearman-compression-energy": "Spearman's coeff. (compression)",
21
+ "spearman-tension-energy": "Spearman's coeff. (tension)",
22
+ "spearman-compression-derivative": "Spearman's coeff. (compression derivative)",
23
+ "missing": "Missing",
24
+ },
25
+ )
26
+
27
+ table.set_index("Model", inplace=True)
28
+
29
+ s = (
30
+ table.style.background_gradient(
31
+ cmap="Blues",
32
+ subset=["Rank", "Rank aggr."],
33
+ ).background_gradient(
34
+ cmap="Reds",
35
+ subset=[
36
+ "Spearman's coeff. (compression)",
37
+ ],
38
+ ).background_gradient(
39
+ cmap="Reds_r",
40
+ subset=[
41
+ "Spearman's coeff. (tension)",
42
+ "Spearman's coeff. (compression derivative)",
43
+ ],
44
+ ).background_gradient(
45
+ cmap="RdPu",
46
+ subset=["Tortuosity", "Derivative flips"],
47
+ ).format(
48
+ "{:.5f}",
49
+ subset=[
50
+ "Spearman's coeff. (compression)",
51
+ "Spearman's coeff. (tension)",
52
+ "Spearman's coeff. (compression derivative)",
53
+ "Tortuosity",
54
+ "Derivative flips",
55
+ ],
56
+ )
57
+ )
58
+
59
+ def render():
60
+ st.dataframe(
61
+ s,
62
+ use_container_width=True,
63
+ )
serve/ranks/wbm_ev.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ import pandas as pd
4
+ import streamlit as st
5
+
6
+ DATA_DIR = Path("examples/wbm_ev")
7
+
8
+
9
+ table = pd.read_csv(DATA_DIR / "summary.csv")
10
+
11
+
12
+
13
+ table = table.rename(
14
+ columns={
15
+ "model": "Model",
16
+ "rank": "Rank",
17
+ "rank-aggregation": "Rank aggr.",
18
+ "energy-diff-flip-times": "Derivative flips",
19
+ "tortuosity": "Tortuosity",
20
+ "spearman-compression-energy": "Spearman's coeff. (compression)",
21
+ "spearman-tension-energy": "Spearman's coeff. (tension)",
22
+ "spearman-compression-derivative": "Spearman's coeff. (compression derivative)",
23
+ "missing": "Missing",
24
+ },
25
+ )
26
+
27
+ table.set_index("Model", inplace=True)
28
+
29
+ s = (
30
+ table.style.background_gradient(
31
+ cmap="Blues",
32
+ subset=["Rank", "Rank aggr."],
33
+ ).background_gradient(
34
+ cmap="Reds",
35
+ subset=[
36
+ "Spearman's coeff. (compression)",
37
+ ],
38
+ ).background_gradient(
39
+ cmap="Reds_r",
40
+ subset=[
41
+ "Spearman's coeff. (tension)",
42
+ "Spearman's coeff. (compression derivative)",
43
+ ],
44
+ ).background_gradient(
45
+ cmap="RdPu",
46
+ subset=["Tortuosity", "Derivative flips"],
47
+ ).format(
48
+ "{:.5f}",
49
+ subset=[
50
+ "Spearman's coeff. (compression)",
51
+ "Spearman's coeff. (tension)",
52
+ "Spearman's coeff. (compression derivative)",
53
+ "Tortuosity",
54
+ "Derivative flips",
55
+ ],
56
+ )
57
+ )
58
+
59
+ def render():
60
+ st.dataframe(
61
+ s,
62
+ use_container_width=True,
63
+ )