Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move imports for defects #2169

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading