diff --git a/src/aiida_quantumespresso_hp/workflows/hp/base.py b/src/aiida_quantumespresso_hp/workflows/hp/base.py index 17d35f7..67eda47 100644 --- a/src/aiida_quantumespresso_hp/workflows/hp/base.py +++ b/src/aiida_quantumespresso_hp/workflows/hp/base.py @@ -210,10 +210,10 @@ def handle_computing_cholesky(self, _): @process_handler(priority=410, exit_codes=HpCalculation.exit_codes.ERROR_CONVERGENCE_NOT_REACHED) def handle_convergence_not_reached(self, _): - """Handle `ERROR_CONVERGENCE_NOT_REACHED`: decrease `alpha_mix`, increase `niter_max`, and restart. + """Handle `ERROR_CONVERGENCE_NOT_REACHED`: decrease `alpha_mix` and restart. Since `hp.x` does not support restarting from incomplete calculations, the entire calculation will have to be - restarted from scratch. By increasing the `niter_max` and decreasing `alpha_mix` there is a chance that the next + restarted from scratch. By decreasing `alpha_mix` there is a chance that the next run will converge. If these keys are present in the input parameters, they will be scaled by a default factor, otherwise, a hardcoded default value will be set that is lower/higher than that of the code's default. """ @@ -232,13 +232,6 @@ def handle_convergence_not_reached(self, _): parameters[parameter] = 0.20 changes.append(f'set `{parameter}` to {parameters[parameter]}') - if 'niter_max' in parameters: - parameters['niter_max'] *= self.defaults.delta_factor_niter_max - else: - parameters['niter_max'] = 200 - - changes.append(f"changed `niter_max` to {parameters['niter_max']}") - if changes: self.report(f"convergence not reached: {', '.join(changes)}") else: diff --git a/src/aiida_quantumespresso_hp/workflows/protocols/hp/base.yaml b/src/aiida_quantumespresso_hp/workflows/protocols/hp/base.yaml index 0e2a402..3e6c846 100644 --- a/src/aiida_quantumespresso_hp/workflows/protocols/hp/base.yaml +++ b/src/aiida_quantumespresso_hp/workflows/protocols/hp/base.yaml @@ -11,6 +11,9 @@ default_inputs: parameters: INPUTHP: conv_thr_chi: 5.e-6 + niter_max: 200 + nmix: 8 + alpha_mix(1): 0.4 qpoints: - 2 - 2 diff --git a/tests/workflows/hp/test_base.py b/tests/workflows/hp/test_base.py index 729d2fc..4701951 100644 --- a/tests/workflows/hp/test_base.py +++ b/tests/workflows/hp/test_base.py @@ -96,11 +96,9 @@ def test_handle_unrecoverable_failure(generate_workchain_hp): @pytest.mark.parametrize( ('inputs', 'expected'), ( - ({}, {'alpha_mix(1)': 0.2, 'niter_max': 200}), - ({'niter_max': 5}, {'alpha_mix(1)': 0.2, 'niter_max': 10}), - ({'alpha_mix(5)': 0.5}, {'alpha_mix(5)': 0.25, 'niter_max': 200}), - ({'alpha_mix(5)': 0.5, 'alpha_mix(10)': 0.4}, {'alpha_mix(5)': 0.25, 'alpha_mix(10)': 0.2, 'niter_max': 200}), - ({'niter_max': 1, 'alpha_mix(2)': 0.3}, {'niter_max': 2, 'alpha_mix(2)': 0.15}), + ({}, {'alpha_mix(1)': 0.2}), + ({'alpha_mix(5)': 0.5}, {'alpha_mix(5)': 0.25}), + ({'alpha_mix(5)': 0.5, 'alpha_mix(10)': 0.4}, {'alpha_mix(5)': 0.25, 'alpha_mix(10)': 0.2}), ), ) # yapf: disable def test_handle_convergence_not_reached(generate_workchain_hp, generate_inputs_hp, inputs, expected): diff --git a/tests/workflows/protocols/hp/test_base/test_default.yml b/tests/workflows/protocols/hp/test_base/test_default.yml index 75c8b3b..f6f7742 100644 --- a/tests/workflows/protocols/hp/test_base/test_default.yml +++ b/tests/workflows/protocols/hp/test_base/test_default.yml @@ -9,7 +9,10 @@ hp: withmpi: true parameters: INPUTHP: + alpha_mix(1): 0.4 conv_thr_chi: 5.0e-06 + niter_max: 200 + nmix: 8 qpoints: - - 2 - 2 diff --git a/tests/workflows/protocols/hp/test_main/test_default.yml b/tests/workflows/protocols/hp/test_main/test_default.yml index 6b15aa1..8b3d0a1 100644 --- a/tests/workflows/protocols/hp/test_main/test_default.yml +++ b/tests/workflows/protocols/hp/test_main/test_default.yml @@ -9,7 +9,10 @@ hp: withmpi: true parameters: INPUTHP: + alpha_mix(1): 0.4 conv_thr_chi: 5.0e-06 + niter_max: 200 + nmix: 8 settings: parent_folder_symlink: true parallelize_atoms: true diff --git a/tests/workflows/protocols/test_hubbard/test_default.yml b/tests/workflows/protocols/test_hubbard/test_default.yml index ee18383..4f6c380 100644 --- a/tests/workflows/protocols/test_hubbard/test_default.yml +++ b/tests/workflows/protocols/test_hubbard/test_default.yml @@ -10,7 +10,10 @@ hubbard: withmpi: true parameters: INPUTHP: + alpha_mix(1): 0.4 conv_thr_chi: 5.0e-06 + niter_max: 200 + nmix: 8 settings: parent_folder_symlink: true parallelize_atoms: true