Пример #1
0
class VoronoiAnalysisTest(PymatgenTest):

    def setUp(self):
        self.ss = Xdatcar(os.path.join(test_dir, 'XDATCAR.MD')).structures
        self.s = self.ss[19]
        self.va = VoronoiAnalysis(cutoff=4.0)
    def test_voronoi_analysis(self):
        # Check for the Voronoi index of site i in Structure
        single_structure = self.va.voronoi_analysis(self.s, n=5)
        self.assertIn(single_structure.view(), np.array([5,4,2,5,3,1,0,2]).view(),
                      "Cannot find the right polyhedron.")
        # Check for the presence of a Voronoi index and its frequency in
        # a ensemble (list) of Structures
        ensemble = self.va.from_structures(self.ss,step_freq=2,most_frequent_polyhedra=10)
        self.assertIn(('[2 3 3 3 1 1 0 0]', 6),
                      ensemble, "Cannot find the right polyhedron in ensemble.")
Пример #2
0
 def setUp(self):
     self.ss = Xdatcar(os.path.join(test_dir, 'XDATCAR.MD')).structures
     self.s = self.ss[19]
     self.va = VoronoiAnalysis(cutoff=4.0)