One more question. Why the diagonal matrix elements of dipoles are all zeros in the shifted grid method? I thought it should be the Berry connections and the summation over all the occupied bands and k points would give the electric polarization. Am I missing something?
From the source code, it seems that the arbitrary phase of <vk+q|ck> is compensated by multiplying <vk|vk+q>. So when q is very small, it is a good approximation <vk|vk+q> = 1.
The dipoles are defined as <nk|r|mk>. For n different from m this corresponds to (1/iq)<nk|mk+q> while for n=m to (1/iq)(<nk|mk+q>-1)
You can see that if you start from <nk|e^{iqr}|mk'> and taylor expand, e^{iqr}
Besides that, for linear response properties, the diagonal dipoles are not needed, so for simplicity, we set them equal to zero.
Btw, I'm curious how Yambo align the phases from different k points in order to perform the finite difference? By singular value decomposition of the overlap matrix?
Indeed we are currently working on improving such part in order to also have the diagonal dipoles via SVD.
Best,
D.