Skip to content

Commit

Permalink
move imports into robocrys func
Browse files Browse the repository at this point in the history
robocrys is an extra import in emmet-core
  • Loading branch information
tsmathis committed Sep 12, 2024
1 parent 70414bb commit ae413bb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions emmet-core/emmet/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
DeformStructureTransformation,
)
from pymatgen.util.graph_hashing import weisfeiler_lehman_graph_hash
from robocrys import StructureCondenser, StructureDescriber
from robocrys.condense.mineral import MineralMatcher

from emmet.core.mpid import MPculeID
from emmet.core.settings import EmmetSettings
Expand Down Expand Up @@ -109,8 +107,15 @@ def undeform_structure(structure: Structure, transformations: Dict) -> Structure


def generate_robocrys_condensed_struct_and_description(
structure: Structure, mineral_matcher: MineralMatcher | None = None
structure: Structure, mineral_matcher=None
) -> tuple[dict[Any], str]:
try:
from robocrys import StructureCondenser, StructureDescriber
except ImportError:
raise ImportError(
"robocrys needs to be installed to generate Robocrystallographer descriptions"
)

condenser = StructureCondenser(mineral_matcher=mineral_matcher)
describer = StructureDescriber(
describe_symmetry_labels=False, fmt="unicode", return_parts=False
Expand Down

0 comments on commit ae413bb

Please sign in to comment.