Spaces:
Runtime error
Runtime error
scan, pbesol, pbe filter
Browse files
app.py
CHANGED
|
@@ -6,10 +6,8 @@ from datasets import load_dataset
|
|
| 6 |
from pymatgen.analysis.phase_diagram import PDPlotter, PhaseDiagram
|
| 7 |
from pymatgen.core import Composition, Structure
|
| 8 |
from pymatgen.core.composition import Composition
|
| 9 |
-
from pymatgen.entries.computed_entries import (
|
| 10 |
-
|
| 11 |
-
GibbsComputedStructureEntry,
|
| 12 |
-
)
|
| 13 |
|
| 14 |
# Load only the train split of the dataset
|
| 15 |
dataset = load_dataset("LeMaterial/leDataset", split="train")
|
|
@@ -36,6 +34,7 @@ def create_phase_diagram(
|
|
| 36 |
energy=row["energy"],
|
| 37 |
correction=row["energy_corrected"] - row["energy"],
|
| 38 |
entry_id=row["immutable_id"],
|
|
|
|
| 39 |
)
|
| 40 |
for n, row in train_df.iterrows()
|
| 41 |
if len(set(row["elements"]).intersection(element_list)) > 0
|
|
@@ -45,16 +44,16 @@ def create_phase_diagram(
|
|
| 45 |
elemental_entries = [e for e in entries if e.composition.is_element]
|
| 46 |
|
| 47 |
# Filter entries based on functional
|
| 48 |
-
if functional == "
|
| 49 |
-
entries = [
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
]
|
| 58 |
# Add elemental entries to ensure they are included
|
| 59 |
entries.extend([e for e in elemental_entries if e not in entries])
|
| 60 |
|
|
@@ -103,7 +102,7 @@ color_scheme_dropdown = gr.Dropdown(
|
|
| 103 |
choices=["Energy Above Hull", "Formation Energy"], label="Color Scheme"
|
| 104 |
)
|
| 105 |
plot_style_dropdown = gr.Dropdown(choices=["2D", "3D"], label="Plot Style")
|
| 106 |
-
functional_dropdown = gr.Dropdown(choices=["
|
| 107 |
finite_temp_toggle = gr.Checkbox(label="Enable Finite Temperature Estimation")
|
| 108 |
|
| 109 |
# Create Gradio interface
|
|
|
|
| 6 |
from pymatgen.analysis.phase_diagram import PDPlotter, PhaseDiagram
|
| 7 |
from pymatgen.core import Composition, Structure
|
| 8 |
from pymatgen.core.composition import Composition
|
| 9 |
+
from pymatgen.entries.computed_entries import (ComputedStructureEntry,
|
| 10 |
+
GibbsComputedStructureEntry)
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Load only the train split of the dataset
|
| 13 |
dataset = load_dataset("LeMaterial/leDataset", split="train")
|
|
|
|
| 34 |
energy=row["energy"],
|
| 35 |
correction=row["energy_corrected"] - row["energy"],
|
| 36 |
entry_id=row["immutable_id"],
|
| 37 |
+
parameters={"run_type": row["functional"]},
|
| 38 |
)
|
| 39 |
for n, row in train_df.iterrows()
|
| 40 |
if len(set(row["elements"]).intersection(element_list)) > 0
|
|
|
|
| 44 |
elemental_entries = [e for e in entries if e.composition.is_element]
|
| 45 |
|
| 46 |
# Filter entries based on functional
|
| 47 |
+
if functional == "PBE":
|
| 48 |
+
entries = [e for e in entries if e.parameters.get("run_type", "") == "pbe"]
|
| 49 |
+
entries.extend([e for e in elemental_entries if e not in entries])
|
| 50 |
+
elif functional == "PBESol":
|
| 51 |
+
entries = [e for e in entries if e.parameters.get("run_type", "") == "pbesol"]
|
| 52 |
+
# Add elemental entries to ensure they are included
|
| 53 |
+
entries.extend([e for e in elemental_entries if e not in entries])
|
| 54 |
+
|
| 55 |
+
elif functional == "SCAN":
|
| 56 |
+
entries = [e for e in entries if e.parameters.get("run_type", "") == "scan"]
|
| 57 |
# Add elemental entries to ensure they are included
|
| 58 |
entries.extend([e for e in elemental_entries if e not in entries])
|
| 59 |
|
|
|
|
| 102 |
choices=["Energy Above Hull", "Formation Energy"], label="Color Scheme"
|
| 103 |
)
|
| 104 |
plot_style_dropdown = gr.Dropdown(choices=["2D", "3D"], label="Plot Style")
|
| 105 |
+
functional_dropdown = gr.Dropdown(choices=["PBE", "PBESol", "SCAN"], label="Functional")
|
| 106 |
finite_temp_toggle = gr.Checkbox(label="Enable Finite Temperature Estimation")
|
| 107 |
|
| 108 |
# Create Gradio interface
|