Example #1
0
 def test_from_seed(self):
     from pymatgen import Lattice, Structure
     coords = [[0, 0, 0], [0.75, 0.5, 0.75]]
     lattice = Lattice.from_parameters(a=3.84,
                                       b=3.84,
                                       c=3.84,
                                       alpha=120,
                                       beta=90,
                                       gamma=60)
     struct = Structure(lattice, ["Si", "C"], coords)
     s1 = pyxtal()
     s1.from_seed(struct)
     s2 = s1.subgroup(once=True)
     pmg_s1 = s1.to_pymatgen()
     pmg_s2 = s2.to_pymatgen()
     self.assertTrue(sm.StructureMatcher().fit(pmg_s1, pmg_s2))
Example #2
0
 def test_from_seed(self):
     from pymatgen import Lattice, Structure
     coords = [[0, 0, 0], [0.75, 0.5, 0.75]]
     lattice = Lattice.from_parameters(a=3.84,
                                       b=3.84,
                                       c=3.84,
                                       alpha=120,
                                       beta=90,
                                       gamma=60)
     struct = Structure(lattice, ["Si", "C"], coords)
     s1 = random_crystal(seed=struct)
     s2 = s1.subgroup(once=True)
     pmg_s1 = s1.to_pymatgen()
     pmg_s2 = s2.to_pymatgen()
     #sga1 = SpacegroupAnalyzer(pmg_s1).get_space_group_symbol()
     #sga2 = SpacegroupAnalyzer(pmg_s2).get_space_group_symbol()
     self.assertTrue(sm.StructureMatcher().fit(pmg_s1, pmg_s2))
Example #3
0
    def test_from_seed(self):
        from pymatgen import Lattice, Structure
        coords = [[0, 0, 0], [0.75, 0.5, 0.75]]
        lattice = Lattice.from_parameters(a=3.84,
                                          b=3.84,
                                          c=3.84,
                                          alpha=120,
                                          beta=90,
                                          gamma=60)
        struct = Structure(lattice, ["Si", "C"], coords)
        s1 = pyxtal()
        s1.from_seed(struct)
        s2 = s1.subgroup_once(eps=0)
        pmg_s1 = s1.to_pymatgen()
        pmg_s2 = s2.to_pymatgen()
        self.assertTrue(sm.StructureMatcher().fit(pmg_s1, pmg_s2))

        pmg_s1 = Structure.from_file(cif_path + "B28.vasp")
        struc = pyxtal()
        struc.from_seed(seed=cif_path + "B28.vasp")
        pmg_s2 = struc.to_pymatgen()
        self.assertTrue(sm.StructureMatcher().fit(pmg_s1, pmg_s2))
        permutation = {"B": "C"}
        struc.subgroup_once(0.01, None, permutation, max_cell=2)