JuliaMolSim/DFTK.jl

Minus sign in Fourier transform of projectors

Closed this issue · 6 comments

While I was rewriting the Wannier interface (#854), I need to project Bloch states onto localized orbitals, so I need sth similar to build_form_factors here,

for l in 0:psp.lmax, m in -l:l
angular = im^l * ylm_real(l, m, q)
for iproj_l in 1:count_n_proj_radial(psp, l)
form_factors[iq, count] = radials_q[iproj_l, l+1] * angular
count += 1
end
end

However, when I check the equations, I think it should be (-im)^l instead of the current im^l. I wrote down some formulas here
https://wannierjl.org/theory/initial_projection/
and some numerical tests here
https://wannierjl.org/theory/pluto_fourier

I uses (-im)^l in the #854, in principle this is just a phase factor of wavefunctions. But for instance, if we were to construct a linear combination of s and px orbitals, then this minus sign will give us different results, s+px or s-px, so maybe we should also update the build_form_factors

@azadoks maybe you also paste here the table containing investigations on the QE subroutines? Thanks a lot!

Wannier90 interface in QE:  (-i)^l
Atomic WFC code in QE:      (+i)^l
Non-local projectors in QE: (-i)^l
Wikipedia:                  (-i)^l
DFTK code:                  (+i)^l
DFTK docs:                  (-i)^l  (equivalently written as ylm_real(-r/|r|))
ABINIT:                     ??????

Yes, of course, https://en.wikipedia.org/wiki/Spherical_harmonics#Parity so the formula at https://docs.dftk.org/dev/developer/useful_formulas/ can (and should) be rewritten as (-i)^l. I think we haphazardly coded the formula in the very beginning of DFTK, and then later did the docs properly, but didn't see there was an error in the code, since it doesn't affect the physical properties... Thanks a lot for finding this! You can just fix it in your wannier (or a separate) PR if that's convenient, otherwise I'll just fix it later.

I went ahead and did it: #856

I went ahead and did it: #856

Thanks a lot for the clarification, this is great!

Thanks for flagging this @qiaojunfeng !