Skip to content

Commit

Permalink
Phonopy cleanup (#2107)
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] committed May 9, 2024
1 parent 1a93ce8 commit f516eab
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/quacc/atoms/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from importlib.util import find_spec
from typing import TYPE_CHECKING

import numpy as np
Expand All @@ -10,18 +11,15 @@
from pymatgen.io.phonopy import get_phonopy_structure, get_pmg_structure
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

try:
import phonopy
has_phonopy = find_spec("phonopy")

has_phonopy = True
except ImportError:
has_phonopy = False
if has_phonopy:
from phonopy import Phonopy

if TYPE_CHECKING:
from ase.atoms import Atoms

if phonopy:
from phonopy import Phonopy
if has_phonopy:
from phonopy.structure.atoms import PhonopyAtoms


Expand Down Expand Up @@ -71,7 +69,7 @@ def get_phonopy(
np.round(np.ceil(min_lengths / np.array(symmetrized_structure.lattice.abc)))
)

phonon = phonopy.Phonopy(
phonon = Phonopy(
get_phonopy_structure(symmetrized_structure),
symprec=symprec,
supercell_matrix=supercell_matrix,
Expand Down

0 comments on commit f516eab

Please sign in to comment.