Open RemiLacroix-IDRIS opened 3 years ago
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 kpath
is initialized to None and there may be crystalline structures for which pymatgen cannot detect the "correct" value.
The patch below fixes your problem by calling self.undetected
if self._kpath
is still None at the end of __init__
:
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?
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