Skip to content

Commit

Permalink
fix is close
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Oct 26, 2024
1 parent 74ec0c9 commit 34f4461
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/pymatgen/analysis/interfaces/coherent_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import math
from itertools import product
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -101,12 +100,12 @@ def _find_matches(self) -> None:
for match in self.zsl_matches:
xform = get_2d_transform(film_vectors, match.film_vectors)
strain, _rot = polar(xform)
if not np.isclose(strain, np.round(strain), atol=1e-12):
if not np.all(np.isclose(strain, np.round(strain), atol=1e-12)):
raise ValueError("Film lattice vectors changed during ZSL match, check your ZSL Generator parameters")

xform = get_2d_transform(substrate_vectors, match.substrate_vectors)
strain, _rot = polar(xform)
if not np.isclose(strain, strain.astype(int), atol=1e-12):
if not np.all(np.isclose(strain, strain.astype(int), atol=1e-12)):
raise ValueError(
"Substrate lattice vectors changed during ZSL match, check your ZSL Generator parameters"
)
Expand Down Expand Up @@ -220,11 +219,11 @@ def get_interfaces(
).astype(int)
film_sl_slab = film_slab.copy()
film_sl_slab.make_supercell(super_film_transform)
if not math.isclose(film_sl_slab.lattice.matrix[2], film_slab.lattice.matrix[2], abs_tol=1e-08):
if not np.all(np.isclose(film_sl_slab.lattice.matrix[2], film_slab.lattice.matrix[2], atol=1e-08)):
raise ValueError(
"2D transformation affected C-axis for Film transformation",
)
if not np.isclose(film_sl_slab.lattice.matrix[:2], match.film_sl_vectors, atol=1e-08):
if not np.all(np.isclose(film_sl_slab.lattice.matrix[:2], match.film_sl_vectors, atol=1e-08)):
raise ValueError("Transformation didn't make proper supercell for film")

# Build substrate superlattice
Expand All @@ -233,9 +232,9 @@ def get_interfaces(
).astype(int)
sub_sl_slab = sub_slab.copy()
sub_sl_slab.make_supercell(super_sub_transform)
if not math.isclose(sub_sl_slab.lattice.matrix[2], sub_slab.lattice.matrix[2], abs_tol=1e-08):
if not np.all(np.isclose(sub_sl_slab.lattice.matrix[2], sub_slab.lattice.matrix[2], atol=1e-08)):
raise ValueError("2D transformation affected C-axis for Film transformation")
if not np.isclose(sub_sl_slab.lattice.matrix[:2], match.substrate_sl_vectors, atol=1e-08):
if not np.all(np.isclose(sub_sl_slab.lattice.matrix[:2], match.substrate_sl_vectors, atol=1e-08)):
raise ValueError("Transformation didn't make proper supercell for substrate")

# Add extra info
Expand Down

0 comments on commit 34f4461

Please sign in to comment.