Skip to content

Commit

Permalink
Merge 2fa24a3 into ec611b9
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Jul 8, 2021
2 parents ec611b9 + 2fa24a3 commit 91851a7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
17 changes: 13 additions & 4 deletions pymatgen/analysis/interfaces/substrate_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,24 @@ def from_zsl(
else:
elastic_energy = 0

match_dict = match.as_dict()

cls(
return cls(
film_miller=film_miller,
substrate_miller=substrate_miller,
strain=strain,
von_mises_strain=von_mises_strain,
elastic_energy=elastic_energy,
ground_state_energy=ground_state_energy,
**{k: match_dict[k] for k in match_dict.keys() if not k.startswith("@")},
**{
k: getattr(match, k)
for k in [
"film_sl_vectors",
"substrate_sl_vectors",
"film_vectors",
"substrate_vectors",
"film_transformation",
"substrate_transformation",
]
},
)

@property
Expand Down Expand Up @@ -183,6 +191,7 @@ def calculate(
substrate_miller,
] in surface_vector_sets:
for match in self(film_vectors, substrate_vectors, lowest):

sub_match = SubstrateMatch.from_zsl(
match=match,
film=film,
Expand Down
2 changes: 2 additions & 0 deletions pymatgen/analysis/interfaces/tests/test_substrate_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def test_init(self):

matches = list(s.calculate(film, substrate, film_elac))
self.assertEqual(len(matches), 192)
for match in matches:
assert match is not None


if __name__ == "__main__":
Expand Down
3 changes: 3 additions & 0 deletions pymatgen/analysis/interfaces/tests/test_zsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def test_bidirectional(self):
z.bidirectional = True
matches = list(z(self.substrate.lattice.matrix[:2], self.film.lattice.matrix[:2]))
self.assertEqual(len(matches), 48)

for match in matches:
assert match is not None


if __name__ == "__main__":
Expand Down
16 changes: 8 additions & 8 deletions pymatgen/analysis/interfaces/zsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This module implements the Zur and McGill lattice matching algorithm
"""

from typing import Iterator
from typing import Iterator, List

from dataclasses import dataclass
from itertools import product
Expand All @@ -24,17 +24,17 @@ class ZSLMatch(MSONable):
the appropriate transformation matrix
"""

film_sl_vectors: np.ndarray
substrate_sl_vectors: np.ndarray
film_vectors: np.ndarray
substrate_vectors: np.ndarray
film_transformation: np.ndarray
substrate_transformation: np.ndarray
film_sl_vectors: List
substrate_sl_vectors: List
film_vectors: List
substrate_vectors: List
film_transformation: List
substrate_transformation: List

@property
def match_area(self):
"""The area of the match between the substrate and film super lattice vectors"""
return vec_area(*self.film_sl_vectors.tolist())
return vec_area(*self.film_sl_vectors)

@property
def match_transformation(self):
Expand Down

0 comments on commit 91851a7

Please sign in to comment.