From 29c363f9c5092d6cd976cee0cafc34a34919a526 Mon Sep 17 00:00:00 2001 From: mikibonacci Date: Tue, 3 Dec 2024 18:31:32 +0000 Subject: [PATCH] Bug fix in the q-section reset. The problem was that the default value of a tl.List(tl.Float()) is tl.Undefined. Now we explicitely reset the default value of Q0_vec, h_vec and k_vec --- src/aiidalab_qe_vibroscopy/app/widgets/euphonicmodel.py | 4 ++++ src/aiidalab_qe_vibroscopy/app/widgets/euphonicwidget.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/aiidalab_qe_vibroscopy/app/widgets/euphonicmodel.py b/src/aiidalab_qe_vibroscopy/app/widgets/euphonicmodel.py index 82d0aae..d11cb89 100644 --- a/src/aiidalab_qe_vibroscopy/app/widgets/euphonicmodel.py +++ b/src/aiidalab_qe_vibroscopy/app/widgets/euphonicmodel.py @@ -105,6 +105,10 @@ def set_model_state(self, parameters: dict): setattr(self, k, v) def _get_default(self, trait): + if trait in ["h_vec", "k_vec"]: + return [1, 1, 1, 100, 1] + elif trait == "Q0_vec": + return [0.0, 0.0, 0.0] return self.traits()[trait].default_value def get_model_state(self): diff --git a/src/aiidalab_qe_vibroscopy/app/widgets/euphonicwidget.py b/src/aiidalab_qe_vibroscopy/app/widgets/euphonicwidget.py index b11f245..7fe0014 100644 --- a/src/aiidalab_qe_vibroscopy/app/widgets/euphonicwidget.py +++ b/src/aiidalab_qe_vibroscopy/app/widgets/euphonicwidget.py @@ -118,7 +118,9 @@ class EuphonicSuperWidget(ipw.VBox): In between, we trigger the initialization of plots via a button. """ - def __init__(self, mode="aiidalab-qe app plugin", model=None, fc=None, q_path=None): + def __init__( + self, mode="aiidalab-qe app plugin", model=None, node=None, fc=None, q_path=None + ): """ Initialize the Euphonic utility class. Parameters: @@ -148,6 +150,7 @@ def __init__(self, mode="aiidalab-qe app plugin", model=None, fc=None, q_path=No self.mode = mode self._model = model # this is the single crystal model. + self._model.node = node self._model.fc_hdf5_content = None self.rendered = False