3
$\begingroup$

I am getting the following error when trying to plot band-structure using PyProcar. I posted a comment in author's github page as well (see at the bottom). In the meantime, I wonder if anyone could please help? Thanks.

P.S. Please note that, I was able to plot this same band-structure calculation using sumo-plot. I PyProcar has some additional functionalities (such as spin-projection) that sumo-plot doesn't have.

Traceback (most recent call last):
  File "pyprocar_band_spin.py", line 25, in <module>
    pyprocar.bandsdosplot(bands_file='PROCAR',
  File "/dartfs-hpc/rc/home/m/f00656m/.local/lib/python3.8/site-packages/pyprocar/scriptBandsDosplot.py", line 181, in bandsdosplot
    tick_labels = np.array(re.findall("!\s(.*)", KPmatrix[0]))
**IndexError: list index out of range**
$\endgroup$

1 Answer 1

4
$\begingroup$

From their code, it looks like KPmatrix = re.findall("reciprocal[\s\S]*", KPread), so it tries to grab everything from the word "reciprocal" to the end of KPread (the read in KPOINTS file.

As far as I can tell, the surrounding code doesn't do any processing of KPread prior to this point, so I think the fix may be as simple as writing "reciprocal" rather than "Reciprocal" in that line of your KPOINTS file.

If that works, you can mention it as a fix in the GitHub issue, though I should note the script you are using is listed in the repo underpyprocar/v1/scripts and there seems to be an updated script for later versions of PyProcar.

$\endgroup$
2
  • $\begingroup$ Thanks you so much! It really worked! Well, almost!! Now that I passed that hurdle I get the following error. Do you suggest I install PyProcar2 instead? [Initially I just did the simple pip install pyprocar following the website, so not sure if it's latest version] drive.google.com/file/d/1AZsDGP9UCT0oCkoidyFNa88YMh9i831x/… $\endgroup$
    – MARUF007
    Feb 4, 2023 at 23:39
  • 2
    $\begingroup$ I don't know much about PyProcar, but I would say this sort of bug would in general tend to be fixed in later versions of a program. As to the new error you are getting, it seems to be that the code is finding 11 types of y values (based on it finding a shape of (11, 314)) while it finds only 10 different kinds of k-points (the values in knames). I'm not sure if that is another bug or something misformatted with your KPOINTS file that is causing it miss a knames value. $\endgroup$
    – Tyberius
    Feb 5, 2023 at 1:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .