def test_layered_compound(self):
        structure = VASP5IO.parse_file(file_name=os.path.join(self.abs_path, "16234-O2Si1.vasp"))
        # Run tessellation.
        result = VoronoiTessellationCalculator.compute(structure,
                                                       radical=False)

        # Test results.
        total_vol = 0.0
        for cell in result:
            total_vol += cell.get_volume()
            self.assertTrue(cell.geometry_is_valid())
        vol_error = (total_vol - structure.volume()) / structure.volume()
        self.assertAlmostEqual(0.0, vol_error, delta=1e-2)
    def test_B(self):
        structure = VASP5IO.parse_file(file_name=os.path.join(self.abs_path, "673-B1.vasp"))
        # Run tessellation.
        result = VoronoiTessellationCalculator.compute(structure,
                                                       radical=False)

        # Test results.
        total_vol = 0.0
        for cell in result:
            total_vol += cell.get_volume()
            self.assertTrue(cell.geometry_is_valid())
        self.assertAlmostEqual(structure.volume(), total_vol,
                                    delta=total_vol * 0.01)
    def test_ICSD_examples(self):
        example = ["3315-Ge2Os2Th1", "1001-N1Y1", "11375-C2N1",
            "12012-Ge2Ru2Tb1", "3778-Sr1Zn2", "4746-Cd1Cu4Er1"]
        for e in example:
            structure = VASP5IO.parse_file(file_name=os.path.join(self.abs_path,  e +".vasp"))
            # Run tessellation.
            result = VoronoiTessellationCalculator.compute(structure,
                                                           radical=False)

            # Test results.
            total_vol = 0.0
            for cell in result:
                total_vol += cell.get_volume()
                self.assertTrue(cell.geometry_is_valid())
            vol_error = (total_vol - structure.volume()) / structure.volume()
            self.assertAlmostEqual(0.0, vol_error, delta=1e-2)