<div dir="ltr">Thank you very much, Stefano and Lorenzo, for the helpful information. <div><br><div>W.r.t Lorenzo's points, I think I understood it correctly. Indeed, it is not an observable: </div><div>X(k1,k2, ib1, ib2) = Integral_r Intergral_r' { psi( k1, ib1) psi(k1, ib2)* f(r-r')

psi( k2, ib1)* psi(k2, ib2)} dr dr'</div><div>however, eigenvalues of X(k1,k2) matrix are observable.</div><div><br></div><div>From my tests with different pwscf runs (with different # cores to generate random phases), the matrix elements are phase-dependent (except for the diagonal one, where phase is canceled out) and their eigenvalues  are not phase dependent, which is what I want. It could be because the matrix goes over the whole BZ, the results are gauge invariant.</div><div><br></div><div>Since I am not very confident with the phase, I want to get some comment from developers, and indeed they are very helpful.</div><div><br></div><div>Duy Le<br></div><div>University of Central Florida</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 8, 2020 at 4:21 PM Lorenzo Paulatto <<a href="mailto:paulatz@gmail.com">paulatz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'll add something on Stefano answer that I find useful when working on <br>
this kind of problems: an observable quantity cannot depend on the <br>
random phase. If you want to compute and expression that depends on the <br>
phase it means that 1) it is not an observable 2) you did a mistake 3) both.<br>
<br>
If you fall in (1) it could be that when you sum over all k-points ad/or <br>
occupied bands the phases cancel out. This is annoying, but inevitable. <br>
And it actually allows you to check that your calculations are correct.<br>
<br>
This also mean that you cannot combine wavefunctions-relate quantities <br>
at the same k-point/bands that come from different pw calculations, as <br>
the phases may not cancel out any more (typically a problem when trying <br>
to implement a restart without wavefunctions). I.e. if you want to <br>
compute <psi| (O|psi>) you have to be sure that O|psi> has been computed <br>
with the same |psi> as <psi| or you'll have troubles.<br>
<br>
good work<br>
<br>
<br>
<br>
On 4/8/20 10:06 PM, Stefano de Gironcoli wrote:<br>
> <br>
> On 08/04/20 21:38, Duy Le wrote:<br>
>> Dear developers,<br>
>><br>
>> After reading many threads about the subject, and lot of testing, I <br>
>> still not very confident in handling the phases of wave functions. I <br>
>> would appreciate if you could help me with the following:<br>
>><br>
>> 1. Do all wave-functions (of all bands) of a given k-point have the <br>
>> same phase? In other words, is psi(k, ib1) psi(k, ib2)* gauge invariant?<br>
> <br>
> no. the phase of an eigenvector is determined by the diagonalization <br>
> routine. The safe assumption is that it's basically random, and for <br>
> degenerate eigenvalues you can assume a random (unitary) rotation inside <br>
> the degenerate manifold.  this is why in molecular dynamics simulations <br>
> when you want to extrapolate the starting wavfunctions of a given time <br>
> step from previous ones, before performing the extrapolation, you need <br>
> to align the two (or more) wfc subspaces.<br>
> <br>
> basically you compute W=<psi(t')|psi(t)> and built the unitary rotation <br>
> that best align the two wfc sets from SVD of W ->  U  then build  <br>
> |psi'(t')> = |psi(t')> U as the set at t' best aligned to the wfc at t.<br>
> <br>
> check routine   extrapolate_wfcs   in file update_pot.f90 in PW/src<br>
> <br>
>> 2. I want also to calculate psi(k, ib1) psi(k2, ib2)*. How should it <br>
>> be done so the random phases of wfc do not affect the result?<br>
> <br>
> similarly random phases should be assumed ( in addition to the exp(+ikr) <br>
> phase from the Bloch vector) so you better work with the periodic part <br>
> of the wavefuncitons u(k)<br>
> <br>
> you can compute  the matrix of the overlap of the periodic part of the <br>
> wfcs at the two kpoints  W = < psi(k1)| <br>
> exp(i(k1-k2)r)|psi(k2)>=<u(k1)|u(k2)>,  extract the best unitary <br>
> transformation from that and play with it in order to align wfcs at <br>
> different k's. this is one of the basic operation that Wannier 90 code <br>
> peforms.<br>
> <br>
>> 3. Could you please tell me if there is any part of the PWSCF code <br>
>> that deals with phase of wave function so I can learn how it is done?<br>
> <br>
> see above<br>
> <br>
> best<br>
> <br>
> stefano<br>
> <br>
>><br>
>> Thank you very much. Be safe!<br>
>><br>
>> Duy Le<br>
>> University of Central Florida<br>
>><br>
>> _______________________________________________<br>
>> developers mailing list<br>
>> <a href="mailto:developers@lists.quantum-espresso.org" target="_blank">developers@lists.quantum-espresso.org</a><br>
>> <a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" rel="noreferrer" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/developers</a><br>
> <br>
> _______________________________________________<br>
> developers mailing list<br>
> <a href="mailto:developers@lists.quantum-espresso.org" target="_blank">developers@lists.quantum-espresso.org</a><br>
> <a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" rel="noreferrer" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/developers</a><br>
> <br>
<br>
-- <br>
Lorenzo Paulatto - Paris<br>
_______________________________________________<br>
developers mailing list<br>
<a href="mailto:developers@lists.quantum-espresso.org" target="_blank">developers@lists.quantum-espresso.org</a><br>
<a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" rel="noreferrer" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/developers</a><br>
</blockquote></div>