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 c47c93ed..ed0f25a4 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 95dde34d..5cb0f065 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 959048e3..84c3b29e 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 e7183096..abe64163 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 b4230108..51e2536e 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:
+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 = "