From f9f949f2b4e7ded061d59d1d92d90c078ca4bac0 Mon Sep 17 00:00:00 2001 From: bastonero Date: Tue, 5 Dec 2023 15:29:07 +0000 Subject: [PATCH] Fix bug in the hubbard outline --- src/aiida_quantumespresso_hp/workflows/hubbard.py | 7 ++++--- .../workflows/protocols/hubbard.yaml | 2 +- tests/workflows/test_hubbard.py | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/aiida_quantumespresso_hp/workflows/hubbard.py b/src/aiida_quantumespresso_hp/workflows/hubbard.py index 0789695..a62c3fb 100644 --- a/src/aiida_quantumespresso_hp/workflows/hubbard.py +++ b/src/aiida_quantumespresso_hp/workflows/hubbard.py @@ -158,9 +158,7 @@ def define(cls, spec): ), cls.run_hp, cls.inspect_hp, - if_(cls.should_check_convergence)( - cls.check_convergence, - ), + cls.check_convergence, if_(cls.should_clean_workdir)( cls.clean_iteration, ) @@ -628,6 +626,9 @@ def check_convergence(self): self.ctx.current_magnetic_moments = result['starting_magnetization'] break + if not self.should_check_convergence(): + return + if not len(ref_params) == len(new_params): self.report('The new and old Hubbard parameters have different lenghts. Assuming to be at the first cycle.') return diff --git a/src/aiida_quantumespresso_hp/workflows/protocols/hubbard.yaml b/src/aiida_quantumespresso_hp/workflows/protocols/hubbard.yaml index 9c39c49..2459162 100644 --- a/src/aiida_quantumespresso_hp/workflows/protocols/hubbard.yaml +++ b/src/aiida_quantumespresso_hp/workflows/protocols/hubbard.yaml @@ -6,7 +6,7 @@ default_inputs: tolerance_intersite: 0.01 radial_analysis: radius_max: 10.0 # in Angstrom - thr: 0.01 + thr: 0.1 nn_finder: 'crystal' scf: kpoints_distance: 0.4 diff --git a/tests/workflows/test_hubbard.py b/tests/workflows/test_hubbard.py index 13dc817..b320329 100644 --- a/tests/workflows/test_hubbard.py +++ b/tests/workflows/test_hubbard.py @@ -257,6 +257,8 @@ def test_radial_analysis( We want to make sure `rmax` is in `hp.parameters`. """ + from aiida.orm import load_node + inputs = generate_inputs_hubbard() inputs['radial_analysis'] = Dict({}) # no need to specify inputs, it will use the defaults process = generate_workchain_hubbard(inputs=inputs) @@ -265,8 +267,9 @@ def test_radial_analysis( process.ctx.workchains_scf = [generate_scf_workchain_node(remote_folder=True)] process.run_hp() - # parameters = process.ctx['workchains_hp'][-1].inputs['hp']['parameters'].get_dict() - # assert 'rmax' in parameters + node = load_node(process.ctx['workchains_hp'][-1].pk) + parameters = node.inputs['hp']['parameters'].get_dict() + assert 'rmax' in parameters['INPUTHP'] @pytest.mark.usefixtures('aiida_profile')