File size: 2,215 Bytes
3b0d98a
 
df95987
 
 
1485b15
5f78296
3b0d98a
5f78296
3b0d98a
 
 
1485b15
5f78296
df95987
1485b15
 
 
 
 
 
5f78296
 
 
 
3b0d98a
1485b15
 
 
3b0d98a
1485b15
 
 
 
 
 
 
5f78296
 
3b0d98a
 
 
 
 
 
 
df95987
1485b15
3b0d98a
 
 
1485b15
 
 
 
3b0d98a
1485b15
5f78296
 
df95987
5f78296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from pathlib import Path

import pandas as pd
import streamlit as st

from mlip_arena.models.utils import MLIPEnum, REGISTRY

DATA_DIR = Path("mlip_arena/tasks/diatomics")
methods = ["MACE-MP", "Equiformer", "CHGNet", "MACE-OFF", "eSCN", "ALIGNN"]
dfs = [pd.read_json(DATA_DIR / method.lower() /  "homonuclear-diatomics.json") for method in methods]
df = pd.concat(dfs, ignore_index=True)


table = pd.DataFrame(columns=[
    "Model",
    "Supported elements",
    # "No. of reversed forces",
    # "Energy-consistent forces",
    "Prediction",
    "NVT",
    "NPT",
    "Last updated",
    "Code",
    "Paper"
    ])

for model in MLIPEnum:
    rows = df[df["method"] == model.name]
    metadata = REGISTRY.get(model.name, {})
    new_row = {
        "Model": model.name,
        "Supported elements": len(rows["name"].unique()),
        # "No. of reversed forces": None,  # Replace with actual logic if available
        # "Energy-consistent forces": None,  # Replace with actual logic if available
        "Prediction": metadata.get("prediction", None),
        "NVT": "✅" if metadata.get("nvt", False) else "❌",
        "NPT": "✅" if metadata.get("npt", False) else "❌",
        "Code": metadata.get("github", None) if metadata else None,
        "Paper": metadata.get("doi", None) if metadata else None,
    }
    table = pd.concat([table, pd.DataFrame([new_row])], ignore_index=True)

table.set_index("Model", inplace=True)


s = table.style.background_gradient(
    cmap="PuRd",
    subset=["Supported elements"],
    vmin=0, vmax=120
)

st.markdown(
"""
<h1 style='text-align: center;'>MLIP Arena Leaderboard</h1>
""", unsafe_allow_html=True)

# st.markdown("# MLIP Arena Leaderboard")

st.dataframe(
    s,
    use_container_width=True,
    column_config={
        "Code": st.column_config.LinkColumn(
            # "GitHub",
            # help="The top trending Streamlit apps",
            # validate="^https://[a-z]+\.streamlit\.app$",
            max_chars=100,
            display_text="GitHub",
        ),
        "Paper": st.column_config.LinkColumn(
            # validate="^https://[a-z]+\.streamlit\.app$",
            max_chars=100,
            display_text="arXiv",
        ),
    },
)