From a8db09400da748264a00670e4c3569644faf3bef Mon Sep 17 00:00:00 2001 From: Michael Hernandez Bertran Date: Mon, 29 Jan 2024 15:50:41 +0100 Subject: [PATCH 1/3] XPS: Fix inputs for molecules If is a molecular structure: * Adds the 'mt' to `ch_scf` in order to treat charged molecular systems * Performs the SCF calculations at Gamma point. --- src/aiida_quantumespresso/workflows/xps.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/aiida_quantumespresso/workflows/xps.py b/src/aiida_quantumespresso/workflows/xps.py index a30ce5347..d06286f81 100644 --- a/src/aiida_quantumespresso/workflows/xps.py +++ b/src/aiida_quantumespresso/workflows/xps.py @@ -374,11 +374,11 @@ def get_treatment_filepath(cls): return files(protocols) / 'core_hole_treatments.yaml' @classmethod - def get_builder_from_protocol( + def get_builder_from_protocol( # pylint: disable=too-many-statements cls, code, structure, pseudos, core_hole_treatments=None, protocol=None, overrides=None, elements_list=None, atoms_list=None, options=None, structure_preparation_settings=None, correction_energies=None, **kwargs - ): + ): # pylint: enable=too-many-statements """Return a builder prepopulated with inputs selected according to the chosen protocol. :param code: the ``Code`` instance configured for the ``quantumespresso.pw`` plugin. @@ -463,6 +463,10 @@ def get_builder_from_protocol( # for get_xspectra_structures if structure_preparation_settings: builder.structure_preparation_settings = structure_preparation_settings + if structure_preparation_settings.get('is_molecule_input').value: + builder.ch_scf.pw.parameters.base.attributes.all['SYSTEM']['assume_isolated']='mt' + builder.ch_scf.pw.settings=orm.Dict(dict={'gamma_only':True}) + builder.relax.base.pw.settings=orm.Dict(dict={'gamma_only':True}) # pylint: enable=no-member return builder @@ -580,8 +584,8 @@ def prepare_structures(self): 'call_link_label' : 'get_marked_structures' } } - result = get_marked_structures(input_structure, **inputs) - self.ctx.supercell = input_structure + result = get_marked_structures(input_structure, **inputs) # pylint: disable=unexpected-keyword-arg + self.ctx.supercell = input_structure # pylint: enable=unexpected-keyword-arg self.ctx.equivalent_sites_data = result.pop('output_parameters').get_dict() structures_to_process = {f'{Key.split("_")[0]}_{Key.split("_")[1]}' : Value for Key, Value in result.items()} self.report(f'structures_to_process: {structures_to_process}') From de185477b74d8c9022f0e8cd0b29297c7b793633 Mon Sep 17 00:00:00 2001 From: superstar54 Date: Tue, 12 Mar 2024 13:37:51 +0100 Subject: [PATCH 2/3] fix pylint error --- src/aiida_quantumespresso/workflows/xps.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aiida_quantumespresso/workflows/xps.py b/src/aiida_quantumespresso/workflows/xps.py index d06286f81..ce121de67 100644 --- a/src/aiida_quantumespresso/workflows/xps.py +++ b/src/aiida_quantumespresso/workflows/xps.py @@ -374,11 +374,11 @@ def get_treatment_filepath(cls): return files(protocols) / 'core_hole_treatments.yaml' @classmethod - def get_builder_from_protocol( # pylint: disable=too-many-statements + def get_builder_from_protocol( cls, code, structure, pseudos, core_hole_treatments=None, protocol=None, overrides=None, elements_list=None, atoms_list=None, options=None, structure_preparation_settings=None, correction_energies=None, **kwargs - ): # pylint: enable=too-many-statements + ): # pylint: disable=too-many-statements """Return a builder prepopulated with inputs selected according to the chosen protocol. :param code: the ``Code`` instance configured for the ``quantumespresso.pw`` plugin. @@ -584,8 +584,8 @@ def prepare_structures(self): 'call_link_label' : 'get_marked_structures' } } - result = get_marked_structures(input_structure, **inputs) # pylint: disable=unexpected-keyword-arg - self.ctx.supercell = input_structure # pylint: enable=unexpected-keyword-arg + result = get_marked_structures(input_structure, **inputs) + self.ctx.supercell = input_structure self.ctx.equivalent_sites_data = result.pop('output_parameters').get_dict() structures_to_process = {f'{Key.split("_")[0]}_{Key.split("_")[1]}' : Value for Key, Value in result.items()} self.report(f'structures_to_process: {structures_to_process}') From 9c5be5e11d474d6278717e6d72d5d6aa7190bc3f Mon Sep 17 00:00:00 2001 From: superstar54 Date: Tue, 19 Mar 2024 13:51:41 +0000 Subject: [PATCH 3/3] set kpoint to [0, 1, 1] for molecule --- src/aiida_quantumespresso/workflows/xps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/aiida_quantumespresso/workflows/xps.py b/src/aiida_quantumespresso/workflows/xps.py index ce121de67..ed4fdc01b 100644 --- a/src/aiida_quantumespresso/workflows/xps.py +++ b/src/aiida_quantumespresso/workflows/xps.py @@ -466,6 +466,10 @@ def get_builder_from_protocol( if structure_preparation_settings.get('is_molecule_input').value: builder.ch_scf.pw.parameters.base.attributes.all['SYSTEM']['assume_isolated']='mt' builder.ch_scf.pw.settings=orm.Dict(dict={'gamma_only':True}) + # To ensure compatibility with the gamma_only setting, the k-points must be configured to [1, 1, 1]. + kpoints_mesh = DataFactory('core.array.kpoints')() + kpoints_mesh.set_kpoints_mesh([1, 1, 1]) + builder.ch_scf.kpoints = kpoints_mesh builder.relax.base.pw.settings=orm.Dict(dict={'gamma_only':True}) # pylint: enable=no-member return builder