Skip to content

Commit

Permalink
Update test_coherent_interface.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jinlhr542 committed Aug 8, 2024
1 parent b2b1c78 commit 12f0b39
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/analysis/interfaces/test_coherent_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,31 @@ def test_coherent_interface_builder(self):
# SP: this test is super fragile and the result fluctuates between 6, 30 and 42 for
# no apparent reason. The author should fix this.
assert len(list(builder.get_interfaces(termination=("O2_Pmmm_1", "Si_R-3m_1")))) >= 6

class TestCoherentInterfaceBuilder(unittest.TestCase):

def setUp(self):
#build substrate & film structure
basis = [[0, 0, 0], [0.25, 0.25, 0.25]]
self.substrate = Structure(
Lattice.cubic(a=5.431),
["Si", "Si"],
basis)
self.film = substrate = Structure(
Lattice.cubic(a=5.658),
["Ge", "Ge"],
basis)

def test_termination_searching(self):
sub_analyzer = SubstrateAnalyzer()
matches = list(sub_analyzer.calculate(substrate = self.substrate, film = self.film))
cib = CoherentInterfaceBuilder(film_structure = self.film,
substrate_structure=self.substrate,
film_miller=matches[0].film_miller,
substrate_miller=matches[0].substrate_miller,
zslgen=sub_analyzer,termination_ftol=1e-4,label_index=True,\
filting_out_sym_slabs=False)
self.assertTrue(cib.terminations == [('1_Ge_P4/mmm_1', '1_Si_P4/mmm_1'),\
('1_Ge_P4/mmm_1', '2_Si_P4/mmm_1'),\
('2_Ge_P4/mmm_1', '1_Si_P4/mmm_1'),\
('2_Ge_P4/mmm_1', '2_Si_P4/mmm_1')],\ 'termination results wrong')

0 comments on commit 12f0b39

Please sign in to comment.