Пример #1
0
    def post_process(self, mat):
        """
        Any extra post-processing on a material doc
        """

        # Add structure metadata back into document and convert back to conventional standard
        if "structure" in mat:
            structure = Structure.from_dict(mat["structure"])
            sga = SpacegroupAnalyzer(structure, symprec=SYMPREC)
            mat["structure"] = structure.as_dict()
            mat.update(structure_metadata(structure))

        # Deprecate materials with bad structures or energies
        if "structure" in mat["invalid_props"]:
            mat.update({"deprecated": True})
        elif "thermo.energy_per_atom" in mat["invalid_props"]:
            mat.update({"deprecated": True})
        else:
            mat.update({"deprecated": False})

        # Reorder voigt output from VASP to standard voigt notation
        if has(mat, "piezo.ionic"):
            mat["piezo"]["ionic"] = PiezoTensor.from_vasp_voigt(
                mat["piezo"]["ionic"]).voigt.tolist()
        if has(mat, "piezo.static"):
            mat["piezo"]["static"] = PiezoTensor.from_vasp_voigt(
                mat["piezo"]["static"]).voigt.tolist()
Пример #2
0
 def test_from_vasp_voigt(self):
     bad_voigt = np.zeros((3, 7))
     pt = PiezoTensor.from_vasp_voigt(self.vasp_matrix)
     self.assertArrayEqual(pt, self.full_tensor_array)
     self.assertRaises(ValueError, PiezoTensor.from_voigt, bad_voigt)
     self.assertArrayEqual(self.voigt_matrix, pt.voigt)