Open janssenhenning opened 2 years ago
I think one can use the BaseRestartWorkChain
to implement this behaviour. In this case one would have a second, wrapping BaseSCF
WorkChain (similarly to Relax
and BaseRelax
WorkChains). The BaseSCF
WorkChain would inherit from BaseRestartWorkChain
. It could detect that the nested SCF WorkChain did not converge charge densities and apply corresponding changes via executing an error handler.
This is of course a possibility, but I fear in this case this would not give much benefit over the alternative approach of refactoring the SCF workchain itself to allow it to make more fine-grained choices about changes to the input file. This would not only lead to the workchain code to be much more testable (Atleast with the design I had in mind) and I fear if the BaseRestartWorkChain is employed this could lead to the following situation
When a user needs to change convergence parameters after every fleur calculation, tweaking mixing parameters etc., the SCF workchain itself would become a rather useless layer in between that does nothing except check the convergence, since it performs one fleur call at a time. In addition the error handler approach is rather complicated to understand for normal aiida users so it might discourage them to tweak the convergence strategies to their own liking.
The outline I would have in mind is
ConvergenceStrategy
and ConvergenceHistory
. The latter is a dataclass, which acts as the holder of all the distance lists previously in the scf workchain and the former uses this class to make suggestions according to it's strategy. (normal python classes should be able to be assigned to the context as long as their attributes are json serializable)ConvergenceStrategy
class can be subclassed to customize the behaviourspec.outline(cls.start,
cls.validate_input,
if_(cls.fleurinpgen_needed)(cls.run_fleurinpgen),
while_(cls.condition)(cls.ask_strategy_for_changes,
cls.run_fleur,
cls.inspect_fleur,
cls.get_res),
cls.return_results
)
The SCF workchain is missing important features for improving the convergence. There is no way of defining strategies, that can make changes to help convergence between fleur runs
The design should be customizable, i.e. users should be able to easily create their own strategies and follow the following workflow (The strategy sees the history of distances and maybe more)