From 12f0b3959cbb32020f81173dea1db2cc079cd1eb Mon Sep 17 00:00:00 2001 From: Jason Xie <393106066@qq.com> Date: Thu, 8 Aug 2024 19:28:17 +0800 Subject: [PATCH] Update test_coherent_interface.py --- .../interfaces/test_coherent_interface.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/analysis/interfaces/test_coherent_interface.py b/tests/analysis/interfaces/test_coherent_interface.py index 081cc3c4b62..b95e330815a 100644 --- a/tests/analysis/interfaces/test_coherent_interface.py +++ b/tests/analysis/interfaces/test_coherent_interface.py @@ -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')