Skip to content

Commit

Permalink
Workflows: fix logic for relabeling (#40)
Browse files Browse the repository at this point in the history
The current logic avoids checking the convergence
of Hubbard parameters if relabeling is performed.
This is incorrect and it is removed.
  • Loading branch information
bastonero authored May 30, 2023
1 parent fd197cf commit 02021a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/aiida_quantumespresso_hp/workflows/hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ def check_convergence(self):
self.ctx.current_hubbard_structure = result['hubbard_structure']
if self.ctx.current_magnetic_moments is not None:
self.ctx.current_magnetic_moments = result['starting_magnetization']
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.')
Expand Down
8 changes: 7 additions & 1 deletion tests/workflows/test_hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,17 @@ def test_relabel_check_convergence(
# Mocking current (i.e. "old") and "new" HubbardStructureData,
# containing different Hubbard parameters
process.ctx.current_hubbard_structure = generate_hubbard_structure()
process.ctx.workchains_hp = [generate_hp_workchain_node(relabel=True)]
process.ctx.workchains_hp = [generate_hp_workchain_node(relabel=True, u_value=100)]

process.check_convergence()
assert not process.ctx.is_converged

process.ctx.current_hubbard_structure = generate_hubbard_structure(u_value=99.99)
process.ctx.workchains_hp = [generate_hp_workchain_node(relabel=True, u_value=100)]

process.check_convergence()
assert process.ctx.is_converged


@pytest.mark.usefixtures('aiida_profile')
def test_inspect_hp(generate_workchain_hubbard, generate_inputs_hubbard, generate_hp_workchain_node):
Expand Down

0 comments on commit 02021a0

Please sign in to comment.