Error in kpath call for mp-773163

I have an issue when I run kpath.get_kpoints() on the structure of material mp-773163. I know that this problem only occurs for this material (as it works fine for all other materials in the materials project), so it must be a problem with this material. Below is code that reproduces this bug:

from pymatgen.ext.matproj import MPRester
from pymatgen.symmetry.kpath import KPathSetyawanCurtarolo

MP_ID = <YOUR_ID>

with MPRester(MP_ID) as m:
structure = m.get_structure_by_material_id(“mp-773163”)
kpath = KPathSetyawanCurtarolo(structure)
kpath.get_kpoints()

The error is:

Traceback (most recent call last):
File “kpath_none_error.py”, line 16, in
kpath.get_kpoints()
File “/home/ubuntu/.local/lib/python3.8/site-packages/pymatgen/symmetry/kpath.py”, line 108, in get_kpoints
for b in self.kpath[“path”]:
TypeError: ‘NoneType’ object is not subscriptable

Hi @paulneves77,

Thank you for brining this to our attention. It appears as though there is a bug in the Setyawan-Curtarolo (SC) method when using it with this particular structure. I will have to sit down and look at things in more detail to fix it.

In the mean time, I would suggest using one of the other conventions. If you would like a path that is very similar to what the SC convention gives, I would recommend using the one generated from the KPathSeek class.

– Jason

1 Like