Skip to content

Commit

Permalink
Move imports for defects (#2169)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Andrew-S-Rosen and pre-commit-ci[bot] authored May 22, 2024
1 parent c03110c commit b218e9e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/quacc/atoms/defects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

from __future__ import annotations

from importlib.util import find_spec
from typing import TYPE_CHECKING

from monty.dev import requires
from pymatgen.core.periodic_table import DummySpecies
from pymatgen.entries.computed_entries import ComputedStructureEntry
from pymatgen.io.ase import AseAtomsAdaptor

try:
has_deps = (
find_spec("pymatgen.analysis.defects") is not None
and find_spec("shakenbreak") is not None
)

if has_deps:
from pymatgen.analysis.defects.generators import VacancyGenerator
from shakenbreak.input import Distortions

has_deps = True
except ImportError:
has_deps = False

if TYPE_CHECKING:
from ase.atoms import Atoms
Expand Down

0 comments on commit b218e9e

Please sign in to comment.