shifted grids method for dipoles

You can find here problems arising when using old releases of Yambo (< 5.0). Issues as parallelization strategy, performance issues and other technical aspects.

Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

shifted grids method for dipoles

Post by Xiaoming Wang » Fri Jul 23, 2021 1:24 pm

Hello,

I follow the instructions on this thread viewtopic.php?f=13&t=1789 to calculate the dipoles using the shifted grids method, but sometimes I experienced failures. The errors are

Code: Select all

 <---> P1-r7i0n1: loading info from shift_1
P1-r7i0n1: [ERROR] STOP signal received while in[01] Dipoles
P1-r7i0n1: [ERROR] Shifted grid in folder "shift_1": parameters not consistent
I checked the database and found that there is a small difference. The Max WF components of the original database is 187802 while for the shifted grid it is 187803. How can I get rid of this? Perhaps by changing the KShift step? Also do you have any suggestions on the value of the Kshift step? Btw, how to make sure the generated k grids have same Max WF components before doing expensive nscf calculations?

Best,
Xiaoming
Xiaoming Wang
The University of Toledo

User avatar
Davide Sangalli
Posts: 614
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: shifted grids method for dipoles

Post by Davide Sangalli » Mon Jul 26, 2021 9:21 am

Dear Xiaoming,
I think indeed the condition on WF components is too strict.

You can safely replace this line in src/dipoles/DIPOLE_shifted_grids.F

Code: Select all

   !
   if (any( (/nkibz_save/=nkibz_shifted, wf_ncx_save/=wf_ncx_shifted/) ) ) &
&    call error(' Shifted grid in folder "'//trim(grid_paths_vector(iq))//'": parameters not consistent')
with

Code: Select all

   !
   if (nkibz_save/=nkibz_shifted) &
&    call error(' Shifted grid in folder "'//trim(grid_paths_vector(iq))//'": k-points not consistent')
   !
   if (wf_ncx_save/=wf_ncx_shifted) &
&    call warning(' Shifted grid in folder "'//trim(grid_paths_vector(iq))//'": change in number of WFs components')
recompile yambo, and proceed with the simulations.

Best,
D.
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

Re: shifted grids method for dipoles

Post by Xiaoming Wang » Wed Jul 28, 2021 7:10 am

Dear Davide,

Thanks for the patch and it works.

However, I came across another problem. The calculation seems to get stuck right before the end.
My input is:

Code: Select all

optics                           # [R] Linear Response optical properties
infver                           # [R] Input file variables verbosity
#chi                              # [R][CHI] Dyson equation for Chi.
dipoles                          # [R] Oscillator strenghts (or dipoles)
NLogCPUs= 1                      # [PARALLEL] Live-timing CPU`s (0 for all)
DIP_CPU= "13 8 1"               # [PARALLEL] CPUs for each role
DIP_ROLEs= "k c v"               # [PARALLEL] CPUs roles (k,c,v)
DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles
X_Threads=0                      # [OPENMP/X] Number of threads for response functions
NonPDirs= "none"                 # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)
Chimod= "IP"                     # [X] IP/Hartree/ALDA/LRC/PF/BSfxc
% DipBands
    1 | 1680 |                       # [DIP] Bands range for dipoles
%
DipBandsALL                   # [DIP] Compute all bands range, not only valence and conduction
DipApproach= "Shifted grids"         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]
#DipApproach= "G-space v"
#DipComputed= "R P V"             # [DIP] [default R P V; extra P2 Spin Orb]
#DipPDirect                    # [DIP] Directly compute <v> also when using other approaches for dipoles
ShiftedPaths= "shift_1 shift_2 shift_3"                 # [DIP] Shifted grids paths (separated by a space)
% QpntsRXd
 1 | 1 |                             # [Xd] Transferred momenta
%
% BndsRnXd
    1 | 1680 |                       # [Xd] Polarization function bands
%
% EnRngeXd
 0.000000 | 4.000000 |         eV    # [Xd] Energy range
%
% DmRngeXd
 0.100000 | 0.100000 |         eV    # [Xd] Damping range
%
ETStpsXd= 1001                   # [Xd] Total Energy steps
% LongDrXd
 1.000000 | 0.000000 | 0.000000 |        # [Xd] [cc] Electric Field
%
% XfnQP_E
 1.300000 | 1.000000 | 1.000000 |        # [EXTQP Xd] E parameters  (c/v) eV|adim|adim
%
The report and log files are attached.
log.txt
report.txt
Best,
Xiaoming
You do not have the required permissions to view the files attached to this post.
Xiaoming Wang
The University of Toledo

User avatar
Davide Sangalli
Posts: 614
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: shifted grids method for dipoles

Post by Davide Sangalli » Tue Aug 31, 2021 1:21 pm

Dear Xiaoming,
indeed the log file seems to be waiting for other MPI tasks (?)
If you have the log for all the MPI tasks, please check if any of them is still performing calculations.

The other thing you can check is if the `ndb.dipoles` file was created at all.

Best,
D
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

Re: shifted grids method for dipoles

Post by Xiaoming Wang » Mon Oct 04, 2021 6:05 pm

Thanks Davide, the problem is solved.

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?

Best,
Xiaoming
Xiaoming Wang
The University of Toledo

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

Re: shifted grids method for dipoles

Post by Xiaoming Wang » Wed Oct 06, 2021 4:22 pm

Hi,

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?

Best,
Xiaoming
Xiaoming Wang
The University of Toledo

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

Re: shifted grids method for dipoles

Post by Xiaoming Wang » Fri Oct 08, 2021 9:00 pm

Hi,

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.

Best,
Xiaoming
Xiaoming Wang
The University of Toledo

User avatar
Davide Sangalli
Posts: 614
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: shifted grids method for dipoles

Post by Davide Sangalli » Wed Oct 13, 2021 10:25 am

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.
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Xiaoming Wang
Posts: 67
Joined: Fri Dec 18, 2020 7:14 am

Re: shifted grids method for dipoles

Post by Xiaoming Wang » Wed Oct 13, 2021 3:14 pm

Dear Davide,

Thanks for your explanation.

I managed to align the phases of |nk> and |nk+q> with SVD for small q, which I mean after applying SVD and rotating |nk+q>, I get <nk|nk+q> is real positive 0.999.. just smaller than 1. Then I calculated the diagonal dipole by (<nk|nk+q> - 1)/q. However the dipole is sensitive to q which I obtained from ypp -shift grid. I'm thinking maybe the q is too small (0.00005 Bohr to 0.0001 Bohr). However, if I choose a larger q, say 0.01 Bohr, the ypp code seems to reset back to 0.001 Bohr. Any comments on that?

Best,
Xiaoming
Xiaoming Wang
The University of Toledo

User avatar
Davide Sangalli
Posts: 614
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: shifted grids method for dipoles

Post by Davide Sangalli » Wed Oct 13, 2021 3:39 pm

I wouldn't expect the used value to be a big issue since it works nicely for nondiagonal dipoles.
What I'd do (if you didn't so far) is to compile everything in double-precision (I mean yambo and p2y, just use --enable-dp) and use them, to be sure that single precision is not an issue.

Anyway, for the fact that ypp resets the value to 0.001 I'll have a look

Best,
D.
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Locked