romerogroup / pyprocar

A Python library for electronic structure pre/post-processing
GNU General Public License v3.0
165 stars 72 forks source link

2D Fermi surface plotting error #140

Open BlessedAkarat opened 3 months ago

BlessedAkarat commented 3 months ago

Hi.

I'm a graduate student studying about quantum physics in the master's degree.

And also I am a new beginner with using this pyprocar program. But now, I faced some problems with plotting Fermi surface (2D and 3D). While I try to plot my Ru slab system's (6 super cells with 'c' direction, and 15 angstrom vacuum on it) Fermi surface, this error message occur.

Traceback (most recent call last):
  File "/home/_...file direction..._/Ru/pyprocar/Example/Ru_ex/Fermi2D.py", line 21, in <module>
    pyprocar.fermi2D(code = 'qe',
  File "/home/_...my local direction.._./.local/lib/python3.11/site-packages/pyprocar/scripts/scriptFermi2D.py", line 139, in fermi2D
    ebs.ibz2fbz(structure.rotations)
  File "/home/_...my local direction..._/.local/lib/python3.11/site-packages/pyprocar/core/ebs.py", line 1004, in ibz2fbz
    raise ValueError(err_text)
ValueError: 
                        nkpoints != n_kx*n_ky*n_kz
                        Error trying to symmetrize the irreducible kmesh. 
                        This is issue is most likely related to 
                        how the DFT code using symmetry operations to reduce the kmesh.
                        Check the recommendations for k-mesh type for the crystal system.
                        If all else fails turn off symmetry.

And this is my input file 1. bands.in

&CONTROL
    calculation = 'bands',
    prefix =     'Ru',
    restart_mode='from_scratch',
    pseudo_dir='.',
    outdir = './output',
!    wf_collect = .TRUE.
!    verbosity = 'high
 /

&SYSTEM
    ibrav = 0
!    A =    2.45956
    nat = 2
    ntyp = 1
    nbnd = 40
    ecutrho = 353.0,
    ecutwfc = 52.0,
!    noncolin = .true.,
!    lspinorb = .true.,
    nspin = 2
    starting_magnetization(1)= 1
    occupations='smearing',
    smearing='marzari-vanderbilt',
    degauss=0.002,
/

&electrons
 conv_thr = 1.0d-10
 mixing_beta = 0.7
 electron_maxstep = 100
! scf_must_converge = .TRUE.
 /

ATOMIC_SPECIES
Ru 101.07 Ru.pbe-spn-kjpaw_psl.1.0.0.UPF

!HCP High Symmetrypoint
K_POINTS {crystal_b}
6
0.0000000 0.0000000 0.0000000 20 !G
0.0000000 0.0000000 0.5000000 20 !A
0.6666667 0.3333333 0.0000000 20 !K
0.6666667 0.3333333 0.5000000 20 !H
0.5000000 0.0000000 0.0000000 20 !M
0.5000000 0.0000000 0.5000000 20 !L

CELL_PARAMETERS {angstrom}
 2.7145148400 0.0000000000 0.0000000000
-1.3572574200 2.3508388110 0.0000000000
 0.0000000000 0.0000000000 19.2952804130

ATOMIC_POSITIONS (angstrom)
Ru 1.35725743 0.78361293 1.0738201
Ru 0.00000000 1.56722588 3.22146031

2. kpdos.in

&PROJWFC
prefix = 'Ru'
outdir = './output'
filpdos = 'Ru.k'        !prefix for output files containing PODS(E) default: value of prefix variable
filproj = 'Ruproj.k'    !file containing the projections        default: standard output

DeltaE = 0.01                   !energy grid step (eV)                  default: REAL
!Emax = 40                      !max energy for DOS plot                default: band extrema
!Emin = -20                     !min energy for DOS plot                default: band extrema
degauss = 0.007349864           !gaussian broadening (Ry)               default: 0
ngauss = 0                      !Type of aussian broadening             default: 0 (= means Simple Gaussian)

kresolveddos = .true.           !.true. in kpdos calculation            default: .false.
/

3. scf.in

&CONTROL
    calculation = 'scf',
    prefix =     'Ru',
    restart_mode='from_scratch',
    pseudo_dir='.',
    outdir = './output',
!    wf_collect = .TRUE.
 /

&SYSTEM
    ibrav = 0
!    A =    2.45956
    nat = 2
    ntyp = 1
    nbnd = 40
    ecutrho = 353.0,
    ecutwfc = 52.0,
    occupations='smearing',
!    noncolin = .true.,
!    lspinorb = .true.,
    nspin = 2
    starting_magnetization(1)= 1.0,
    smearing='marzari-vanderbilt',
    degauss=0.02,
/

&electrons
 conv_thr = 1.0d-10
 mixing_beta = 0.7
 electron_maxstep = 100
! scf_must_converge = .TRUE.
 /

ATOMIC_SPECIES
Ru 101.07 Ru.pbe-spn-kjpaw_psl.1.0.0.UPF

K_POINTS {automatic}
15 15 1 0 0 0

CELL_PARAMETERS {angstrom}
 2.7145148400 0.0000000000 0.0000000000
-1.3572574200 2.3508388110 0.0000000000
 0.0000000000 0.0000000000 19.2952804130

ATOMIC_POSITIONS (angstrom)
Ru 1.35725743 0.78361293 1.0738201
Ru 0.00000000 1.56722588 3.22146031

4. nscf.in

&CONTROL
calculation = 'nscf'
outdir = './output'
prefix = 'Ru'
pseudo_dir = './'
restart_mode = 'from_scratch'
verbosity = 'high'
!wf_collect = .TRUE.
/

&SYSTEM
ibrav = 0
nat = 2
ntyp = 1
nbnd = 40
ecutwfc = 52.0
ecutrho = 353.0
nspin = 2
occupations='smearing'
smearing='marzari-vanderbilt'
starting_magnetization(1) = 1
degauss = 0.02
/

&ELECTRONS
diagonalization = 'cg'
conv_thr = 1.0d-10
mixing_beta = 0.7
!electron_maxstep = 100
!scf_must_converge = .TRUE.
/

ATOMIC_SPECIES
Ru 101.07 Ru.pbe-spn-kjpaw_psl.1.0.0.UPF

K_POINTS {automatic}
250 250 1 0 0 0

CELL_PARAMETERS (angstrom)
 2.7145148400 0.0000000000 0.0000000000
-1.3572574200 2.3508388110 0.0000000000
 0.0000000000 0.0000000000 19.2952804130

ATOMIC_POSITIONS (angstrom)
Ru 1.35725743 0.78361293 1.0738201
Ru 0.00000000 1.56722588 3.22146031

I have no idea how to change my kmesh to match the symmetry or turn off. Is there anyone know about this, please let me know what kind of documents is helpful and how can I plot the right Fermi...

Sincery.

lllangWV commented 3 months ago

Hey,

so this issue is due to the symmetrization of the kmesh.

In Qunatum Espresso (QE), it is recommended you use ibrav>0 because it will enforce symmetry. When ibrav=0, it will try to detect the symmetry and then apply the detected symmetry, however, sometimes this does not detect the correct symmetry.

Even if you get the symmetry right, some issues might arise due to the grid type (Gamma centered and Monkhorst Pack) used with a given bravais lattice. VASP has suggestions about which mesh to use for which lattice type. Look at the section Symmetry reduction of the mesh(https://www.vasp.at/wiki/index.php/KPOINTS). This could help.

I might also try shifting your kmesh In your case, I believe you are using a Monkhorst-Pack K_POINTS {automatic} 250 250 1 0 0 0 -> K_POINTS {automatic} 250 250 1 1 1 1

If the above suggestions fail, you should just turn off symmetrization in QE. This can be done by adding the following keyword arguments to the &SYSTEM card.

&SYSTEM nosym=.TRUE. noinv=.TRUE.

Tell me if these suggestions do not work.

Logan

BlessedAkarat commented 3 months ago

Glade to your help Logan. I'll gonna try your advices and check out errors.

Again, thanks for your guidance.

GH

BlessedAkarat commented 3 months ago

Hi. I'm coming back with a bad news that I failed all my attempts.

At first, I don't have any idea of changing the lattice vectors into the Bohr radius to set the input option 'celldim(i)=' so I haven't try your first advice change `ibrave > 0'.

Second, I also check the VASP wiki, and figure out that hexagonal cell should use the gamma centered. But in the Quantum ESPRESSO, only Monkhorst option can set the number of k-points in my guess (I've just read the input description https://www.quantum-espresso.org/Doc/INPUT_PW.html#idm1528). Is the gamma option just invest only a gamma point 1 1 1 ?

Third, the k-ponts shift doesn't fix the error.

nkpoints != n_kx*n_ky*n_kz
                        Error trying to symmetrize the irreducible kmesh.
                        This is issue is most likely related to 
                        how the DFT code using symmetry operations to reduce the kmesh.
                        Check the recommendations for k-mesh type for the crystal system.
                        If all else fails turn off symmetry.

The error above never gone.

Last, turn off the symmetry option is the only workable solution. But, as I try the same system before, I didn't turn off symmetry and shift k-points, the 2D Fermi surface plotted really well. And I have the inputs and outputs of them, but those inputs are not work any more I think. I think I have fixed some parts of the inputs and this change lead an error... But, the pure outputs are still here, so when I try to plot with these outputs, 2D Fermi surface is pictured. However, this Fermi surface is not the same with the thing that turn off symmetry. I'll put those figures below, please check again and give me some advice.

2D_Fermi_1Slab

2D_Fermi_1Slab02

Again, thanks for your help and I apologize about bad English.

GH.

lllangWV commented 3 months ago

Hello,

I also ran the same calculation as you did with different conditions for the kmesh and symmetry. ibrav=0 seem to work okay.

I was able to reproduce the first image, but not the second image. I have no idea what is going on with that image. Was there a difference in fermi energy between those plots?

I found for this system shifting the kmesh caused the error you mentioned above, so I was incorrect telling you to add a shift. K_POINTS {automatic} 250 250 1 0 0 0->250 250 1 1 1 1

Here are my results. One thing to notice, odd meshes seem to work better with finding the iso-contours.

no_sym_21_21_3

no_sym

unshifted_odd_mesh_21_21_3

unshifted_odd_mesh

unshifted_even_mesh_22_22_4

unshifted_even_mesh

Logan

BlessedAkarat commented 2 months ago

Fermi level about both symmetry options

Well, I check out my Fermi levels both the first picture and second picture. As I told before, the first picture is calculated with symmetry option and the other is calculated without symmetry. And those calculation result of the Fermi level is same as I posted above.

I really appreciate your help but, I have no idea why my system doesn't work at all.... Based on my understanding, you had tested my input files with minor adjustments to the k-point shifting, and it worked really well. However, in my system, I keep encounting an error stating that nkpoints != n_kx*n_ky*n_kz. Even we us same input of my 'Ruthenium slab system'...

Well I also tried to use examples on the site (by downloading) and example of 2D Fermi Plot was perfectly work. image

So I'll try to figure out some differences between mine and example, and check my system again. Well again thanks for your helping. It really helpful for my any attempts.

Best regards. GH.

lllangWV commented 2 months ago

Can you share all your input files in a zip file? (scf.in,nscf.in,kpdos.in)

Logan Lang

BlessedAkarat commented 2 months ago

Input_Fermisurface.zip My inputs are here.

And I also show my bash execution order file and Fermi surface plot file from below. I use 'qsub' to active my scheduler (as I know it is PBS) and bash.sh and dos.sh files are for it. bash and plot file.zip

and I'll attach whole my outputs which work plotting.

And there is some problem with this whole out put can draw the Fermi surface, but if I try to plot the Fermi surface after recalculate with this inputs, I keep face the error. It seems I had change this input but I have no idea which option has changed. Fermi_work 01.zip Fermi_work 02.zip Fermi_work 03.zip

Best regards. GH.

BlessedAkarat commented 3 weeks ago

Hello.

I know you are very busy on other things :) But I'm still stuck in the same error... Can you give me some guidance after check my files please?

I can't solve this alone...

Best regards. GH.

lllangWV commented 3 weeks ago

Hey,

I apologize for the delayed reply—I didn’t receive a notification when you sent the files. Thank you for your patience.

Upon reviewing the files you provided, I identified the root of the issue as stemming from the symmetrization process. To address this, I've updated the Quantum ESPRESSO parser. Please try running your calculations with the updated parser and let me know if the issue persists.

Additionally, I noticed that you conducted the non-self-consistent field (nscf) and band structure calculations in the same directory. I recommend running these calculations in separate directories because the atomic_projection files can be overwritten by whichever calculation is executed last, which might lead to inconsistencies in your results.

Here are a couple more tips to consider:

I hope these suggestions help. Please keep me posted on your progress, and don't hesitate to reach out if you have further questions.

Best regards, Logan Lang