Пример #1
0
    def test_get_symmetrically_equivalent_miller_indices(self):

        # Tests to see if the function obtains all equivalent hkl for cubic (100)
        indices001 = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 0, -1), (0, -1, 0), (-1, 0, 0)]
        indices = get_symmetrically_equivalent_miller_indices(self.cscl, (1,0,0))
        self.assertTrue(all([hkl in indices for hkl in indices001]))

        # Tests to see if it captures expanded Miller indices in the family e.g. (001) == (002)
        hcp_indices_100 = get_symmetrically_equivalent_miller_indices(self.Mg, (1,0,0))
        hcp_indices_200 = get_symmetrically_equivalent_miller_indices(self.Mg, (2,0,0))
        self.assertEqual(len(hcp_indices_100)*2, len(hcp_indices_200))
        self.assertEqual(len(hcp_indices_100), 6)
Пример #2
0
    def get_surface_data(self, material_id, miller_index=None):
        """
        Gets surface data for a material. Useful for Wulff shapes.

        Reference for surface data:

        Tran, R., Xu, Z., Radhakrishnan, B., Winston, D., Sun, W., Persson, K.
        A., & Ong, S. P. (2016). Data Descripter: Surface energies of elemental
        crystals. Scientific Data, 3(160080), 1–13.
        http://dx.doi.org/10.1038/sdata.2016.80

        Args:
            material_id (str): Materials Project material_id, e.g. 'mp-123'.
            miller_index (list of integer): The miller index of the surface.
            e.g., [3, 2, 1]. If miller_index is provided, only one dictionary
            of this specific plane will be returned.

        Returns:
            Surface data for material. Energies are given in SI units (J/m^2).
        """
        doc = self.surface_properties.get_document_by_id(material_id)
        structure = self.get_structure_by_material_id(material_id)

        if miller_index:
            eq_indices = get_symmetrically_equivalent_miller_indices(
                structure, miller_index
            )

            for surface in doc.surfaces:
                if tuple(surface.miller_index) in eq_indices:
                    return surface.dict()
        else:
            return doc.dict()