diff --git a/src/aiidalab_qe/app/configuration/advanced.py b/src/aiidalab_qe/app/configuration/advanced.py index a311eda7..50c07995 100644 --- a/src/aiidalab_qe/app/configuration/advanced.py +++ b/src/aiidalab_qe/app/configuration/advanced.py @@ -27,7 +27,9 @@ class AdvancedSettings(Panel): """

Advanced Settings

""" ) - description = ipw.HTML("""Select the advanced settings for the pw.x code.""") + pw_adv_description = ipw.HTML( + """Select the advanced settings for the pw.x code.""" + ) kpoints_description = ipw.HTML( """
The k-points mesh density of the SCF calculation is set by the protocol. @@ -47,6 +49,18 @@ class AdvancedSettings(Panel): def __init__(self, default_protocol=None, **kwargs): self._default_protocol = default_protocol or DEFAULT_PARAMETERS["protocol"] + # clean-up workchain settings + self.clean_workdir = ipw.Checkbox( + description="", + indent=False, + value=True, + layout=ipw.Layout(max_width="20px"), + ) + self.clean_workdir_description = ipw.HTML( + """
+ Tick to clean-up the work directory after the calculation is finished.
""" + ) + # Override setting widget self.override_prompt = ipw.HTML("  Override ") self.override = ipw.Checkbox( @@ -120,7 +134,11 @@ def __init__(self, default_protocol=None, **kwargs): self.children = [ self.title, ipw.HBox( - [self.description, self.override_widget], + [self.clean_workdir, self.clean_workdir_description], + layout=ipw.Layout(height="50px", justify_content="flex-start"), + ), + ipw.HBox( + [self.pw_adv_description, self.override_widget], layout=ipw.Layout(height="50px", justify_content="space-between"), ), # total charge setting widget @@ -193,6 +211,7 @@ def update_settings(self, **kwargs): def get_panel_value(self): # create the the initial_magnetic_moments as None (Default) + # XXX: start from parameters = {} and then bundle the settings by purposes (e.g. pw, bands, etc.) parameters = { "initial_magnetic_moments": None, "pw": { @@ -201,6 +220,10 @@ def get_panel_value(self): }, }, } + # add clean_workdir to the parameters + parameters["clean_workdir"] = self.clean_workdir.value + + # add the pseudo_family to the parameters parameters["pseudo_family"] = self.pseudo_family_selector.value if self.pseudo_setter.pseudos: parameters["pw"]["pseudos"] = self.pseudo_setter.pseudos diff --git a/src/aiidalab_qe/workflows/__init__.py b/src/aiidalab_qe/workflows/__init__.py index 4f9236ad..0d1eb99f 100644 --- a/src/aiidalab_qe/workflows/__init__.py +++ b/src/aiidalab_qe/workflows/__init__.py @@ -52,7 +52,7 @@ def define(cls, spec): super().define(spec) spec.input('structure', valid_type=StructureData, help='The inputs structure.') - spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False), + spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(True), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.input('properties', valid_type=orm.List, default=lambda: orm.List(), help='The properties to calculate, used to control the logic of QeAppWorkChain.') @@ -111,7 +111,6 @@ def get_builder_from_protocol( cls, structure, parameters=None, - clean_workdir=False, **kwargs, ): """Return a builder prepopulated with inputs selected according to the chosen protocol.""" @@ -161,6 +160,9 @@ def get_builder_from_protocol( else: builder.pop(name, None) + # XXX (unkcpz) I smell not proper design here since I have to look at + # configuration step to know what show be set here. + clean_workdir = parameters["advanced"]["clean_workdir"] builder.clean_workdir = orm.Bool(clean_workdir) return builder diff --git a/tests/conftest.py b/tests/conftest.py index 796d29af..1c03dd7e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -293,7 +293,7 @@ def _smearing_settings_generator(**kwargs): @pytest.fixture -def app(pw_code, dos_code, projwfc_code, sssp): +def app(pw_code, dos_code, projwfc_code): from aiidalab_qe.app.main import App app = App(qe_auto_setup=False) @@ -321,8 +321,6 @@ def app(pw_code, dos_code, projwfc_code, sssp): def submit_app_generator( app, generate_structure_data, - workchain_settings_generator, - smearing_settings_generator, ): """Return a function that generates a submit step widget.""" diff --git a/tests/test_configure.py b/tests/test_configure.py index abe5547e..4e677afa 100644 --- a/tests/test_configure.py +++ b/tests/test_configure.py @@ -16,7 +16,6 @@ def test_get_configuration_parameters(): wg = ConfigureQeAppWorkChainStep() parameters = wg.get_configuration_parameters() - print("parameters:", parameters) parameters_ref = { "workchain": wg.workchain_settings.get_panel_value(), "advanced": wg.advanced_settings.get_panel_value(), diff --git a/tests/test_submit_qe_workchain/test_create_builder_default.yml b/tests/test_submit_qe_workchain/test_create_builder_default.yml index b2af426f..49de55d6 100644 --- a/tests/test_submit_qe_workchain/test_create_builder_default.yml +++ b/tests/test_submit_qe_workchain/test_create_builder_default.yml @@ -57,7 +57,7 @@ bands: tot_charge: 0.0 pseudos: Si: Si.upf -clean_workdir: false +clean_workdir: true pdos: dos: parameters: