Ejemplo n.º 1
0
    def generate_surface_vectors(self, film_millers, substrate_millers):
        """
        Generates the film/substrate slab combinations for a set of given
        miller indices

        Args:
            film_millers(array): all miller indices to generate slabs for
                film
            substrate_millers(array): all miller indices to generate slabs
                for substrate
        """
        vector_sets = []

        for f in film_millers:
            film_slab = SlabGenerator(self.film, f, 20, 15,
                                      primitive=False).get_slab()
            film_vectors = reduce_vectors(film_slab.lattice.matrix[0],
                                          film_slab.lattice.matrix[1])

            for s in substrate_millers:
                substrate_slab = SlabGenerator(self.substrate,
                                               s,
                                               20,
                                               15,
                                               primitive=False).get_slab()
                substrate_vectors = reduce_vectors(
                    substrate_slab.lattice.matrix[0],
                    substrate_slab.lattice.matrix[1])

                vector_sets.append((film_vectors, substrate_vectors, f, s))

        return vector_sets
Ejemplo n.º 2
0
    def test_zsl(self):

        z = ZSLGenerator()

        self.assertAlmostEqual(fast_norm([3, 2, 1]), 3.7416573867739413)
        self.assertArrayEqual(reduce_vectors([1, 0, 0], [2, 2, 0]), [[1, 0, 0], [0, 2, 0]])
        self.assertEqual(vec_area([1, 0, 0], [0, 2, 0]), 2)
        self.assertArrayEqual(list(get_factors(18)), [1, 2, 3, 6, 9, 18])
        self.assertTrue(z.is_same_vectors([[1.01, 0, 0], [0, 2, 0]], [[1, 0, 0], [0, 2.01, 0]]))
        self.assertFalse(z.is_same_vectors([[1.01, 2, 0], [0, 2, 0]], [[1, 0, 0], [0, 2.01, 0]]))

        matches = list(z(self.film.lattice.matrix[:2], self.substrate.lattice.matrix[:2]))
        self.assertEqual(len(matches), 8)