Missing (-1)^l factor in atomic wavefunctions
In a recent commit the factor (-1)^l that was present in atomic_wfc_nc_updown
(spin-orbit/noncollinear case only) has gone missing when such routine was merged into atomic_wfc
. The factor was not present in atomic_wfc
and nobody had noticed its absence. It would have gone unnoticed forever, if it weren't for DFT+U for spin-orbit / noncollinear cases contained in the examples for HP: for mysterious reasons, stresses are different enough to trigger a warning for discrepancy. This MR adds the phase factor.
I do not think that a factor multiplying atomic wavefunctions should make any difference in final results, so I see two possibilities here:
- there is a serious numerical instability in stress calculation, or
- some implicit assumption on the form of the atomic wavefunctions is hidden in the stress-computing code
None of the above looks good to me. By the way, the spin-orbit/noncollinear DFT+U with lda_plus_u_kind=1
has a similar pathology: atomic wavefunctions differing by a multiplicative factor (-i for the down spin if I remember correctly) yield different results, already in the scf.