romerogroup / pyprocar

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

IndexError #161

Closed ebalci-nuclear closed 1 month ago

ebalci-nuclear commented 2 months ago

How can I fix following error:

File "/truba/home/uakdemir/.local/lib/python3.8/site-packages/pyprocar/plotter/ebs_plot.py", line 615, in set_xticks self.ax.axvline(self.x[ipos], color=color) IndexError: index 157 is out of bounds for axis 0 with size 156

lllangWV commented 2 months ago

Hey, I have a couple questions.

What DFT code are you using? What does your input kpath look like?

Logan Lang

ebalci-nuclear commented 2 months ago

Hii Logan,

Quantum espresso

Pb2Pd Pb2Pd &control calculation='bands' restart_mode='from_scratch', tstress = .true. tprnfor = .true. prefix='Pb2Pd', verbosity='high', pseudo_dir ='./', outdir='./work/band', wf_collect = .TRUE. / &system ibrav=0, nat= 6, ntyp=2, ecutwfc = 45.000, ecutrho = 320.00, degauss=0.01, occupations='smearing', smearing='gaussian', lspinorb=.true., noncolin=.true., nbnd=120, / &ELECTRONS electron_maxstep = 700 , conv_thr = 1.2d-9, diagonalization = 'david' , mixing_mode = 'plain', mixing_beta = 0.7, / CELL_PARAMETERS angstrom -3.4315 3.4315 2.912 3.4315 -3.4315 2.912 3.4315 3.4315 -2.912 ATOMIC_SPECIES Pd 106.42000 Pd.upf Pb 207.20000 Pb.upf ATOMIC_POSITIONS {crystal} Pb 0.66430 0.16430 0.82860 Pb 0.33570 0.83570 0.17140 Pb 0.16430 0.33570 0.50000 Pb 0.83570 0.66430 0.50000 Pd 0.25000 0.25000 0.00000 Pd 0.75000 0.75000 0.00000 K_POINTS crystal_b 8 0.4313252018 0.4313252018 -0.4313252018 30 !Z 0.0000000000 0.0000000000 0.0000000000 30 !G -0.5000000000 0.5000000000 0.5000000000 21 !M 0.0000000000 0.0000000000 0.5000000000 21 !X 0.0000000000 0.0000000000 0.0000000000 23 !G 0.0000000000 0.5000000000 0.0000000000 15 !N 0.2500000000 0.2500000000 0.2500000000 17 !P 0.0000000000 0.0000000000 0.5000000000 15 !X

lllangWV commented 2 months ago

Hey, thanks for the info. I found the issue. It came from the parsing of the high symmetry points.

In qe.py line 450-462 we have.

              if ihs < self.nhigh_sym - 2:
                  self.ngrids.append(grid_current)
              elif ihs == self.nhigh_sym - 1:
                  self.ngrids.append(grid_current+1)
              elif ihs == self.nhigh_sym:
                  continue
              self.kticks.append(tick_Count - 1)
              tick_Count += grid_current

This should really be

              if ihs < self.nhigh_sym - 2:
                  self.ngrids.append(grid_current)

              # Incrementing grid by 1 for seocnd to last high symmetry point
              elif ihs == self.nhigh_sym - 2:
                  self.ngrids.append(grid_current+1)

              # Skipping the last high symmetry point
              elif ihs == self.nhigh_sym -1:
                  continue
              self.kticks.append(tick_Count - 1)
              tick_Count += grid_current

We create a variable called ngrids. To create this in qe for crystal_b mode, you have to increment the second to last kpoints and ignore the last high symmetry point.

If the last 2 high symmetry point are the same value, then the code will run as expected, so for example your kpath should be:

K_POINTS crystal_b
8
0.4313252018 0.4313252018 -0.4313252018 30 !Z
0.0000000000 0.0000000000 0.0000000000 30 !G
-0.5000000000 0.5000000000 0.5000000000 21 !M
0.0000000000 0.0000000000 0.5000000000 21 !X
0.0000000000 0.0000000000 0.0000000000 23 !G
0.0000000000 0.5000000000 0.0000000000 15 !N
0.2500000000 0.2500000000 0.2500000000 17 !P
0.0000000000 0.0000000000 0.5000000000 17 !X # Changed from 15 to 17 to match pervious high symmetry point

I have fixed this issue on the github version. You can install it by doing the following:

git clone git@github.com:romerogroup/pyprocar.git
cd pyprocar
pip install -e .

Best,

Logan Lang

ebalci-nuclear commented 2 months ago

The fix worked. Thank you Logan.

--Erdem Balcı

ebalci-nuclear commented 2 months ago

I get the following error for the spin non-polarized case, how can I fix it?

File "/pyprocar/pyprocar/io/qe.py", line 61, in init self._parse_wfc_mapping(proj_out_filename=proj_out_filename)

File "/pyprocar/pyprocar/io/qe.py", line 621, in _parse_wfc_mapping raw_wfc = re.findall('(?<=read\sfrom\spseudopotential\sfiles).\n\n([\S\s]?)\n\n(?=\sk\s=)', proj_out)[0] IndexError: list index out of range

ahromero commented 2 months ago

Could you please provide a cleare description?.. which version you used, what you are trying to do, which QE you used, etc… with your email, I do not have any clue what you want to accomplish and if the error is from our side or it is a calculation error…. Did you check if the QE files were created correctly? By looking into the error, it seems something related to the pseudos, are the pseudos available in a directory that PyProcar knows?

__::::__ Prof. Aldo Humberto Romero Director Research Computing, West Virginia University Eberly Family Distinguished Professor Fellow American Physical Society Editor Physica B, Assistant Editor EPJB, Editor Frontiers in Physics Section Editor Papers in Physics Member of the Editorial Board of “Materials” and “Symmetry Physics” https://scholar.google.com/citations?user=pwte-hQAAAAJ&hl=en

Physics and Astronomy Department West Virginia University 135 Willey Street, PO Box 6315 111 White Hall Morgantown, WV 26506 Phone: 304-293-6317 Fax: 304-293-5732 email: @.***

From: ebalci-nuclear @.> Date: Thursday, August 29, 2024 at 4:13 AM To: romerogroup/pyprocar @.> Cc: Subscribed @.***> Subject: Re: [romerogroup/pyprocar] IndexError (Issue #161)

I get the following error for the spin non-polarized case, how can I fix it?

File "/pyprocar/pyprocar/io/qe.py", line 61, in init self._parse_wfc_mapping(proj_out_filename=proj_out_filename)

File "/pyprocar/pyprocar/io/qe.py", line 621, in _parse_wfc_mapping raw_wfc = re.findall('(?<=read\sfrom\spseudopotential\sfiles).\n\n([\S\s]?)\n\n(?=\sk\s=)', proj_out)[0] IndexError: list index out of range

— Reply to this email directly, view it on GitHubhttps://github.com/romerogroup/pyprocar/issues/161#issuecomment-2316983276, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB24DTO6VKFBA3YHA6SJOQDZT3J2RAVCNFSM6AAAAABNCOK5R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJWHE4DGMRXGY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

lllangWV commented 1 month ago

Hey ebalci-nuclear.

File "/pyprocar/pyprocar/io/qe.py", line 61, in init self._parse_wfc_mapping(proj_out_filename=proj_out_filename)

File "/pyprocar/pyprocar/io/qe.py", line 621, in _parse_wfc_mapping raw_wfc = re.findall('(?<=read\sfrom\spseudopotential\sfiles).\n\n([\S\s]?)\n\n(?=\sk\s=)', proj_out)[0] IndexError: list index out of range

so this issue is coming from the detecting of the wavefunctions from the kpdos.out.

What version of quantum espresso are you using? And can you paste or provide the begining of the kpdos.out file

It should look somehting this:


     Program PROJWFC v.7.2 starts on 28Nov2023 at 15: 2:29 

     This program is part of the open-source Quantum ESPRESSO suite
     for quantum simulation of materials; please cite
         "P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
         "P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
         "P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
          URL http://www.quantum-espresso.org", 
     in publications or presentations arising from this work. More details at
     http://www.quantum-espresso.org/quote

     Parallel version (MPI), running on    20 processors

     MPI processes distributed on     1 nodes
     R & G space division:  proc/nbgrp/npool/nimage =      20
     66134 MiB available memory on the printing compute node when the environment starts

     Reading xml data from directory:

     ./out/Fe.save/
     file Fe.pbe-spn-kjpaw_psl.1.0.0.UPF: wavefunction(s)  3P 3D renormalized

     IMPORTANT: XC functional enforced from input :
     Exchange-correlation= PBE
                           (   1   4   3   4   0   0   0)
     Any further DFT definition will be discarded
     Please, verify this is what you really want

     Parallelization info
     --------------------
     sticks:   dense  smooth     PW     G-vecs:    dense   smooth      PW
     Min          56      48     14                 1213      956     154
     Max          58      49     15                 1216      958     158
     Sum        1137     969    283                24295    19141    3103

     Using Slab Decomposition

     Gaussian broadening (read from input): ngauss,degauss=   0    0.036748

     Calling projwave .... 
     Subspace diagonalization in iterative solution of the eigenvalue problem:
     a serial algorithm will be used

  Problem Sizes 
  natomwfc =           10
  nbnd     =           48
  nkstot   =          484
  npwx     =          120
  nkb      =           18

     Atomic states used for projection
     (read from pseudopotential files):

     state #   1: atom   1 (Fe ), wfc  1 (l=0 m= 1)
     state #   2: atom   1 (Fe ), wfc  2 (l=0 m= 1)
     state #   3: atom   1 (Fe ), wfc  3 (l=1 m= 1)
     state #   4: atom   1 (Fe ), wfc  3 (l=1 m= 2)
     state #   5: atom   1 (Fe ), wfc  3 (l=1 m= 3)
     state #   6: atom   1 (Fe ), wfc  4 (l=2 m= 1)
     state #   7: atom   1 (Fe ), wfc  4 (l=2 m= 2)
     state #   8: atom   1 (Fe ), wfc  4 (l=2 m= 3)
     state #   9: atom   1 (Fe ), wfc  4 (l=2 m= 4)
     state #  10: atom   1 (Fe ), wfc  4 (l=2 m= 5)

 k =   0.0000000000  0.0000000000  0.0000000000

Best,

Logan Lang

ebalci-nuclear commented 1 month ago

Hii Prof. Aldo Humberto Romero and Logan, First of all, I apologize for forgetting to reply. My problem was in the kpdos.in file. He had worked with PW at first. But later I made changes in the file and ran it again. I couldn't see the error because I didn't look inside the kpdos.out file. After correcting my mistake Pyrocar worked. After all, it was my mistake. There's no problem. I congratulate you for this valuable program.