Esempio n. 1
0
    def test_py_equals_fort(self, value):
        graph_p = graph_from_file(filename="tests/STRUCTURE_FILES/" + value,
                                  rcut=4.0,
                                  elements={"Li"})
        graph_p.torture_py()

        graph_f = graph_from_file(filename="tests/STRUCTURE_FILES/" + value,
                                  rcut=4.0,
                                  elements={"Li"})
        graph_f.torture()

        self.assertEqual(
            [c.tortuosity for c in list(graph_p.clusters)],
            [c.tortuosity for c in list(graph_f.clusters)],
        )
Esempio n. 2
0
    def test_return_frac_perc(self, value):

        filename = "tests/STRUCTURE_FILES/PERC/POSCAR_" + str(value) + ".vasp"
        graph = graph_from_file(filename=filename, rcut=4.0, elements={"Mg"})
        graph.output_clusters(fmt="poscar")
        subprocess.run("mv *CLUS* tests/STRUCTURE_FILES/", shell=True)
        self.assertEqual(value, round(graph.return_frac_percolating(), 3))
Esempio n. 3
0
    def test_return_uc_indices(self):

        graph = graph_from_file(
            filename="tests/STRUCTURE_FILES/POSCAR_SPINEL.vasp",
            rcut=4.0,
            elements={"Mg"},
        )
        self.assertEqual(
            graph.clusters.pop().return_uc_indices(),
            {"0", "1", "2", "3", "4", "5", "6", "7"},
        )
Esempio n. 4
0
    def test_graph_from_file(self):
        graph = graph_from_file(
            filename="tests/STRUCTURE_FILES/POSCAR_2_clusters.vasp",
            rcut=4.0,
            elements={"Li"},
        )
        tort.tort_mod.tear_down()

        clusters = clusters_from_file(
            filename="tests/STRUCTURE_FILES/POSCAR_2_clusters.vasp",
            rcut=4.0,
            elements={"Li"},
        )
        tort.tort_mod.tear_down()
        c_nodes = set([node.index for node in clusters.pop().nodes])
        g_nodes = set([node.index for node in graph.clusters.pop().nodes])

        self.assertEqual(g_nodes, c_nodes)
Esempio n. 5
0
    def test_minimal_cluster(self, value):

        graph = graph_from_file(filename="tests/STRUCTURE_FILES/" + value,
                                rcut=4.0,
                                elements={"Li"})

        cluster = clusters_from_file(filename="tests/STRUCTURE_FILES/" + value,
                                     rcut=4.0,
                                     elements={"Li"})
        clusterf = cluster.pop()
        clusterf.grow_cluster()
        clusterf.torture_fort()
        graph.torture()

        self.assertEqual(
            set([c.tortuosity for c in graph.minimal_clusters]),
            set([c.tortuosity for c in list(graph.clusters)]),
        )
Esempio n. 6
0
    def test_output_clusters_cif(self):
        graph = graph_from_file(
            filename="tests/STRUCTURE_FILES/POSCAR_2_clusters.vasp",
            rcut=4.0,
            elements={"Li"},
        )

        graph.output_clusters(fmt="cif")
        subprocess.run("mv *CLUS* tests/STRUCTURE_FILES/", shell=True)
        clusters = clusters_from_file(
            filename="tests/STRUCTURE_FILES/POSCAR_CLUS_0.cif",
            rcut=4.0,
            elements={"Li"},
        )

        c_nodes = set([node.index for node in clusters.pop().nodes])
        g_nodes = set([node.index for node in graph.clusters.pop().nodes])

        self.assertEqual(g_nodes, c_nodes)