diff --git a/src/aiidalab_qe_vibroscopy/utils/euphonic/__init__.py b/src/aiidalab_qe_vibroscopy/utils/euphonic/__init__.py index 9552900..0d60410 100644 --- a/src/aiidalab_qe_vibroscopy/utils/euphonic/__init__.py +++ b/src/aiidalab_qe_vibroscopy/utils/euphonic/__init__.py @@ -18,6 +18,34 @@ ###### START for detached app: +# spinner for waiting time (supercell estimations) +spinner_html = """ + +
+
+
+""" + # Upload buttons class UploadPhonopyYamlWidget(ipw.FileUpload): @@ -166,6 +194,11 @@ def __init__(self, mode="aiidalab-qe app plugin", fc=None, q_path=None): ) self.plot_button.on_click(self._on_first_plot_button_clicked) + self.loading_widget = ipw.HTML( + value=spinner_html, + ) + self.loading_widget.layout.display = "none" + if self.mode == "aiidalab-qe app plugin": self.upload_widget.layout.display = "none" self.plot_button.disabled = False @@ -177,6 +210,7 @@ def __init__(self, mode="aiidalab-qe app plugin", fc=None, q_path=None): children=[ self.upload_widget, self.plot_button, + self.loading_widget, self.tab_widget, ], ) @@ -232,6 +266,9 @@ def _generate_force_constants( def _on_first_plot_button_clicked(self, change=None): # It creates the widgets self.plot_button.layout.display = "none" + + self.loading_widget.layout.display = "block" + self.fc = self._generate_force_constants() # I first initialise this widget, to then have the 0K ref for the other two. @@ -247,6 +284,8 @@ def _on_first_plot_button_clicked(self, change=None): ), ) + self.loading_widget.layout.display = "none" + self.tab_widget.layout.display = "block" diff --git a/src/aiidalab_qe_vibroscopy/utils/euphonic/intensity_maps.py b/src/aiidalab_qe_vibroscopy/utils/euphonic/intensity_maps.py index 6946f2c..09d6d08 100644 --- a/src/aiidalab_qe_vibroscopy/utils/euphonic/intensity_maps.py +++ b/src/aiidalab_qe_vibroscopy/utils/euphonic/intensity_maps.py @@ -299,6 +299,21 @@ def produce_bands_weigthed_data( x_tick_labels = get_qpoint_labels( modes.qpts, cell=modes.crystal.to_spglib_cell() ) + + # duplication from euphonic/cli/utils.py + if args.emin is None: + # Subtract small amount from min frequency - otherwise due to unit + # conversions binning of this frequency can vary with different + # architectures/lib versions, making it difficult to test + emin_room = 1e-5 * ureg("meV").to(modes.frequencies.units).magnitude + args.emin = min(np.min(modes.frequencies.magnitude - emin_room), 0.0) + if args.emax is None: + args.emax = np.max(modes.frequencies.magnitude) * 1.05 + if args.emin >= args.emax: + raise ValueError( + "Maximum energy ({args.emax}) should be greater than minimum ({args.emin}). " + ) + modes.frequencies_unit = args.energy_unit ebins = _get_energy_bins(modes, args.ebins + 1, emin=args.e_min, emax=args.e_max)