Spaces:
Runtime error
Runtime error
add finite temp
Browse files
app.py
CHANGED
@@ -4,10 +4,12 @@ import gradio as gr
|
|
4 |
import plotly.graph_objs as go
|
5 |
from datasets import load_dataset
|
6 |
from pymatgen.analysis.phase_diagram import PDPlotter, PhaseDiagram
|
7 |
-
from pymatgen.core import Composition
|
8 |
from pymatgen.core.composition import Composition
|
9 |
-
from pymatgen.entries.computed_entries import
|
10 |
-
|
|
|
|
|
11 |
|
12 |
# Load only the train split of the dataset
|
13 |
dataset = load_dataset("LeMaterial/leDataset", split="train")
|
@@ -24,8 +26,13 @@ def create_phase_diagram(
|
|
24 |
|
25 |
# Fetch all entries from the Materials Project database
|
26 |
entries = [
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
energy=row["energy"],
|
30 |
correction=row["energy_corrected"] - row["energy"],
|
31 |
entry_id=row["immutable_id"],
|
@@ -51,6 +58,9 @@ def create_phase_diagram(
|
|
51 |
# Add elemental entries to ensure they are included
|
52 |
entries.extend([e for e in elemental_entries if e not in entries])
|
53 |
|
|
|
|
|
|
|
54 |
# Build the phase diagram
|
55 |
try:
|
56 |
phase_diagram = PhaseDiagram(entries)
|
|
|
4 |
import plotly.graph_objs as go
|
5 |
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 |
+
ComputedStructureEntry,
|
11 |
+
GibbsComputedStructureEntry,
|
12 |
+
)
|
13 |
|
14 |
# Load only the train split of the dataset
|
15 |
dataset = load_dataset("LeMaterial/leDataset", split="train")
|
|
|
26 |
|
27 |
# Fetch all entries from the Materials Project database
|
28 |
entries = [
|
29 |
+
ComputedStructureEntry(
|
30 |
+
Structure(
|
31 |
+
[x.tolist() for x in df.iloc[0]["lattice_vectors"].tolist()],
|
32 |
+
row["species_at_sites"],
|
33 |
+
row["cartesian_site_positions"],
|
34 |
+
coords_are_cartesian=True,
|
35 |
+
),
|
36 |
energy=row["energy"],
|
37 |
correction=row["energy_corrected"] - row["energy"],
|
38 |
entry_id=row["immutable_id"],
|
|
|
58 |
# Add elemental entries to ensure they are included
|
59 |
entries.extend([e for e in elemental_entries if e not in entries])
|
60 |
|
61 |
+
if finite_temp:
|
62 |
+
entries = GibbsComputedStructureEntry.from_entries(entries)
|
63 |
+
|
64 |
# Build the phase diagram
|
65 |
try:
|
66 |
phase_diagram = PhaseDiagram(entries)
|