Yambo switching spin up and spin down for BSE

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

kli103
Posts: 15
Joined: Wed May 20, 2020 7:25 am
Location: University of California, Santa Cruz

Re: Yambo switching spin up and spin down for BSE

Post by kli103 » Fri Jun 04, 2021 8:18 am

Dear Daniele and Davide,

Sorry for the very late reply. A few months ago I tested yambo-4.5.0 with the patch, and the same issue about spin up and down switching still existed. This issue causes some uncertainty in GW/BSE calculation for spin polarization state. Now the newest version is yambo-5.0. Has the issue been solved in the newest version?

An example here is NBVN defect in hBN, which has doublet ground state. As you can see from the attached files, yambo-4.1.4 can correctly read the QP corr for spin up and spin down. However, yambo-4.5.2 switches the QP corr and provides different BSE to yambo-4.1.4. The calculations are far from convergence. Here I just want to show the existing issue in yambo-4.5.

If you have any suggestion on to which part of the code this issue may be related, I will really appreciate that.

Best regards,
Kejun
You do not have the required permissions to view the files attached to this post.
Kejun Li
PhD student,
Department of Physics,
University of California, Santa Cruz
E-mail: kli103@ucsc.edu

User avatar
Daniele Varsano
Posts: 3810
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Yambo switching spin up and spin down for BSE

Post by Daniele Varsano » Fri Jun 04, 2021 8:43 am

Dear Kejun Li,

please update your source to the latest release:
git clone git@github.com:yambo-code/yambo.git yambo

if you still have the problem, please report it here.

Many thanks,

Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

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: Yambo switching spin up and spin down for BSE

Post by Davide Sangalli » Fri Jun 04, 2021 11:38 am

Dear Kejun Li,
I did some tests on a magnetic system and everything seems to be consistent in my case using the last version.
Can you please try it (as Daniele suggests) and tell us if you still experience the issue.

Kind regards,
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/

kli103
Posts: 15
Joined: Wed May 20, 2020 7:25 am
Location: University of California, Santa Cruz

Re: Yambo switching spin up and spin down for BSE

Post by kli103 » Fri Jun 04, 2021 4:27 pm

Dear Daniele and Davide,

Yes. Thanks for your quick reply. I can do some tests.

Best regards,
Kejun
Kejun Li
PhD student,
Department of Physics,
University of California, Santa Cruz
E-mail: kli103@ucsc.edu

kli103
Posts: 15
Joined: Wed May 20, 2020 7:25 am
Location: University of California, Santa Cruz

Re: Yambo switching spin up and spin down for BSE

Post by kli103 » Wed Jun 09, 2021 12:33 am

Dear Daniele and Davide,

I tested yambo-5.0.2 and compared the results with yambo-4.1.4 and yambo-4.5.2. The issue still exists. Could you give me some hint on what part of the code I can modify to avoid this issue?

Best regards,
Kejun
You do not have the required permissions to view the files attached to this post.
Kejun Li
PhD student,
Department of Physics,
University of California, Santa Cruz
E-mail: kli103@ucsc.edu

User avatar
Daniele Varsano
Posts: 3810
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Yambo switching spin up and spin down for BSE

Post by Daniele Varsano » Wed Jun 09, 2021 10:17 am

Dear Kejun,

Comparing the QP energies in the report file (k=1 up) in the output and report the energy difference look ok e.g. the direct gap:

from the report:
-2.139635 2.944531. --> gap 5.084166
from the output
-.769712. 4.314454. --> gap 5.084166

note that the position of the Fermi level has changed once the correction is applied.

Up to here it seems it is working correctly, anyway there is something in the report already at the KS level I do not like:

Code: Select all

[X] Fermi Level                                   : -1.350122 [eV]

  [X] === Spin up channel ===
  [X] Conduction Band Min                  [spin UP]:  1.537894 [eV]
  [X] Valence Band Max                     [spin UP]: -0.478414 [eV]
  [X] Filled Bands                         [spin UP]:  143
  [X] Empty Bands                          [spin UP]:  144  300
  [X] Direct Gap                           [spin UP]:  2.016308 [eV]
  [X] Direct Gap localized at k-point      [spin UP]:   4
  [X] Indirect Gap                         [spin UP]:  1.929986 [eV]
  [X] Indirect Gap between k-points        [spin UP]:   4   4
  [X] Last valence band width              [spin UP]:  0.020492 [eV]
  [X] 1st conduction band width            [spin UP]:  0.010767 [eV]

  [X] === Spin dn channel ===
  [X] Conduction Band Min                  [spin DN]:  0.480085 [eV]
  [X] Valence Band Max                     [spin DN]: -1.449901 [eV]
  [X] Filled Bands                         [spin DN]:  142
  [X] Empty Bands                          [spin DN]:  143  300
  [X] Direct Gap                           [spin DN]:  1.931708 [eV]
  [X] Direct Gap localized at k-point      [spin DN]:  1
  [X] Indirect Gap                         [spin DN]:  0.000000 [eV]
  [X] Indirect Gap between k-points        [spin DN]:   1   5
  [X] Last valence band width              [spin DN]:  0.000000 [eV]
  [X] 1st conduction band width            [spin DN]:  0.000000 [eV]

In particular I do not understand the two different direct/indirect gaps in the spin-up channel coming from the same k point, and the 0 indirect gap found in the spin down channel. Here there is something not working properly.

In oder to inspect it,
Can you send us your scf QE input file together with the pseudos you used?

Many thanks,

Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

kli103
Posts: 15
Joined: Wed May 20, 2020 7:25 am
Location: University of California, Santa Cruz

Re: Yambo switching spin up and spin down for BSE

Post by kli103 » Wed Jun 09, 2021 7:44 pm

Dear Daniele,

The QE input files are attached. I use NC SR ONCV pseudopotentials from dojo website http://www.pseudo-dojo.org/.

I checked the direct gaps in the spin up and spin down channels before and after correction. They are correct.
Before QP corr, the direct gaps are
spin up: 2.016308 eV; spin down: 1.929980 eV

After QP corr,
spin up: 5.064274 eV; spin down: 5.752487 eV

QP corr,
spin up: 3.030710 eV; spin down: 3.822501 eV.

The switching between spin up and spin down for the QP corr now looks like a printing error. The zero indirect gap in the spin down channel is indeed weird. Also the indirect gap should be equal or smaller than the direct gap, but it is not like this in the spin up channel. The indirect gap value in the spin up channel is simply the direct gap value in the spin down channel. This is not correct.

Code: Select all

  [06.01] FIT on E < ./all_Bz/ndb.QP
  ==================================

  = FIT report for E<./all_Bz/ndb.QP[ PPA@E  27.21138 = XG 1021 = Xb 1-300 = Scb 1-300] =
  = First column (conduction), Second column (valence) =

  = Spin DN ============================================

   Gap correction (database)     :  3.030710 [eV]
               (FIT, actual)     :  0.145120 [eV]
   Energies 0th order            :  2.753116 -0.422713 [eV]
   Energies 1st order            :  1.192902  1.139709
                            Error:  0.062040  0.022560


  = Spin UP ============================================

   Gap correction (database)     :  3.822501 [eV]
               (FIT, actual)     : -0.014584 [eV]
   Energies 0th order            :  3.015820 -0.792097 [eV]
   Energies 1st order            :  0.969636  0.820106
                            Error:  0.035775  0.012791


  [QP_apply] Action to be applied: E<./all_Bz/ndb.QP[ PPA@E  27.21138 = XG 1021 = Xb 1-300 = Scb 1-300]

[07.01]  QP corrections report
  ==============================

  [K+QP] === Spin Independent ===
  [K+QP] Electronic Temperature                     :  0.258779E-1   300.300    [eV K]
  [K+QP] Bosonic    Temperature                     :  0.258606E-1   300.100    [eV K]
  [K+QP] Finite Temperature mode                    : yes
  [K+QP] El. density                                :  0.91597E+23 [cm-3]
  [K+QP] Fermi Level                                :  1.369923 [eV]

  [K+QP] === Spin up channel ===
  [K+QP] Conduction Band Min               [spin UP]:  2.933672 [eV]
  [K+QP] Valence Band Max                  [spin UP]: -2.130602 [eV]
  [K+QP] Filled Bands                      [spin UP]:  143
  [K+QP] Empty Bands                       [spin UP]:  144  300
  [K+QP] Direct Gap                        [spin UP]:  5.064275 [eV]
  [K+QP] Direct Gap localized at k-point   [spin UP]:   4
  [K+QP] Indirect Gap                      [spin UP]:  5.752487 [eV]
  [K+QP] Indirect Gap between k-points     [spin UP]:   4   4
  [K+QP] Last valence band width           [spin UP]:  0.028016 [eV]
  [K+QP] 1st conduction band width         [spin UP]:  0.011124 [eV]

  [K+QP] === Spin dn channel ===
  [K+QP] Conduction Band Min               [spin DN]:  2.139526 [eV]
  [K+QP] Valence Band Max                  [spin DN]: -3.612961 [eV]
  [K+QP] Filled Bands                      [spin DN]:  142
  [K+QP] Empty Bands                       [spin DN]:  143  300
  [K+QP] Direct Gap                        [spin DN]:  5.752487 [eV]
  [K+QP] Direct Gap localized at k-point   [spin DN]:  1
  [K+QP] Indirect Gap                      [spin DN]:  0.000000 [eV]
  [K+QP] Indirect Gap between k-points     [spin DN]:  1  1
  [K+QP] Last valence band width           [spin DN]:  0.000000 [eV]
  [K+QP] 1st conduction band width         [spin DN]:  0.000000 [eV]

  [K+QP] === Overall gap ===
  [K+QP] Direct Gap                                 :  4.279161 [eV]
  [K+QP] Direct Gap localized at k-point            :  1
  [K+QP] Indirect Gap                               :  5.064275 [eV]
  [K+QP] Indirect Gap between k-points              :   4   1
Best regards,
Kejun
You do not have the required permissions to view the files attached to this post.
Kejun Li
PhD student,
Department of Physics,
University of California, Santa Cruz
E-mail: kli103@ucsc.edu

kli103
Posts: 15
Joined: Wed May 20, 2020 7:25 am
Location: University of California, Santa Cruz

Re: Yambo switching spin up and spin down for BSE

Post by kli103 » Sat Jun 26, 2021 3:17 am

Dear Daniele,

I look into the source code of yambo-4.5.2. I found some inconsistency in the spin up and spin down definition in GW and BSE reports.

First I check the DFT eigenvalues and GW eigenvalues, I found Spin_pol == 1 is for spin up and Spin_pol == -1 is for spin down.

Second, I check the file for GW output.

Code: Select all

/src/qp/qp_of.F
line 69    titles(14) = 'Spin_Pol'
line 212         if (qp_isp==1) values(14)= 1._SP
line 213         if (qp_isp==2) values(14)=-1._SP
so here spin index qp_isp == 1 is associated with 1 which is spin up, and 2 is associated with -1 which is spin down. This is consistent with the file for GW report

Code: Select all

/src/qp/QP_report_and_write.F
line 210       if (i_spin==1) spin_string='[up]'
line 211       if (i_spin==2) spin_string='[dn]'
However, the spin index is reversed in the file for BSE report.

Code: Select all

/src/qp_control/QP_fit_report.F
line 86       if (n_sp_pol==2) then
line 87         if (i_spin==1) ch="= Spin DN ============================================"
line 88         if (i_spin==2) ch="= Spin UP ============================================"
line 143       if (n_sp_pol>1) then 
line 144         if (i_spin==1) fname(2)=trim(fname(1))//"-spin-dn.fit"
line 145         if (i_spin==2) fname(2)=trim(fname(1))//"-spin-up.fit"
line 146         if (i_spin==1) fname(1)=trim(fname(1))//"-spin-dn.data"
line 147         if (i_spin==2) fname(1)=trim(fname(1))//"-spin-up.data"
I also check /src/qp_control/QP_fit_report.F in yambo-5.0.2 code. Line 144~147 have been corrected, but line 87 and 88 still have error.

Now the BSE report is affected by the error in the code file. Could you modify that part of the code to make BSE report correct? Also do you know whether BSE calculation could be affected by the errors in the BSE report code?

Best regards,
Kejun
Kejun Li
PhD student,
Department of Physics,
University of California, Santa Cruz
E-mail: kli103@ucsc.edu

User avatar
Daniele Varsano
Posts: 3810
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Yambo switching spin up and spin down for BSE

Post by Daniele Varsano » Tue Jun 29, 2021 8:09 am

Dear Kejun,
it seems just a printing error, we are going to correct it asap.
Thanks for reporting.

Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

Locked