wannier-developers / wannier90

Official repository of the Wannier90 code
http://www.wannier.org
GNU General Public License v2.0
235 stars 139 forks source link

Optimization of num_cg_steps #363

Open sponce24 opened 3 years ago

sponce24 commented 3 years ago

Hello,

This is a suggestions of improvement (I think I do not have the required credential to add Labels apparently, so could someone add the correct label please?).

The default value for num_cg_steps is 5 and is most likely too small for most systems.

To showcase this, here is the relative difference on the spread (i.e. value of the spread minus the converged value) on a logscale for Si with SOC. The x-axis is the number of iterations (by step of 10 so from 0 to 20,000 iterations). As you can see it takes 20,000 iterations (purple points) to reach convergence (conv_tol = 1E-12) using the default value of num_cg_steps while it takes only 1320 iterations using num_cg_steps = 100 (green points):

image

The best would be to have an adaptative algorithm which makes the num_cg_steps small when the difference between the predicted and the calculated value of the spread after a step is large and make num_cg_steps large when the difference is small.

In addition, one could add some small numerical noise to make sure that there are projections in all unexpected directions where to move and to avoid long plateau due to high symmetry solutions.

Best, Samuel

giovannipizzi commented 3 years ago

Thanks @sponce24 - we should probably do some tests on some tens of systems to see if this behaviour is confirmed; in this case, we should think to change the default. Pinging @qiaojunfeng so he knows and can check the impact in his calculations.