Re: SCDM-k bug with different pseudopotentials?
Posted: Fri May 15, 2020 2:03 pm
Dear adenchfi:
The generation of Amn matrix using the SCDM is done in pw2wannier90.f90 in PP/src.
Below is the excerpt from pw2wannier.f90.
As you can see, the main difference between pw2wannier90 and EPW is that in pw2wannier90 plane waves (FFT grids) are distributed, leading to the parallelization of the inverse Fourier transfrom (invFFT), but in EPW invFFT is not parallelized since plane waves (FFT grids) are not distributed.
Regarding other parts, both pw2wannier90 and EPW are the same; that is, the QR factorization is only done on the ionode and after gather_grid, the operation on psi_gamma is done only on the first processor of the FFT communicator, dfft%root.
The reason why I suggest you to start with W90 is that construction of Wannier functions is basically done by a trial-and-error approach; you need to vary some parameters and rerun Wannierization until you get good Wannier functions. For this purpose, (in my opinion) I think that it is more convenient to use W90.
After finding the good parameters and getting good Wannier functions, you have to return to EPW and construct Wannier functions in EPW using the same parameters you found in the test run of W90.
Sincerely,
H. Lee
No, the essential part of the SCDM method is not parallelized even in Wannier90 (W90).I assume this is because the SCDM-k is working and parallelized in Wannier90 already. I'll likely take this suggestion next, despite the extra steps in getting WFs via W90 first via manually.
The generation of Amn matrix using the SCDM is done in pw2wannier90.f90 in PP/src.
Below is the excerpt from pw2wannier.f90.
Code: Select all
CALL invfft ('Wave', psic, dffts)
#if defined(__MPI)
CALL gather_grid(dffts,psic,psic_all)
! vv: Gamma only
! vv: Build Psi_k = Unk * focc
norm_psi = sqrt(real(sum(psic_all(1:nrtot)*conjg(psic_all(1:nrtot))),kind=DP))
psic_all(1:nrtot) = psic_all(1:nrtot)/ norm_psi
psi_gamma(1:nrtot,locibnd) = psic_all(1:nrtot)
psi_gamma(1:nrtot,locibnd) = psi_gamma(1:nrtot,locibnd) * f_gamma
#else
norm_psi = sqrt(real(sum(psic(1:nrtot)*conjg(psic(1:nrtot))),kind=DP))
psic(1:nrtot) = psic(1:nrtot)/ norm_psi
psi_gamma(1:nrtot,locibnd) = psic(1:nrtot)
psi_gamma(1:nrtot,locibnd) = psi_gamma(1:nrtot,locibnd) * f_gamma
#endif
...
#if defined(__MPI)
IF(ionode) THEN
CALL ZGEQP3(numbands,nrtot,TRANSPOSE(CONJG(psi_gamma)),numbands,piv,qr_tau,cwork,lcwork,rwork,info)
IF(info/=0) call errore('compute_amn','Error in computing the QR factorization',1)
ENDIF
CALL mp_bcast(piv,ionode_id,world_comm)
#else
! vv: Perform QR factorization with pivoting on Psi_Gamma
CALL ZGEQP3(numbands,nrtot,TRANSPOSE(CONJG(psi_gamma)),numbands,piv,qr_tau,cwork,lcwork,rwork,info)
IF(info/=0) call errore('compute_amn','Error in computing the QR factorization',1)
#endif
Regarding other parts, both pw2wannier90 and EPW are the same; that is, the QR factorization is only done on the ionode and after gather_grid, the operation on psi_gamma is done only on the first processor of the FFT communicator, dfft%root.
The reason why I suggest you to start with W90 is that construction of Wannier functions is basically done by a trial-and-error approach; you need to vary some parameters and rerun Wannierization until you get good Wannier functions. For this purpose, (in my opinion) I think that it is more convenient to use W90.
After finding the good parameters and getting good Wannier functions, you have to return to EPW and construct Wannier functions in EPW using the same parameters you found in the test run of W90.
I didn't implement the part of SCDM-k in EPW, but I don't think that the SCDM-k implementation is more complete on the purely W90 side; I think that they are the same. More importantly, currently there is no way to use Wannier functions obtained from W90 in EPW. As I mentioned above, with the parameters you found in the test run of W90, you have to rerun Wannierization in EPW.Anyway, it sounds like the SCDM-k implementation is more complete on the purely W90 side, so I'll work on generating the WFs via W90 before using them in EPW. Is there documentation for having EPW use WFs generated by W90 first, as you are suggesting?
Sincerely,
H. Lee