pyprocar icon indicating copy to clipboard operation
pyprocar copied to clipboard

IndexError: list index out of range

Open avaspzuiniubi opened this issue 5 months ago • 10 comments

from pathlib import Path import pyprocar

Plot non-collinear bands in plain mode

pyprocar.bandsplot( code='vasp', mode='parametric', dirname='.', fermi=-4.5416, spins=[3], elimit=[-7, 7], title='Non-Collinear Bands (Plain Mode)', use_cache=True, quiet_welcome=True, savefig='bandsocz.png' )

Image

avaspzuiniubi avatar Jul 10 '25 09:07 avaspzuiniubi

Hey @avaspzuiniubi,

what version of vasp are you using? I am using vasp6.4.3 and it is running okay. I think it was a version issue in regards to the vasprun.xml.

Logan Lang

lllangWV avatar Jul 10 '25 11:07 lllangWV

Thank you. The version I'm currently using is 6.3.1. I'll try to see if the new version is compatible.

avaspzuiniubi avatar Jul 10 '25 12:07 avaspzuiniubi

Could you send me the PROCAR, vasprun.xml, OUTCAR, KPOINTS, and POSCAR?

I can check to see what is going on with those files to see if I can find a fix.

Logan Lang

lllangWV avatar Jul 10 '25 13:07 lllangWV

Hey @avaspzuiniubi,

what version of vasp are you using? I am using vasp6.4.3 and it is running okay. I think it was a version issue in regards to the vasprun.xml.

Logan Lang

I'm using 6.4.2 does it have the same problem?

GoldFreind avatar Jul 10 '25 13:07 GoldFreind

So I found the issue. When parsing the kpoints element from the vasprun.xml we parse the subelement attributes. In the case of band structures it is including an extra section that isn't appearing in the test files I have.

<kpoints_labels>
   <i name="GAMMA" type="int">       1 </i>
   <i name="K" type="int">       2 </i>
   <i name="K" type="int">       3 </i>
   <i name="M" type="int">       4 </i>
   <i name="M" type="int">       5 </i>
   <i name="K'" type="int">       6 </i>
   <i name="K'" type="int">       7 </i>
   <i name="GAMMA" type="int">       8 </i>
  </kpoints_labels>

My guess would be the inclusion of an ! on the labels would dictate weather to parse this in vasp.

Try putting an ! in front of the kpoint label and launch the calculation again

K-Path Generated by VASPKIT.
   20
Line-Mode
Reciprocal
   0.0000000000   0.0000000000   0.0000000000     ! GAMMA          
   0.3333333334   0.3333333334   0.0000000000     ! K

   0.3333333334   0.3333333334   0.0000000000     ! K
   0.5000000000   0.0000000000   0.0000000000     ! M

   0.5000000000   0.0000000000   0.0000000000     ! M
   0.6666666667  -0.3333333334   0.0000000000     ! K'
              
   0.6666666667  -0.3333333334   0.0000000000     ! K'            
   0.0000000000   0.0000000000   0.0000000000     ! GAMMA          

This would be a temporary fix. I will try to make a permeant solution that will account for this

Logan Lang

lllangWV avatar Jul 10 '25 13:07 lllangWV

Thank you very much. With your guidance, I can draw the relevant diagrams.

avaspzuiniubi avatar Jul 10 '25 13:07 avaspzuiniubi

Hey, I just pushed a more permeant solution to this. Now it should work regardless of the !.

You can access the changes by using

pip install --pre pyprocar

Logan Lang

lllangWV avatar Jul 10 '25 14:07 lllangWV

ok,Thank you very much.

avaspzuiniubi avatar Jul 10 '25 14:07 avaspzuiniubi

I came across the same error here, but either adding ! or using pip install --pre pyprocar doesn't work. I'm not sure why. The pip install --pre pyprocar just prints lots of Requirement already satisfied:, and at the end there's nothing like xxx installed appears. I'm using vasp 6.5.1 and pyprocar 6.5.0. I'm attaching my output files below.

One solution I just tried is comment out the extra section (see below), because it's just an extra block. But I think using the version that fix this issue is better.

<!--
<kpoints_labels>
......
</kpoints_labels>
-->

soc band input.zip

good-mood-everyday avatar Oct 10 '25 02:10 good-mood-everyday