-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"NoneType object is not subscriptable" error when trying to plot a band structure #230
Comments
Hi, A similar problem has been reported here although the patch I was suggesting is not enough to handle your case. The problem is that diff --git a/pymatgen/symmetry/kpath.py b/pymatgen/symmetry/kpath.py
index b58810571..48f1f24bb 100644
--- a/pymatgen/symmetry/kpath.py
+++ b/pymatgen/symmetry/kpath.py
@@ -266,21 +266,29 @@ class KPathSetyawanCurtarolo(KPathBase):
warn("Unexpected value for spg_symbol: %s" % spg_symbol)
elif lattice_type == "triclinic":
+ angles = self._rec_lattice.parameters[3:6]
kalpha = self._rec_lattice.parameters[3]
kbeta = self._rec_lattice.parameters[4]
kgamma = self._rec_lattice.parameters[5]
if kalpha > 90 and kbeta > 90 and kgamma > 90:
self._kpath = self.tria()
- if kalpha < 90 and kbeta < 90 and kgamma < 90:
+ elif kalpha < 90 and kbeta < 90 and kgamma < 90:
self._kpath = self.trib()
- if kalpha > 90 and kbeta > 90 and kgamma == 90:
+ elif kalpha > 90 and kbeta > 90 and kgamma == 90:
self._kpath = self.tria()
- if kalpha < 90 and kbeta < 90 and kgamma == 90:
+ elif kalpha < 90 and kbeta < 90 and kgamma == 90:
self._kpath = self.trib()
+ elif np.allclose(angles, 90):
+ self._kpath = self.orc()
+ else:
+ warn(f"Unexpected angles: {angles} for spg_symbol: {spg_symbol}")
else:
warn("Unknown lattice type %s" % lattice_type)
+ if self._kpath is None:
+ self._kpath = self.undetected()
+
@property
def conventional(self):
"""
@@ -305,6 +313,20 @@ class KPathSetyawanCurtarolo(KPathBase):
"""
return self._rec_lattice
+ def undetected(self):
+ """
+ UNDETECTED Path
+ """
+ self.name = "UNDETECTED"
+ kpoints = {
+ "\\Gamma": np.array([0.0, 0.0, 0.0]),
+ "b1/2": np.array([0.5, 0.0, 0.0]),
+ "b2/2": np.array([0.0, 0.5, 0.0]),
+ "b3/2": np.array([0.0, 0.0, 0.5]),
+ }
+ path = [["\\Gamma", "b1/2", "b2/2", "b3/2"]]
+ return {"kpoints": kpoints, "path": path}
+
def cubic(self):
"""
CUB Path |
Hi, Thanks for the feedback, will you report that to pymatgen so that the patch is integrated upstream? |
Yes, I'm working on it. |
@gmatteo : Any news about this? |
Hello,
One of our users is trying to plot a band structure using Abipy:
This works for most inputs but he is getting an error with the big_GSR.nc file attached:
The warning at the beginning might be relevant but it also appears for other input files for which the plots are successfully generated.
Best regards,
Rémi Lacroix
The text was updated successfully, but these errors were encountered: