Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HpBaseWorkChain: Convergence error-handler #48

Closed
t-reents opened this issue Nov 21, 2023 · 2 comments · Fixed by #54
Closed

HpBaseWorkChain: Convergence error-handler #48

t-reents opened this issue Nov 21, 2023 · 2 comments · Fixed by #54

Comments

@t-reents
Copy link
Collaborator

t-reents commented Nov 21, 2023

If a HpCalculation doesn't converge, the parameter niter_max is increased. The error handler doubles the value per default. One of my examples was apparently hard to converge wherefore the error-handler was called multiple times. Based on what I stated before, per default, the value of niter_max will be increased to 800 in the 4th iteration (after calling the error-handler three times). QE has a hard-coded limit of 500 for this parameter which causes the calculation to fail (https://github.com/QEF/q-e/blob/e3968f1e75e8661110548601b5381f9e496e6930/HP/src/hpcom.f90#L91). This being said, I thought that it might be useful to take this into account.

I think there would be different options to handle this.

  1. Limit niter_max to 500 but allow alpha_mix to be further decreased (I'm new to this type of calculations, so not a 100% sure whether this makes sense).
  2. In case 500 would be exceeded, do the last run with niter_max=500 and stop the WorkChain afterwards, if this didn't resolve the problem.

One could also think about considering that users might compiled their own version and the maximum of 500 doesn't apply in those cases.

@bastonero
Copy link
Collaborator

Hi @t-reents, thanks for the excellent suggestions.
As the two issues are not interconnected, could you please open a new issue with the parallelization problem and keep this one only for the handler (and edit it correspondingly)?
So we can open specific PRs to solve them separately.

@t-reents t-reents changed the title Convergence error-handler and parallel submission HpBaseWorkChain: Convergence error-handler Dec 6, 2023
@t-reents
Copy link
Collaborator Author

t-reents commented Dec 6, 2023

For sure.

bastonero added a commit that referenced this issue Dec 8, 2023
Fixes #48 

The binary `hp.x` has an hard coded maximum for `niter_max` of 500, and
the error handler wasn't taking this into account, resulting in calculation failures.
The `convergence_not_reached` handler is now adapted to only change `alpha_mix`. 
`niter_max`, `nmix` and `alpha_mix` are also now sensibly defined in the protocol.

Co-authored-by: Timo Reents <[email protected]>
Co-authored-by: Lorenzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants