From 372050179f1bedb3096222d44af97ddd13739362 Mon Sep 17 00:00:00 2001 From: Andres Ortega-Guerrero <34098967+AndresOrtegaGuerrero@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:13:25 +0100 Subject: [PATCH 1/5] adding spin-orbit coupling to process label (#954) * adding spin-orbit coupling to process label --- src/aiidalab_qe/app/submission/model.py | 17 ++++++++++++++++- src/aiidalab_qe/workflows/__init__.py | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/aiidalab_qe/app/submission/model.py b/src/aiidalab_qe/app/submission/model.py index c47c93ed6..ed0f25a47 100644 --- a/src/aiidalab_qe/app/submission/model.py +++ b/src/aiidalab_qe/app/submission/model.py @@ -98,6 +98,13 @@ def update_process_label(self): "workchain", {"properties": []}, ) + + soc_parameters = self.input_parameters["advanced"]["pw"]["parameters"][ + "SYSTEM" + ].get("lspinorb", False) + + soc_info = "spin-orbit coupling" if soc_parameters else "" + properties = [p for p in workchain_data["properties"] if p != "relax"] relax_type = workchain_data.get("relax_type", "none") relax_info = "unrelaxed" @@ -109,7 +116,15 @@ def update_process_label(self): if workchain_data["spin_type"] != "none": protocol_and_magnetic_info += ", magnetic" properties_info = f"→ {', '.join(properties)}" if properties else "" - label = f"{structure_label} [{relax_info}, {protocol_and_magnetic_info}] {properties_info}".strip() + + label_details = [ + relax_info, + protocol_and_magnetic_info, + soc_info, + ] + filtered_label_details = [detail for detail in label_details if detail] + label = f"{structure_label} [{', '.join(filtered_label_details)}] {properties_info}".strip() + self.process_label = label def update_submission_blockers(self): diff --git a/src/aiidalab_qe/workflows/__init__.py b/src/aiidalab_qe/workflows/__init__.py index 95dde34d7..5cb0f0658 100644 --- a/src/aiidalab_qe/workflows/__init__.py +++ b/src/aiidalab_qe/workflows/__init__.py @@ -175,6 +175,7 @@ def get_builder_from_protocol( "base_final_scf": parameters["advanced"], } protocol = parameters["workchain"]["protocol"] + relax_builder = PwRelaxWorkChain.get_builder_from_protocol( code=codes["global"]["codes"].get("quantumespresso.pw")["code"], structure=structure, From 577b681fef36b6ccd10a2330ddde405a45c610c4 Mon Sep 17 00:00:00 2001 From: Andres Ortega-Guerrero <34098967+AndresOrtegaGuerrero@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:27:42 +0100 Subject: [PATCH 2/5] PBEsol as default for SOC (#951) * PBEsol as default for SOC --- src/aiidalab_qe/app/configuration/advanced/pseudos/model.py | 4 ++-- tests/test_pseudo.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aiidalab_qe/app/configuration/advanced/pseudos/model.py b/src/aiidalab_qe/app/configuration/advanced/pseudos/model.py index 959048e31..84c3b29e5 100644 --- a/src/aiidalab_qe/app/configuration/advanced/pseudos/model.py +++ b/src/aiidalab_qe/app/configuration/advanced/pseudos/model.py @@ -215,9 +215,9 @@ def update_family_parameters(self): return if self.spin_orbit == "soc": if self.protocol in ["fast", "moderate"]: - pseudo_family_string = "PseudoDojo/0.4/PBE/FR/standard/upf" + pseudo_family_string = "PseudoDojo/0.4/PBEsol/FR/standard/upf" else: - pseudo_family_string = "PseudoDojo/0.4/PBE/FR/stringent/upf" + pseudo_family_string = "PseudoDojo/0.4/PBEsol/FR/stringent/upf" else: pseudo_family_string = PwBaseWorkChain.get_protocol_inputs(self.protocol)[ "pseudo_family" diff --git a/tests/test_pseudo.py b/tests/test_pseudo.py index e71830960..abe641635 100644 --- a/tests/test_pseudo.py +++ b/tests/test_pseudo.py @@ -173,7 +173,7 @@ def test_pseudos_settings(generate_structure_data, generate_upf_data): # Test spin-orbit-dependent family change model.spin_orbit = "soc" model.protocol = "moderate" - assert model.family == f"PseudoDojo/{PSEUDODOJO_VERSION}/PBE/FR/standard/upf" + assert model.family == f"PseudoDojo/{PSEUDODOJO_VERSION}/PBEsol/FR/standard/upf" # Reset the external dependencies of the model model.spin_orbit = "wo_soc" From 9cebb5267c7f78c4780c91e07d935db7cc2f2529 Mon Sep 17 00:00:00 2001 From: Andres Ortega-Guerrero <34098967+AndresOrtegaGuerrero@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:29:35 +0100 Subject: [PATCH 3/5] modifications to the EditStructureData Widgets (#956) * modifications to the EditStructureData Widgets --- src/aiidalab_qe/common/widgets.py | 40 +++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/aiidalab_qe/common/widgets.py b/src/aiidalab_qe/common/widgets.py index b42301083..51e2536eb 100644 --- a/src/aiidalab_qe/common/widgets.py +++ b/src/aiidalab_qe/common/widgets.py @@ -440,7 +440,11 @@ def __init__(self, title="", **kwargs): self._status_message = StatusHTML() self.atom_selection = ipw.Text( - description="Index of atoms", value="", layout={"width": "initial"} + placeholder="e.g. 1..5 8 10", + description="Index of atoms", + value="", + style={"description_width": "100px"}, + layout={"width": "initial"}, ) self.from_selection = ipw.Button(description="From selection") self.from_selection.on_click(self._from_selection) @@ -478,6 +482,10 @@ def __init__(self, title="", **kwargs): button_style="primary", layout={"width": "100px"}, ) + self.scroll_note = ipw.HTML( + value="

Note: The table is scrollable.

", + layout={"visibility": "hidden"}, + ) self.tag_display = ipw.Output() self.add_tags.on_click(self._add_tags) self.reset_tags.on_click(self._reset_tags) @@ -491,7 +499,22 @@ def __init__(self, title="", **kwargs): super().__init__( children=[ ipw.HTML( - "Adding a tag to atoms", + "Set custom tags for atoms", + ), + ipw.HTML( + """ +

+ These are used to distinguish atoms of the same chemical element.
+ For example, they can be used to assign different initial magnetization values for antiferromagnetic systems. +

+

NOTE:

+ + + Note: +

+ """ ), ipw.HBox( [ @@ -501,10 +524,11 @@ def __init__(self, title="", **kwargs): ] ), self.tag_display, + self.scroll_note, ipw.HBox([self.add_tags, self.reset_tags, self.reset_all_tags]), self._status_message, ipw.HTML( - "Define periodicity", + '
Set structure periodicity
' ), ipw.HTML("""

Select the periodicity of your system.

@@ -530,14 +554,18 @@ def _display_table(self, _=None): current_tags = self.structure.get_tags() chemichal_symbols = self.structure.get_chemical_symbols() - if selection and (max(selection) <= (len(self.structure) - 1)): + if ( + selection + and (min(selection) >= 0) + and (max(selection) <= (len(self.structure) - 1)) + ): table_data = [] for index in selection: tag = current_tags[index] symbol = chemichal_symbols[index] if tag == 0: tag = "" - table_data.append([f"{index}", f"{symbol}", f"{tag}"]) + table_data.append([f"{index+ 1}", f"{symbol}", f"{tag}"]) # Create an HTML table table_html = "" @@ -558,10 +586,12 @@ def _display_table(self, _=None): with self.tag_display: clear_output() display(HTML(table_html)) + self.scroll_note.layout = {"visibility": "visible"} else: self.tag_display.layout = {} with self.tag_display: clear_output() + self.scroll_note.layout = {"visibility": "hidden"} def _from_selection(self, _=None): """Set the atom selection from the current selection.""" From b265564ebb96d2f2a05ddded093cc463e57d9213 Mon Sep 17 00:00:00 2001 From: Andres Ortega-Guerrero <34098967+AndresOrtegaGuerrero@users.noreply.github.com> Date: Fri, 29 Nov 2024 09:09:22 +0100 Subject: [PATCH 4/5] removing extran note caption (#958) --- src/aiidalab_qe/common/widgets.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aiidalab_qe/common/widgets.py b/src/aiidalab_qe/common/widgets.py index 51e2536eb..87d879526 100644 --- a/src/aiidalab_qe/common/widgets.py +++ b/src/aiidalab_qe/common/widgets.py @@ -511,8 +511,6 @@ def __init__(self, title="", **kwargs): - - Note:

""" ), From 329e198e99336185c5b5d9e281f7fa4767b03894 Mon Sep 17 00:00:00 2001 From: Andres Ortega-Guerrero <34098967+AndresOrtegaGuerrero@users.noreply.github.com> Date: Sat, 30 Nov 2024 09:28:20 +0100 Subject: [PATCH 5/5] setting periodicity options to the mapping (#960) --- src/aiidalab_qe/common/widgets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aiidalab_qe/common/widgets.py b/src/aiidalab_qe/common/widgets.py index 87d879526..b53d2b23d 100644 --- a/src/aiidalab_qe/common/widgets.py +++ b/src/aiidalab_qe/common/widgets.py @@ -649,10 +649,10 @@ def _reset_all_tags(self, _=None): def _select_periodicity(self, _=None): """Select periodicity.""" periodicity_options = { - "3D": (True, True, True), - "2D": (True, True, False), - "1D": (True, False, False), - "Molecule": (False, False, False), + "xyz": (True, True, True), + "xy": (True, True, False), + "x": (True, False, False), + "molecule": (False, False, False), } new_structure = deepcopy(self.structure) new_structure.set_pbc(periodicity_options[self.periodicity.value])