Skip to content

Commit a4f518c

Browse files
committed
Fix viewing lattice constant structures
1 parent 34d086e commit a4f518c

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

ml_peg/analysis/bulk_crystal/lattice_constants/analyse_lattice_constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def lattice_constants_exp() -> dict[str, list]:
8787
if not struct_files:
8888
continue
8989

90-
for i, struct_file in enumerate(struct_files):
90+
for struct_file in struct_files:
9191
structs = read(struct_file, index=":")
9292

9393
formula = structs[-1].info["name"]
@@ -120,7 +120,7 @@ def lattice_constants_exp() -> dict[str, list]:
120120
# Copy individual structure files to app data directory
121121
structs_dir = OUT_PATH / model_name
122122
structs_dir.mkdir(parents=True, exist_ok=True)
123-
write(structs_dir / f"{i}.xyz", structs)
123+
write(structs_dir / f"{structs[-1].info['name']}.xyz", structs)
124124

125125
ref_stored = True
126126

ml_peg/app/bulk_crystal/lattice_constants/app_lattice_constants.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,19 @@ def register_callbacks(self) -> None:
3131
)
3232

3333
structs_dir = DATA_PATH / MODELS[0]
34-
structs = [
35-
f"assets/bulk_crystal/lattice_constants/{MODELS[0]}/{struct_file.stem}.xyz"
36-
for struct_file in sorted(structs_dir.glob("*.xyz"))
37-
]
34+
structs = []
35+
for struct_file in sorted(structs_dir.glob("*.xyz")):
36+
if struct_file.stem == "SiC":
37+
structs.extend(
38+
[
39+
f"assets/bulk_crystal/lattice_constants/{MODELS[0]}/{struct_file.stem}.xyz"
40+
]
41+
* 2
42+
)
43+
else:
44+
structs.append(
45+
f"assets/bulk_crystal/lattice_constants/{MODELS[0]}/{struct_file.stem}.xyz"
46+
)
3847

3948
plot_from_table_column(
4049
table_id=self.table_id,
@@ -72,6 +81,7 @@ def get_app() -> LatticeConstantsApp:
7281
table_path=DATA_PATH / "lattice_constants_metrics_table.json",
7382
extra_components=[
7483
Div(id=f"{BENCHMARK_NAME}-figure-placeholder"),
84+
Div(id=f"{BENCHMARK_NAME}-struct-placeholder"),
7585
],
7686
)
7787

0 commit comments

Comments
 (0)