Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions crystal_toolkit/components/phonon.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ def _sub_layouts(self) -> dict[str, Component]:
id=self.id("animation-button-container"),
)

hints = html.Div(
"💡 Zoom in by selecting an area of interest, and double-click to return to the original view. (The q points' labels that appear to overlap at the current scale are actually distinct.)",
style={"textAlign": "center"},
)

return {
"graph": graph,
"convention": convention,
Expand All @@ -189,6 +194,7 @@ def _sub_layouts(self) -> dict[str, Component]:
"zone": zone,
"table": summary_table,
"crystal_animation_button_container": crystal_animation_button_container,
"hints": hints,
}

def _get_animation_panel(self):
Expand Down Expand Up @@ -426,6 +432,7 @@ def _get_animation_panel(self):
def layout(self) -> html.Div:
sub_layouts = self._sub_layouts
graph = Columns([Column([sub_layouts["graph"]])])
hints = Columns([Column([sub_layouts["hints"]])])
crystal_animation_container = Columns(
[], id=self.id("crystal-animation-container"), style={"display": "none"}
)
Expand Down Expand Up @@ -453,6 +460,7 @@ def layout(self) -> html.Div:
return html.Div(
[
graph,
hints,
crystal_animation_button_container,
crystal_animation_container,
controls,
Expand Down Expand Up @@ -896,6 +904,7 @@ def get_figure(
tickvals=bs_data["ticks"]["distance"],
title=dict(text="Wave Vector", font=dict(size=16)),
zeroline=False,
automargin=True,
)

yaxis_style = dict(
Expand Down Expand Up @@ -1008,6 +1017,9 @@ def generate_callbacks(self, app, cache) -> None:
Output(self.id("ph-bsdos-graph"), "figure", allow_duplicate=True),
Output(self.id("zone"), "data"),
Output(self.id("table"), "children"),
Output(
self.id("animation-button-container"), "style", allow_duplicate=True
),
Input(self.id("ph_bs"), "data"),
Input(self.id("ph_dos"), "data"),
# prevent_intial_call=True,
Expand All @@ -1026,7 +1038,9 @@ def update_graph(bs, dos):
summary_dict = self._get_data_list_dict(bs, dos)
summary_table = get_data_list(summary_dict)

return figure, zone_scene.to_json(), summary_table
if bs.has_eigendisplacements:
return figure, zone_scene.to_json(), summary_table, {"display": "flex"}
return figure, zone_scene.to_json(), summary_table, {"display": "none"}

@app.callback(
Output(self.id("ph-bsdos-graph"), "figure", allow_duplicate=True),
Expand Down Expand Up @@ -1087,7 +1101,9 @@ def update_pointer_graph(figure, nclick, animation_click):
@app.callback(
Output(self.id("crystal-animation-container"), "children"),
Output(self.id("crystal-animation-container"), "style"),
Output(self.id("animation-button-container"), "style"),
Output(
self.id("animation-button-container"), "style", allow_duplicate=True
),
Input(self.id("animation-button"), "n_clicks"),
prevent_intial_call=True,
)
Expand Down
3 changes: 3 additions & 0 deletions crystal_toolkit/helpers/pretty_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
"\\Gamma": "Γ",
"\\Sigma": "Σ",
"GAMMA": "Γ",
"SIGMA": "Σ",
"_0": "₀",
"_1": "₁",
"_2": "₂",
"_3": "₃",
"_4": "₄",
"_{0}": "₀",
"_{1}": "₁",
"_{2}": "₂",
"_{3}": "₃",
Expand Down
Loading