Skip to content

Commit

Permalink
Fix bug in the hubbard outline
Browse files Browse the repository at this point in the history
  • Loading branch information
bastonero committed Dec 5, 2023
1 parent 7aa81fd commit f9f949f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/aiida_quantumespresso_hp/workflows/hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tests/workflows/test_hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand Down

0 comments on commit f9f949f

Please sign in to comment.