shifted grids method for dipoles
Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan
-
- Posts: 67
- Joined: Fri Dec 18, 2020 7:14 am
Re: shifted grids method for dipoles
Hi Davide,
Thanks for your suggestions. I figured out that it is not the q shift magnitude that matters as you mentioned. The problem is that by using SVD, under which the overlap matrix elements are in parallel transport gauge as in David Vanderbilt's book, the diagonal matrix elements are supposed to be near 1 and the off-diagonal ones are supposed to be close to 0! The ypp renormalization issue can be solved by commenting out the if clause.
Indeed, I'm more interested in the diagonal dipole matrix elements difference (A_cc - A_vv in the following fig). So with the shifted grid method implemented in Yambo, if we expand the u_nk+q to second order, we have The alpha and gamma can be obtained from a shifted grid run, while beta is calculated by another -q shift. Note that I comment out the symmetrization procedure of the matrix elements and set the loops over valence and conduction bands to all the bands while calculating the overlap matrix elements. The problem is that while the A_vc is quite robust, the A_cc - A_vv is however very sensitive to the q shift. Are these due to the numerical accuracy of the wave functions? Btw, I'm using the double precision version of yambo and the conv_thr for QE calculations is set to 1.d-13. Any comment is appreciated.
Best,
Xiaoming
Thanks for your suggestions. I figured out that it is not the q shift magnitude that matters as you mentioned. The problem is that by using SVD, under which the overlap matrix elements are in parallel transport gauge as in David Vanderbilt's book, the diagonal matrix elements are supposed to be near 1 and the off-diagonal ones are supposed to be close to 0! The ypp renormalization issue can be solved by commenting out the if clause.
Indeed, I'm more interested in the diagonal dipole matrix elements difference (A_cc - A_vv in the following fig). So with the shifted grid method implemented in Yambo, if we expand the u_nk+q to second order, we have The alpha and gamma can be obtained from a shifted grid run, while beta is calculated by another -q shift. Note that I comment out the symmetrization procedure of the matrix elements and set the loops over valence and conduction bands to all the bands while calculating the overlap matrix elements. The problem is that while the A_vc is quite robust, the A_cc - A_vv is however very sensitive to the q shift. Are these due to the numerical accuracy of the wave functions? Btw, I'm using the double precision version of yambo and the conv_thr for QE calculations is set to 1.d-13. Any comment is appreciated.
Best,
Xiaoming
You do not have the required permissions to view the files attached to this post.
Xiaoming Wang
The University of Toledo
The University of Toledo
-
- Posts: 67
- Joined: Fri Dec 18, 2020 7:14 am
Re: shifted grids method for dipoles
Maybe the shift q is too small. So I tried to increase q to 0.01. But the dipole calculation stopped with the following error.
Any idea?
Code: Select all
[ERROR] STOP signal received while in[04] Dipoles
[ERROR] Reading File shiftx/SAVE//ns.wf_fragments_1_1; Variable WF_COMPONENTS_@_SP_POL1_K1_BAND_GRP_1; NetCDF: Start+count exceeds dimension bound
Xiaoming Wang
The University of Toledo
The University of Toledo
- 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
Dear Xiaoming Wang
For the renormalization I guess you mean these lines in ypp/k-points/k_grids.F
and you directly set q0 = U_q_shifts(i1,:)
I think it was there since
- for q<1.E-6 single precision error starts to give issues in the off-diagonal dipoles
- for q>1.E-4 the distance between k and k+q starts to be too big to get a good approximation for the Taylor expansion
I would expect this range to be optimal also for what you need
Can it be that the number of bands differs between the two databases (shifted and non-shifted)?
Try to do to check if the size are the same.
Best,
D.
All makes sense to me.Thanks for your suggestions. I figured out that it is not the q shift magnitude that matters as you mentioned. The problem is that by using SVD, under which the overlap matrix elements are in parallel transport gauge as in David Vanderbilt's book, the diagonal matrix elements are supposed to be near 1 and the off-diagonal ones are supposed to be close to 0! The ypp renormalization issue can be solved by commenting out the if clause.
For the renormalization I guess you mean these lines in ypp/k-points/k_grids.F
Code: Select all
if (v_norm(U_q_shifts(i1,:))>1.E-4.or.v_norm(U_q_shifts(i1,:))<1.E-6) then
q0 = U_q_shifts(i1,:)*1.E-4/v_norm(U_q_shifts(i1,:))
call msg("s","Renormalizing shift to :",v_norm(q0))
else
q0 = U_q_shifts(i1,:)
endif
I think it was there since
- for q<1.E-6 single precision error starts to give issues in the off-diagonal dipoles
- for q>1.E-4 the distance between k and k+q starts to be too big to get a good approximation for the Taylor expansion
I would expect this range to be optimal also for what you need
I do not have specific comments. Double precision and conv_thr look good to me.Indeed, I'm more interested in the diagonal dipole matrix elements difference (A_cc - A_vv in the following fig). So with the shifted grid method implemented in Yambo, if we expand the u_nk+q to second order, we have
..
The alpha and gamma can be obtained from a shifted grid run, while beta is calculated by another -q shift. Note that I comment out the symmetrization procedure of the matrix elements and set the loops over valence and conduction bands to all the bands while calculating the overlap matrix elements. The problem is that while the A_vc is quite robust, the A_cc - A_vv is however very sensitive to the q shift. Are these due to the numerical accuracy of the wave functions? Btw, I'm using the double precision version of yambo and the conv_thr for QE calculations is set to 1.d-13. Any comment is appreciated.
Before loading the database of the shifted grids, the code checks that it has the same number of components.Maybe the shift q is too small. So I tried to increase q to 0.01. But the dipole calculation stopped with the following error.Any idea?Code: Select all
[ERROR] STOP signal received while in[04] Dipoles [ERROR] Reading File shiftx/SAVE//ns.wf_fragments_1_1; Variable WF_COMPONENTS_@_SP_POL1_K1_BAND_GRP_1; NetCDF: Start+count exceeds dimension bound
Can it be that the number of bands differs between the two databases (shifted and non-shifted)?
Try to do
Code: Select all
ncdump -h SAVE/ns.wf_fragments_1_1
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/
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/
-
- Posts: 67
- Joined: Fri Dec 18, 2020 7:14 am
Re: shifted grids method for dipoles
Dear Davide,
Thanks for your detailed reply. For the last point, the two wave functions did have different components but same bands. However, I have already commented out the checking procedure in the subroutine. Indeed, For smaller q shift of 0.001, the two components are also different, but it works. I don't know why for the q shift of 0.01 it doesn't.
Best,
Xiaoming
Thanks for your detailed reply. For the last point, the two wave functions did have different components but same bands. However, I have already commented out the checking procedure in the subroutine. Indeed, For smaller q shift of 0.001, the two components are also different, but it works. I don't know why for the q shift of 0.01 it doesn't.
Best,
Xiaoming
Xiaoming Wang
The University of Toledo
The University of Toledo
-
- Posts: 67
- Joined: Fri Dec 18, 2020 7:14 am
Re: shifted grids method for dipoles
Btw, does the difference of the components matter? I mean which grid has larger components?
Best,
Xiaoming
Best,
Xiaoming
Xiaoming Wang
The University of Toledo
The University of Toledo
- 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
The number of components is defined by the DFT code to respect |k+G|^2<=E_wf_cutoff.
Now shifting the k-points by delta, it may happen that for some k_i, G_j for which |k_i+G_j|^2>E_wf_cutoff, G_j becomes allowed, i.e. |k_i+delta+G_j|^2<=E_wf_cutoff (or viceversa)
I would say it does not really matter, but you can eventually check that by playing with the cutoff.
D.
Now shifting the k-points by delta, it may happen that for some k_i, G_j for which |k_i+G_j|^2>E_wf_cutoff, G_j becomes allowed, i.e. |k_i+delta+G_j|^2<=E_wf_cutoff (or viceversa)
I would say it does not really matter, but you can eventually check that by playing with the cutoff.
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/
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/
-
- Posts: 67
- Joined: Fri Dec 18, 2020 7:14 am
Re: shifted grids method for dipoles
Thanks Davide. I would expect to have different components for larger shifts anyway. The problem is that sometimes it works, for example,
but sometimes it does not.
So the error seems to point out that the components for shifted grid are larger than the unshifted one? If it is smaller, the problem would disappear?
Best,
Xiaoming
Code: Select all
<---> loading info from shiftx
<---> [WARNING] Shifted grid in folder "shiftx":change in number of WFs components
<---> Grid 1 has shift vector : 0.100000E-2 0.00000 0.00000 [c.c.]
<---> loading info from shifty
<---> [WARNING] Shifted grid in folder "shifty":change in number of WFs components
<---> Grid 2 has shift vector : 0.0000 0.10000E-02 -0.44452E-17 [c.c.]
<---> loading info from shiftz
<---> [WARNING] Shifted grid in folder "shiftz":change in number of WFs components
<---> Grid 3 has shift vector : 0.00000 0.00000 0.100000E-2 [c.c.]
<09s> Dipoles shifted grids |########################################| [100%] 08s(E) 08s(X)
<45s> Dipoles: P (T) |########################################| [100%] 35s(E) 35s(X)
<45s> [DIP] Writing dipoles header
<45s> [05] Optics
<45s> [LA] SERIAL linear algebra
<45s> [DIP] Checking dipoles header
<45s> [X-CG] R(p) Tot o/o(of R): 712 7104 100
<45s> [X] Upper matrix triangle filled
<46s> Xo@q[1] |########################################| [100%] --(E) --(X)
<46s> [06] Timing Overview
<46s> [07] Memory Overview
<46s> [08] Game Over & Game summary
Code: Select all
<---> [04] Dipoles
<---> [DIP] Checking dipoles header
<---> [WARNING] DIPOLES database not correct or missing
<---> loading info from shiftx
<---> [WARNING] Shifted grid in folder "shiftx":change in number of WFs components
<---> Grid 1 has shift vector : 0.10000E-01 0.25237E-16 0.18354E-16 [c.c.]
<---> loading info from shifty
<---> [WARNING] Shifted grid in folder "shifty":change in number of WFs components
<---> Grid 2 has shift vector : 0.0000 0.10000E-01 -0.26767E-16 [c.c.]
<---> loading info from shiftz
<---> [WARNING] Shifted grid in folder "shiftz":change in number of WFs components
<---> Grid 3 has shift vector : 0.000000 0.000000 0.010000 [c.c.]
<---> Dipoles shifted grids | | [000%] --(E) --(X)
[ERROR] STOP signal received while in[04] Dipoles
[ERROR] Reading File shiftx/SAVE//ns.wf_fragments_1_1; Variable WF_COMPONENTS_@_SP_POL1_K1_BAND_GRP_1; NetCDF: Start+count exceeds dimension bound
Best,
Xiaoming
Xiaoming Wang
The University of Toledo
The University of Toledo
- 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
Sorry, I did not reply anymore.
If you accept databases where the wave-functions have a different number of components, then you need handle the two different values.
In the subroutine
1) define wf_ncx_shifted(3), change the set_parms subroutine to accept in input the iq value
and inside it
2) before the call to WF_load(WF,...) you need to set
and later, before the call to WF_load(WF_shifted,...)
After that, it should work.
Best,
D.
If you accept databases where the wave-functions have a different number of components, then you need handle the two different values.
In the subroutine
Code: Select all
src/dipoles/DIPOLE_shifted_grids.F
1) define wf_ncx_shifted(3), change the set_parms subroutine to accept in input the iq value
Code: Select all
call set_parms(iq,grid='shifted',command=' define')
Code: Select all
wf_ncx_shifted(iq) = wf_ncx
Code: Select all
wf_ncx=wf_ncx_save
call to WF_load(WF,...)
Code: Select all
wf_ncx=wf_ncx_shifted(iq)
call to WF_load(WF_shifted,...)
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/
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/