Skip to content

Commit

Permalink
raise ValueError in SpacegroupAnalyzer.get_symmetrized_structure() if…
Browse files Browse the repository at this point in the history
… spglib returns no symmetries
  • Loading branch information
janosh committed Nov 7, 2022
1 parent 9f821bc commit 817e69f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pymatgen/symmetry/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ def _get_symmetry(self):
vectors in scaled positions.
"""
d = spglib.get_symmetry(self._cell, symprec=self._symprec, angle_tolerance=self._angle_tol)
if d is None:
raise ValueError(
f"Symmetry detection for structure with formula {self._structure.formula} failed. "
f"Try setting symprec={self._symprec} to a different value."
)
# Sometimes spglib returns small translation vectors, e.g.
# [1e-4, 2e-4, 1e-4]
# (these are in fractional coordinates, so should be small denominator
Expand Down

0 comments on commit 817e69f

Please sign in to comment.