示例#1
0
    def setUp(self):
        lattice = [[10, 0, 0], [-5, 8.660254, 0], [0, 0, 5]]
        self.hexagonal = Structure(lattice=lattice,
                                   species=["H"],
                                   coords=[[0, 0, 0]])
        self.kpoints_g = Kpoints.gamma_automatic(kpts=(2, 2, 2))

        lattice2 = [[1, 0, 0], [0, 2, 0], [0, 0, 3]]
        self.ortho = Structure(lattice=lattice2,
                               species=["H"],
                               coords=[[0, 0, 0]])
        self.kpoints_mp = Kpoints.monkhorst_automatic(kpts=(2, 2, 2))

        self.kpoints_reciprocal = \
            Kpoints(style=Kpoints.supported_modes.Reciprocal,
                    num_kpts=2,
                    kpts=((0, 0, 0), (0.5, 0.5, 0.5)),
                    kpts_weights=[1, 1])
示例#2
0
#kpoints = Kpoints.monkhorst_automatic([3, 3, 3], [0, 0, 0])
#kpoints = Kpoints.automatic(50)
#poscar = Poscar.from_file("POSCAR")
#kpoints = Kpoints.automatic_density(poscar.structure, 500, True)

if __name__ == '__main__':

    if os.path.isfile('KPOINTS'):
        print("KPOINTS already loaded")
        exit
    else:
        with open('rendered_wano.yml') as file:
            wano_file = yaml.full_load(file)

        Rk = wano_file["TABS"]["KPOINTS"]["Kpoints_length"]
        Monkhorst = wano_file["TABS"]["KPOINTS"]["Kpoints_Monkhorst"]

        if Rk:
            Rk_val = (wano_file["TABS"]["KPOINTS"]["Rk_length"])
            kpoints = Kpoints.automatic(Rk_val)
        elif Monkhorst:
            mat_n = literal_eval(wano_file["TABS"]["KPOINTS"]["Monkhorst"])
            n = [mat_n[0][0], mat_n[0][1], mat_n[0][2]]
            n_shift = [mat_n[1][0], mat_n[1][1], mat_n[1][2]]
            kpoints = Kpoints.monkhorst_automatic(n, n_shift)
            # kpoints = Kpoints.gamma_automatic(n, n_shift)
        else:
            None

        kpoints.write_file('KPOINTS')
        print("KPOINTS successfully created")