Skip to content

Commit d7aa1e3

Browse files
authored
Update surface.py
1 parent d7490b3 commit d7aa1e3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/structuretoolkit/build/surface.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
2-
32
from collections.abc import Callable, Sequence
43

54
import numpy as np
65
from ase.atoms import Atoms
76
from ase.build import bulk, surface
7+
from sympy import Matrix
8+
from sympy.matrices.normalforms import hermite_normal_form
89

910
from structuretoolkit.analyse import get_symmetry
10-
from structuretoolkit.analyse.symmetry import Symmetry
1111
from structuretoolkit.common.pymatgen import ase_to_pymatgen, pymatgen_to_ase
1212

1313

@@ -282,12 +282,8 @@ def _hnf_and_U(P):
282282
Return (H, U) where H is the Hermite normal form of the integer matrix P
283283
and U is unimodular such that P = U·H.
284284
"""
285-
from sympy import Matrix
286-
287285
P_sym = Matrix(P.tolist())
288286
# The functional interface works for all recent SymPy releases.
289-
from sympy.matrices.normalforms import hermite_normal_form
290-
291287
H_sym = hermite_normal_form(P_sym)
292288
H = np.array(H_sym, dtype=int)
293289
U = np.asarray(H_sym.inv() @ P_sym, dtype=int)
@@ -304,8 +300,8 @@ def _is_cubic(cell: np.ndarray | ase.cell.Cell) -> bool:
304300
305301
Returns True if the cell's symmetry group has 48 operations and no translational components.
306302
"""
307-
sym = Symmetry(
308-
Atoms(
303+
sym = get_symmetry(
304+
structure=Atoms(
309305
symbols="H",
310306
cell=cell,
311307
positions=[

0 commit comments

Comments
 (0)