From 88214e6395cae27c56d2f2baebc168fa2877301e Mon Sep 17 00:00:00 2001 From: AndresOrtegaGuerrero Date: Tue, 19 Nov 2024 17:46:01 +0000 Subject: [PATCH] including logic if scf is present --- src/aiida_quantumespresso/workflows/pdos.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/aiida_quantumespresso/workflows/pdos.py b/src/aiida_quantumespresso/workflows/pdos.py index f3c54c742..c846ce61d 100644 --- a/src/aiida_quantumespresso/workflows/pdos.py +++ b/src/aiida_quantumespresso/workflows/pdos.py @@ -431,20 +431,22 @@ def run_nscf(self): inputs = AttributeDict(self.exposed_inputs(PwBaseWorkChain, 'nscf')) if 'scf' in self.inputs: inputs.pw.parent_folder = self.ctx.scf_parent_folder + + if 'nbands_factor' in self.inputs: + factor = self.inputs.nbands_factor.value + parameters = self.ctx.workchain_scf.outputs.output_parameters.get_dict() + nbands = int(parameters['number_of_bands']) + nelectron = int(parameters['number_of_electrons']) + nbnd = max(int(0.5 * nelectron * factor), int(0.5 * nelectron) + 4, nbands) + inputs.pw.parameters['SYSTEM']['nbnd'] = nbnd + + else: + inputs.pw.parameters['SYSTEM']['nbnd'] = self.ctx.workchain_scf.outputs.output_parameters['number_of_bands'] inputs.pw.structure = self.inputs.structure inputs.metadata.call_link_label = 'nscf' - if 'nbands_factor' in self.inputs: - factor = self.inputs.nbands_factor.value - parameters = self.ctx.workchain_scf.outputs.output_parameters.get_dict() - nbands = int(parameters['number_of_bands']) - nelectron = int(parameters['number_of_electrons']) - nbnd = max(int(0.5 * nelectron * factor), int(0.5 * nelectron) + 4, nbands) - inputs.pw.parameters['SYSTEM']['nbnd'] = nbnd - else: - inputs.pw.parameters['SYSTEM']['nbnd'] = self.ctx.workchain_scf.outputs.output_parameters['number_of_bands'] inputs = prepare_process_inputs(PwBaseWorkChain, inputs)