Yuan (Cyrus) Chiang commited on
Commit
c19aed5
1 Parent(s): fdb2bc5

add thermal conductivity rank and page (#16)

Browse files

* add thermal conductivity page

* add thermal conductivity rank

* add streamlit config

* add wte csv file

* add wte csv file

* add metric explanation; update page

.streamlit/config.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [server]
2
+ fileWatcherType = "poll"
mlip_arena/__init__.py CHANGED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ PKG_DIR = Path(__file__).parent
mlip_arena/models/__init__.py CHANGED
@@ -22,7 +22,7 @@ for model, metadata in REGISTRY.items():
22
  try:
23
  module = importlib.import_module(f"{__package__}.{metadata['module']}.{metadata['family']}")
24
  MLIPMap[model] = getattr(module, metadata["class"])
25
- except ModuleNotFoundError as e:
26
  print(e)
27
  continue
28
 
 
22
  try:
23
  module = importlib.import_module(f"{__package__}.{metadata['module']}.{metadata['family']}")
24
  MLIPMap[model] = getattr(module, metadata["class"])
25
+ except (ModuleNotFoundError, AttributeError) as e:
26
  print(e)
27
  continue
28
 
mlip_arena/models/registry.yaml CHANGED
@@ -10,8 +10,6 @@ MACE-MP(M):
10
  datasets:
11
  - MPTrj # TODO: fake HF dataset repo
12
  cpu-tasks:
13
- - alexandria
14
- - qmof
15
  gpu-tasks:
16
  - homonuclear-diatomics
17
  - stability
@@ -79,8 +77,6 @@ ORB:
79
  - MPTrj # TODO: fake HF dataset repo
80
  - Alexandria
81
  cpu-tasks:
82
- - alexandria
83
- - qmof
84
  gpu-tasks:
85
  - homonuclear-diatomics
86
  - combustion
@@ -104,8 +100,6 @@ SevenNet:
104
  datasets:
105
  - MPTrj # TODO: fake HF dataset repo
106
  cpu-tasks:
107
- - alexandria
108
- - qmof
109
  gpu-tasks:
110
  - homonuclear-diatomics
111
  - stability
@@ -215,8 +209,6 @@ MACE-OFF(M):
215
  datasets:
216
  - SPICE # TODO: fake HF dataset repo
217
  cpu-tasks:
218
- - alexandria
219
- - qmof
220
  gpu-tasks:
221
  - homonuclear-diatomics
222
  github: https://github.com/ACEsuit/mace
@@ -263,4 +255,40 @@ DeepMD:
263
  date: 2024-10-09
264
  prediction: EFS
265
  nvt: true
266
- npt: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  datasets:
11
  - MPTrj # TODO: fake HF dataset repo
12
  cpu-tasks:
 
 
13
  gpu-tasks:
14
  - homonuclear-diatomics
15
  - stability
 
77
  - MPTrj # TODO: fake HF dataset repo
78
  - Alexandria
79
  cpu-tasks:
 
 
80
  gpu-tasks:
81
  - homonuclear-diatomics
82
  - combustion
 
100
  datasets:
101
  - MPTrj # TODO: fake HF dataset repo
102
  cpu-tasks:
 
 
103
  gpu-tasks:
104
  - homonuclear-diatomics
105
  - stability
 
209
  datasets:
210
  - SPICE # TODO: fake HF dataset repo
211
  cpu-tasks:
 
 
212
  gpu-tasks:
213
  - homonuclear-diatomics
214
  github: https://github.com/ACEsuit/mace
 
255
  date: 2024-10-09
256
  prediction: EFS
257
  nvt: true
258
+ npt: true
259
+
260
+ ORBv2(MPTrj):
261
+ module: externals
262
+ class: ORBv2
263
+ family: orb
264
+ package:
265
+ checkpoint: orb-mptraj-only-v2-20241014.ckpt
266
+ username:
267
+ last-update: 2024-10-29T00:00:00
268
+ datetime: 2024-10-29T00:00:00 # TODO: Fake datetime
269
+ datasets:
270
+ - MPTrj
271
+ github: https://github.com/orbital-materials/orb-models
272
+ doi:
273
+ date: 2024-10-15
274
+ prediction: EFS
275
+ nvt: true
276
+ npt: true
277
+
278
+ eqV2(MPTrj-S):
279
+ module: externals
280
+ class: eqV2
281
+ family: fairchem
282
+ package: fairchem-core==1.2.0
283
+ checkpoint: eqV2_31M_mp.pt
284
+ username: fairchem # HF handle
285
+ last-update: 2024-10-29T00:00:00
286
+ datetime: 2024-10-29T00:00:00
287
+ datasets:
288
+ - MPTrj
289
+ prediction: EFS
290
+ nvt: true
291
+ npt: true
292
+ date: 2024-10-18
293
+ github: https://github.com/FAIR-Chem/fairchem
294
+ doi: https://arxiv.org/abs/2410.12771
mlip_arena/tasks/registry.yaml CHANGED
@@ -4,6 +4,11 @@ Homonuclear diatomics:
4
  task-layout: wide
5
  rank-page: homonuclear-diatomics
6
  last-update: 2024-09-19
 
 
 
 
 
7
  High pressure stability:
8
  category: Molecular dynamics
9
  task-page: stability
@@ -14,9 +19,3 @@ Combustion:
14
  task-page: combustion
15
  task-layout: centered
16
  rank-page: combustion
17
- # nacl:
18
- # last-update: 2024-03-25T14:30:00 # TODO: Fake datetime
19
- # alexandria:
20
- # last-update: 2024-03-25T14:30:00 # TODO: Fake datetime
21
- # qmof:
22
- # last-update: 2024-03-25T14:30:00 # TODO: Fake datetime
 
4
  task-layout: wide
5
  rank-page: homonuclear-diatomics
6
  last-update: 2024-09-19
7
+ Thermal conductivity:
8
+ category: Material Properties
9
+ task-page: thermal-conductivity
10
+ task-layout: centered
11
+ rank-page: thermal-conductivity
12
  High pressure stability:
13
  category: Molecular dynamics
14
  task-page: stability
 
19
  task-page: combustion
20
  task-layout: centered
21
  rank-page: combustion
 
 
 
 
 
 
mlip_arena/tasks/thermal-conductivity/wte.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ method,srme
2
+ M3GNet,1.142
3
+ CHGNet,1.717
4
+ MACE-MP(M),0.647
5
+ SevenNet,0.767
6
+ ORBv2(MPTrj),1.732
7
+ eqV2(OMat-S),1.772
serve/app.py CHANGED
@@ -44,6 +44,8 @@ for task in TASKS:
44
  else:
45
  centered_pages.append(page)
46
 
 
 
47
 
48
  pg = st.navigation(nav)
49
 
@@ -75,4 +77,13 @@ st.toast(
75
  icon="🍞",
76
  )
77
 
 
 
 
 
 
 
 
 
 
78
  pg.run()
 
44
  else:
45
  centered_pages.append(page)
46
 
47
+ # mbd = st.page_link(page="https://matbench-discovery.materialsproject.org/", label="Matbench Discovery", icon=":material/extension:")
48
+ # nav["Other benchmarks"].append(mbd)
49
 
50
  pg = st.navigation(nav)
51
 
 
77
  icon="🍞",
78
  )
79
 
80
+ # st.sidebar.markdown(
81
+ # """
82
+ # Other benchmarks
83
+ # """
84
+ # )
85
+ # st.sidebar.page_link(
86
+ # "https://matbench-discovery.materialsproject.org/", label="Matbench Discovery", icon=":material/extension:"
87
+ # )
88
+
89
  pg.run()
serve/leaderboard.py CHANGED
@@ -4,11 +4,12 @@ from pathlib import Path
4
  import pandas as pd
5
  import streamlit as st
6
 
 
7
  from mlip_arena.models import REGISTRY as MODELS
8
  from mlip_arena.tasks import REGISTRY as TASKS
9
 
10
  # Read the data
11
- DATA_DIR = Path("mlip_arena/tasks/diatomics")
12
 
13
  dfs = []
14
  for model in MODELS:
@@ -126,6 +127,6 @@ for task in TASKS:
126
 
127
  st.page_link(
128
  f"tasks/{TASKS[task]['task-page']}.py",
129
- label="Task page",
130
  icon=":material/link:",
131
  )
 
4
  import pandas as pd
5
  import streamlit as st
6
 
7
+ from mlip_arena import PKG_DIR
8
  from mlip_arena.models import REGISTRY as MODELS
9
  from mlip_arena.tasks import REGISTRY as TASKS
10
 
11
  # Read the data
12
+ DATA_DIR = PKG_DIR / "tasks" /"diatomics"
13
 
14
  dfs = []
15
  for model in MODELS:
 
127
 
128
  st.page_link(
129
  f"tasks/{TASKS[task]['task-page']}.py",
130
+ label="Go to the associated task page",
131
  icon=":material/link:",
132
  )
serve/ranks/combustion.py CHANGED
@@ -46,4 +46,10 @@ def get_com_drifts(df):
46
 
47
  df_exploded = get_com_drifts(df)
48
 
49
- table = pd.DataFrame()
 
 
 
 
 
 
 
46
 
47
  df_exploded = get_com_drifts(df)
48
 
49
+ table = pd.DataFrame()
50
+
51
+ # def render():
52
+ # st.dataframe(
53
+ # table,
54
+ # use_container_width=True,
55
+ # )
serve/ranks/homonuclear-diatomics.py CHANGED
@@ -74,14 +74,10 @@ table["Rank"] += np.argsort(table["Force flips"].to_numpy())
74
 
75
  table["Rank"] += 1
76
 
77
- table.sort_values("Rank", ascending=True, inplace=True)
78
 
79
  table["Rank aggr."] = table["Rank"]
80
-
81
- table["Rank"] = np.argsort(table["Rank"].to_numpy()) + 1
82
-
83
- # table.drop(columns=["rank"], inplace=True)
84
- # table = table.rename(columns={"Rank": "Rank Aggr."})
85
 
86
  table = table.reindex(
87
  columns=[
@@ -128,4 +124,19 @@ def render():
128
  s,
129
  use_container_width=True,
130
  )
131
- # return table
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  table["Rank"] += 1
76
 
77
+ table.sort_values(["Rank", "Conservation deviation [eV/Å]"], ascending=True, inplace=True)
78
 
79
  table["Rank aggr."] = table["Rank"]
80
+ table["Rank"] = table["Rank aggr."].rank(method='min').astype(int)
 
 
 
 
81
 
82
  table = table.reindex(
83
  columns=[
 
124
  s,
125
  use_container_width=True,
126
  )
127
+ with st.expander(":material/info: Explanation"):
128
+ st.caption(
129
+ """
130
+ - **Conservation deviation**: The average deviation of force from negative energy gradient along the diatomic curves.
131
+
132
+ $$
133
+ \\text{Conservation deviation} = \\left\\langle\\left| \\mathbf{F}(\\mathbf{r})\\cdot\\frac{\\mathbf{r}}{\\|\\mathbf{r}\\|} + \\nabla_rE\\right|\\right\\rangle_{r = \\|\\mathbf{r}\\|}
134
+ $$
135
+
136
+ - **Spearman's coeff. (Energy - repulsion)**: Spearman's correlation coefficient of energy prediction within equilibrium distance $r \\in (r_{min}, r_o = \\argmin_{r} E(r))$.
137
+ - **Spearman's coeff. (Force - descending)**: Spearman's correlation coefficient of force prediction within equilibrium distance $r \\in (r_{min}, r_o = \\argmin_{r} E(r))$.
138
+ - **Tortuosity**: The ratio between total variation in energy and sum of absolute energy differences between $r_{min}$, $r_o$, and $r_{max}$.
139
+ - **Energy jump**: The sum of energy discontinuity.
140
+ - **Force flips**: The number of sign changes.
141
+ """
142
+ )
serve/ranks/thermal-conductivity.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+ from mlip_arena import PKG_DIR
6
+
7
+ DATA_DIR = PKG_DIR / "tasks" / "thermal-conductivity"
8
+
9
+ table = pd.read_csv(DATA_DIR / "wte.csv")
10
+
11
+ table.rename(
12
+ columns={
13
+ "method": "Model",
14
+ "srme": "SRME [W/mK]",
15
+ },
16
+ inplace=True,
17
+ )
18
+
19
+ table.set_index("Model", inplace=True)
20
+
21
+ table.sort_values(["SRME [W/mK]"], ascending=True, inplace=True)
22
+
23
+ table["Rank"] = table["SRME [W/mK]"].rank(method='min').astype(int)
24
+
25
+ table = table.reindex(
26
+ columns=[
27
+ "Rank",
28
+ "SRME [W/mK]",
29
+ ]
30
+ )
31
+
32
+ s = (
33
+ table.style.background_gradient(
34
+ cmap="Reds", subset=["SRME [W/mK]"]
35
+ )
36
+ .background_gradient(
37
+ cmap="Blues",
38
+ subset=["Rank"],
39
+ )
40
+ .format("{:.3f}", subset=["SRME [W/mK]"])
41
+ )
42
+
43
+
44
+ def render():
45
+
46
+ st.dataframe(
47
+ s,
48
+ use_container_width=True
49
+ )
50
+
51
+ with st.expander(":material/info: Explanation"):
52
+ st.caption(
53
+ """
54
+ - **SRME**: symmetric relative mean error of single-phonon conductivity:
55
+
56
+ $$
57
+ \\text{SRME}[\\left\lbrace\\mathcal{K}({\\mathbf{q},s)}\\right\\rbrace] = \\frac{2}{N_qV}\\frac{\\sum_{\\mathbf{q}s}|\\mathcal{K}_{\\text{MLIP}}(\\mathbf{q},s) - \\mathcal{K}_{\\text{DFT}}(\\mathbf{q},s)|}{\\kappa_{\\text{MLIP}} + \\kappa_{\\text{DFT}}}
58
+ $$
59
+ """
60
+ )
serve/tasks/stability.py CHANGED
@@ -154,16 +154,16 @@ def plot_md_steps(counts_per_method, count_or_percetange):
154
 
155
  plot_md_steps(counts_per_method, count_or_percetange)
156
 
157
- st.markdown(
158
- """
159
- > The histogram shows the distribution of the total number of MD steps before the system crashes or completes the trajectory. :red[The color of the bins indicates the number of steps in the bin]. :blue[The height of the bars indicates the number or percentage of each bin among all the runs].
160
  """
161
  )
162
 
163
  ###
164
 
165
  st.markdown(
166
- """
167
  ## Inference speed
168
 
169
  The inference speed of the MLIPs is crucial for the high-throughput virutal screening. Under high pressure conditions, the atoms often move faster and closer to each other, which increases the size of neighbor list and local graph construction and hence slows down the inference speed.
@@ -221,8 +221,8 @@ def plot_speed(df, method_color_mapping):
221
 
222
  plot_speed(df, method_color_mapping)
223
 
224
- st.markdown(
225
- """
226
- > The plot shows the inference speed (steps per second) as a function of the number of atoms in the system. :red[The size of the points is proportional to the total number of steps in the MD trajectory before crash or completion (~49990)]. :blue[The lines show the fit of the data to the power law function $a N^{-n}$], where $N$ is the number of atoms and $a$ and $n$ are the fit parameters.
227
  """
228
  )
 
154
 
155
  plot_md_steps(counts_per_method, count_or_percetange)
156
 
157
+ st.caption(
158
+ """
159
+ The histogram shows the distribution of the total number of MD steps before the system crashes or completes the trajectory. :red[The color of the bins indicates the number of steps in the bin]. :blue[The height of the bars indicates the number or percentage of each bin among all the runs].
160
  """
161
  )
162
 
163
  ###
164
 
165
  st.markdown(
166
+ """
167
  ## Inference speed
168
 
169
  The inference speed of the MLIPs is crucial for the high-throughput virutal screening. Under high pressure conditions, the atoms often move faster and closer to each other, which increases the size of neighbor list and local graph construction and hence slows down the inference speed.
 
221
 
222
  plot_speed(df, method_color_mapping)
223
 
224
+ st.caption(
225
+ """
226
+ The plot shows the inference speed (steps per second) as a function of the number of atoms in the system. :red[The size of the points is proportional to the total number of steps in the MD trajectory before crash or completion (~49990)]. :blue[The lines show the fit of the data to the power law function $a N^{-n}$], where $N$ is the number of atoms and $a$ and $n$ are the fit parameters.
227
  """
228
  )
serve/tasks/thermal-conductivity.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+ from mlip_arena import PKG_DIR
6
+
7
+
8
+ st.markdown(
9
+ """
10
+ # Thermal Conductivity
11
+
12
+ Compared to Póta, Ahlawat, Csányi, and Simoncelli, [arXiv:2408.00755v4](https://arxiv.org/abs/2408.00755), the relaxation protocol has been updated and unified for all the models. The relaxation is a combination of sequential vc-relax (changes cell and atom positions) and relax (changes atom positions only). Each relaxation stage has a maximum number of 300 steps, and consist of a single FrechetCellFilter relaxation with force threshold =1e-4 eV/Ang. To preserve crystal symmetry, unit-cell angles are not allowed to change. This unified protocol gives the same SRME reported in [arXiv:2408.00755v4](https://arxiv.org/abs/2408.00755) for all the models but M3GNet. In M3GNet this updated relaxation protocol gives SRME = 1.412, slightly smaller than the value 1.469 that was obtained with the non-unified relaxation protocol in [arXiv:2408.00755v4](https://arxiv.org/abs/2408.00755).
13
+
14
+ **SRME** is the Symmetric Relative Mean Error, defined as the mean of the absolute values of the relative errors of the predictions. Here, it is used to quantify the error on microscopic single-phonon conductivity:
15
+
16
+ $$
17
+ \\text{SRME}[\\left\lbrace\\mathcal{K}({\\mathbf{q},s)}\\right\\rbrace] = \\frac{2}{N_qV}\\frac{\\sum_{\\mathbf{q}s}|\\mathcal{K}_{\\text{MLIP}}(\\mathbf{q},s) - \\mathcal{K}_{\\text{DFT}}(\\mathbf{q},s)|}{\\kappa_{\\text{MLIP}} + \\kappa_{\\text{DFT}}}
18
+ $$
19
+ """
20
+ )
21
+
22
+ DATA_DIR = PKG_DIR / "tasks" / "thermal-conductivity"
23
+
24
+ table = pd.read_csv(DATA_DIR / "wte.csv")
25
+
26
+ table.rename(
27
+ columns={
28
+ "method": "Model",
29
+ "srme": "SRME [W/mK]",
30
+ },
31
+ inplace=True,
32
+ )
33
+
34
+ table.set_index("Model", inplace=True)
35
+
36
+ table.sort_values(["SRME [W/mK]"], ascending=True, inplace=True)
37
+
38
+ s = table.style.background_gradient(
39
+ cmap="Reds", subset=["SRME [W/mK]"]
40
+ )
41
+
42
+ st.dataframe(
43
+ s,
44
+ use_container_width=True,
45
+ column_config={"SRME [W/mK]": {"format": "{:.3f}"}}
46
+ )