Skip to content

Commit

Permalink
fix ImportError: cannot import pymatgen.symmetry.analyzer.SymmetryUnd…
Browse files Browse the repository at this point in the history
…eterminedError
  • Loading branch information
janosh committed Oct 18, 2024
1 parent 74b315b commit 298c49a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pymatviz/structure_viz/mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from matplotlib.path import Path
from pymatgen.analysis.local_env import CrystalNN, NearNeighbors
from pymatgen.core import Structure
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SymmetryUndeterminedError
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

from pymatviz.colors import ELEM_COLORS_JMOL, ELEM_COLORS_VESTA
from pymatviz.enums import ElemColorScheme, Key
Expand Down Expand Up @@ -199,7 +199,7 @@ class used to plot chemical bonds. Allowed are edgecolor, facecolor, color,
try:
spg_analyzer = SpacegroupAnalyzer(struct)
struct = spg_analyzer.get_conventional_standard_structure()
except SymmetryUndeterminedError:
except ValueError:
warnings.warn(NO_SYM_MSG, UserWarning, stacklevel=2)

# Get default colors
Expand Down
6 changes: 3 additions & 3 deletions pymatviz/structure_viz/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from pymatgen.analysis.local_env import CrystalNN, NearNeighbors
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SymmetryUndeterminedError
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

from pymatviz.enums import ElemColorScheme, SiteCoords
from pymatviz.structure_viz.helpers import (
Expand Down Expand Up @@ -163,7 +163,7 @@ def structure_2d_plotly(
try:
spg_analyzer = SpacegroupAnalyzer(struct_i)
struct_i = spg_analyzer.get_conventional_standard_structure() # noqa: PLW2901
except SymmetryUndeterminedError:
except ValueError:
warnings.warn(NO_SYM_MSG, UserWarning, stacklevel=2)

# Apply rotation
Expand Down Expand Up @@ -429,7 +429,7 @@ def structure_3d_plotly(
try:
spg_analyzer = SpacegroupAnalyzer(struct_i)
struct_i = spg_analyzer.get_conventional_standard_structure() # noqa: PLW2901
except SymmetryUndeterminedError:
except ValueError:
warnings.warn(NO_SYM_MSG, UserWarning, stacklevel=2)

visible_image_atoms: set[tuple[float, float, float]] = set()
Expand Down

0 comments on commit 298c49a

Please sign in to comment.