TypeError: ‘NoneType’ object is not subscriptable

Sorry for bothering you again. I encountered the similar problem that I tried to express a rhombohedral structure by hexagonal structure since I aimed to see the band structures of Gamma-K and Gamma-M. However, Abinit gave me the same error: ‘NoneType’ object is not subscriptable. I tried to modify my kpath.py file by following your solution to my previous problem, but it didn’t work:

elif lattice_type == “rhombohedral”:
alpha = self._prim.lattice.parameters[3]
if alpha < 90 and alpha != 60: # if alpha <90:
self._kpath = self.rhl1(alpha * pi / 180)
elif alpha >= 90: # else:
self._kpath = self.rhl2(alpha * pi / 180)

Handle hexagonal lattice detected as rhombohedral

elif np.allclose(self._prim_lattice.parameters[3:5], 60):
self._kpath = self.hex()

Do you have other suggestions about this issue? I am grateful for your help.

Here is my file for the rhombohedral structure of Sb. Some variables were set to lower values to quickly check whether the issue was resolved.

ndtset 2

#Dataset 1 : GS calculation
kptopt1 4 # initially 1
ngkpt1 2 2 1 #6 6 1
nshiftk1 1
shiftk1 0.0 0.0 0.5 # This choice preserves the hexagonal symmetry of the grid,
occopt1 4 # Marzari smearing
tsmear1 0.05
prtden1 1
tolvrs1 1.0d-10
pawspnorb 1 #SOC
nspinor 2 #SOC

#Dataset 2: Band structure calculation from Dataset 1.

iscf2 -2
getden2 1
kptopt2 -2
tolwfr2 1.0d-8
ndivsm2 4
kptbounds2 # Extrema of the k-path.
0.5 0.0 0.0 #M
0.0 0.0 0.0 #Gamma
1/3 1/3 0.0 #K

#Definition of the planewave basis set
ecut 5.0 #20.0
#pawecutdg 35.0
##Definition of the SCF procedure
nband 30
nstep 50
#Sb lattice structure
ntypat 1
znucl 51
natom 4
typat 10*1

cell 4.3 4.3 27.48 Angstrom
rprim
0.866025403784439 0.5 0.0
-0.866025403784439 0.5 0.0
0.0 0.0 1.0

#Atomic positions
#xred
#0.0 0.0 0.0
#2/3 1/3 1.5/3.74
#1/3 2/3 1.0
#0.0 0.0 1.0+1.5/3.74
xcart #0.529177 (angstrom–>Bohr)
#0.0 0.0 0.0
#1.2412 2.15 1.5
#2.15 1.2412 3.74
#0.0 0.0 5.24 #angstrom

0.0 0.0 0.0
2.34553 4.06291 2.83459
4.06291 2.34553 7.06757
1.88972 1.88972 9.90216 #Bohr
chksymtnons 0
#Pseudo potentials
pp_dirpath “$ABI_PSPDIR”
pseudos “PseudosHGH_pwteter/51sb.5.hgh”
#Pseudodojo_paw_pbe_standard/Sb.xml"

Do you have other suggestions about this issue?

Use xred or specify the Cartesian coordinates with more significant digits.
This is important both for Abinit and spglib. If abinit does not detect the correct spacegroup, you are going to have more k-points in the calculation.
If spglib does not return the correct lattice type in the pymatgen routines, the k-path is either wrong or uninitialized.

To test whether pymatgen and spglib are finding the correct lattice and k-path,
one can use the following snippet:

from abipy import abilab

structure = abilab.Structure.from_abistring("""
#Sb lattice structure
ntypat 1
znucl 51
natom 4
typat 10*1

acell 4.3 4.3 27.48 Angstrom
rprim
0.866025403784439 0.5 0.0
-0.866025403784439 0.5 0.0
0.0 0.0 1.0

#Atomic positions
xred
0.0 0.0 0.0
2/3 1/3 1.5/3.74
1/3 2/3 1.0
0.0 0.0 1.0+1.5/3.74
""")

#print(structure)
print(structure.spget_summary())
from pprint import pprint
pprint(structure.hsym_kpath.kpath["kpoints"])

Hi gmatteo,

I will try your suggestions. Thank you so much!

Best regards,
whpeng2