Skip to content

Commit 360e0b0

Browse files
Chiu PeterChiu Peter
authored andcommitted
update robocrys info ingestion
1 parent 59e77e7 commit 360e0b0

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

crystal_toolkit/components/pourbaix.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,31 @@ def update_heatmap_choices(entries, mat_detials):
637637
mpid = entry["entry_id"]
638638

639639
# get material details
640+
functional = mpid.split("-")[2]
640641
mpid_wo_function = "mp-" + mpid.split("-")[1]
641642
if mpid_wo_function in mat_detials:
642-
robo = mat_detials[mpid_wo_function]["robo"]
643+
structure_text = mat_detials[mpid_wo_function]["structure_text"]
644+
crystal_system = mat_detials[mpid_wo_function]["crystal_system"]
643645

644-
label = f"{formula} ({mpid}): {robo}"
646+
label_text_list = [
647+
f"{formula} ({mpid_wo_function}, {functional})"
648+
]
649+
if structure_text:
650+
label_text_list.append("Structure: " + structure_text)
651+
if crystal_system:
652+
label_text_list.append("Crystal system: " + crystal_system)
653+
label = "; ".join(label_text_list)
654+
655+
# label = html.Pre(f"{label_text}", className="dropdown-content", style={"width": "100%"})
645656
"""
657+
label = [f"{formula} ({mpid_wo_function}, {functional}"]
658+
if structure_text:
659+
label.append(html.Br())
660+
label.append(structure_text)
661+
if crystal_system:
662+
label.append(html.Br())
663+
label.append(crystal_system)
664+
646665
# den = round(mat_detials[mpid_wo_function]["density"], 3)
647666
sym = mat_detials[mpid_wo_function]["symmetry_symbol"]
648667
eah = round(
@@ -663,7 +682,7 @@ def update_heatmap_choices(entries, mat_detials):
663682

664683
# options.append({"label": f"{formula} ({mpid})", "value": mpid})
665684
options.append(option)
666-
685+
options.sort(key=lambda x: x["label"])
667686
return [
668687
self.get_choice_input(
669688
"heatmap_choice",
@@ -672,6 +691,7 @@ def update_heatmap_choices(entries, mat_detials):
672691
help_str="Choose the entry to use for heatmap generation.",
673692
options=options,
674693
disabled=False,
694+
style={"width": "100%", "whiteSpace": "nowrap"},
675695
),
676696
html.A(
677697
"\U0001f517 to detail page",

0 commit comments

Comments
 (0)