Page 2 of 2

Re: SCDM-k bug with different pseudopotentials?

Posted: Fri May 15, 2020 2:03 pm
by hlee
Dear adenchfi:
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.
No, the essential part of the SCDM method is not parallelized even in Wannier90 (W90).
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
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.
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?
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.

Sincerely,

H. Lee

Re: SCDM-k bug with different pseudopotentials?

Posted: Fri May 15, 2020 4:00 pm
by roxana
Hi,

Just to add to Hyungjun email. SCDM-k implementation in EPW and pw2wannier.f90 subroutines should be the same unless some modifications were done in the pw2wannier.f90 implementation sometime after the release of QE 6.5 in November 2019.

Best,
Roxana

Re: SCDM-k bug with different pseudopotentials?

Posted: Fri May 15, 2020 10:13 pm
by adenchfi
Alright, thanks! I'll be tinkering.

Re: SCDM-k bug with different pseudopotentials?

Posted: Thu May 21, 2020 1:49 am
by adenchfi
Hello,

As a comment, the SCDM-k using pw2wannier90 seems to be working just fine for me with my larger RTe3 system; when I tried doing it with purely EPW, constructing Amn never seemed to complete. (Doing it through EPW with smaller systems like Si still works fine though)

It could be what you said H. Lee about the distribution of the FFT grids, but I tried decreasing the size of the FFT grid for my system by lowering scf/nscf cutoff energies, and it didn't seem to help. Maybe I didn't decrease it enough.

Still, your advice about switching over to directly using pw2wannier90 and wannier90 was good, so thank you! Now I just need to develop my Wannier90 skills, haha.

Re: SCDM-k bug with different pseudopotentials?

Posted: Thu May 21, 2020 3:10 pm
by hlee
Dear adenchfi:

Thank you for the feedback. It might be helpful for me to give the more clear suggestion if you provide more information on the running status of your runs.
They both involve nrtot, so I suppose with the default FFT grid (160x160x54, according to my epw.out) it must really be bottlenecking at those spots.
If the FFT grid of 160x160x54 represents the soft FFT grid, in EPW this is not distributed. In pw2wannier90, if you are using 10 cores, this is distributed over 10 cores since in pw2wannier90, the parallelization over k points (-nk) is not supported and only G-vector parallization is supported.

As I said several times, the QR factorization is only done on the ionode both in epw and pw2wannier90.

In any case, if you succeed in getting good Wannier functions using the SCDM method in the route using pw2wannier90+Wannier90, but still have difficulty with it in EPW, please let me know it. I will guide you about the way to import the relevant data from W90 in EPW.

Sincerely,

H. Lee

Re: SCDM-k bug with different pseudopotentials?

Posted: Sun May 31, 2020 12:59 am
by adenchfi
Hello H. Lee,

Thanks again for your assistance!

I have tinkered with the SCDM-k method a lot for my systems in the past few days. There are only 4 bands crossing the Fermi level, but they're entangled with other bands over a huge (> 30 eV) energy window.

Using 18 Wannier functions and the SCDM-k method through w90 directly worked quite well, I got great localization for my system, but the Fermi level properties weren't represented well. Introducing a small frozen window around E_fermi made me have to use a lot of disentanglement steps (a few thousand) before the localization was good again. Doing the SCDM-k via EPW didn't seem to work with my system, getting stuck on the part I mentioned above. But using w90 and pw2wan works fine.

I would appreciate it if you guided me in using Wannier90 output to then run EPW, as doing the above took many computing hours already (it turns out I needed a tight nscf k-mesh for my system, which meant the wannier90 disentanglement took a long time). I don't have the 'filukk'.

Re: SCDM-k bug with different pseudopotentials?

Posted: Mon Jun 01, 2020 3:18 pm
by hlee
Dear adenchfi:

Basically, it is not difficult for EPW to import the relevant data from W90.
However, you should be VERY careful at the fact that you should use the SAME wavefunctions in constructing Wannier functions and evaluating the electron-phonon matrix elements. Otherwise, your results are totally meaningless due to the gauge inconsistency.
This is why EPW constructs Wannier functions AND evaluates electron-phonon matrix elements internally.

In order for EPW to import the relevant data from W90, you just need to modify the subroutine of plot_u_matrices in W90 so that it writes the relevant informations in the format compatible with EPW.
Please compare the subroutine of plot_u_matrices in src/plot.F90 in W90 and the subroutine of loadumat.f90 in EPW/src .

To do this, you need to understand how variables in W90 and EPW match and modify plot_u_matrices so as to write additional data, for instance, exdata and w_centers which are stored in .ukk file.

Sincerely,

H. Lee

Re: SCDM-k bug with different pseudopotentials?

Posted: Mon Jun 01, 2020 8:56 pm
by adenchfi
Hello H. Lee,

Thank you! I will work on your suggestions.