Esempio n. 1
0
def make_band_edge_orb_infos_and_eigval_plot(args):
    supercell_vbm = args.p_state.vbm_info.energy
    supercell_cbm = args.p_state.cbm_info.energy

    def _inner(_dir: Path):
        try:
            defect_entry = loadfn(_dir / "defect_entry.json")
            title = defect_entry.name
        except FileNotFoundError:
            title = "No name"
        procar = Procar(_dir / defaults.procar)
        vasprun = Vasprun(_dir / defaults.vasprun)
        str_info = loadfn(_dir / "defect_structure_info.json")
        band_edge_orb_chars = make_band_edge_orbital_infos(
            procar, vasprun, supercell_vbm, supercell_cbm, str_info)
        band_edge_orb_chars.to_json_file(_dir / "band_edge_orbital_infos.json")
        plotter = EigenvalueMplPlotter(title=title,
                                       band_edge_orb_infos=band_edge_orb_chars,
                                       supercell_vbm=supercell_vbm,
                                       supercell_cbm=supercell_cbm)
        plotter.construct_plot()
        plotter.plt.savefig(fname=_dir / "eigenvalues.pdf")
        plotter.plt.clf()

    parse_dirs(args.dirs, _inner)
Esempio n. 2
0
def make_calc_results(args):
    def _inner(_dir: Path):
        calc_results = make_calc_results_from_vasp(
            vasprun=Vasprun(_dir / defaults.vasprun),
            outcar=Outcar(_dir / defaults.outcar))
        calc_results.to_json_file(str(_dir / "calc_results.json"))

    parse_dirs(args.dirs, _inner)
Esempio n. 3
0
def make_defect_vesta_file(args) -> None:
    def _inner(_dir: Path):
        defect_str_info = loadfn(_dir / "defect_structure_info.json")
        make_vesta_file = MakeDefectVestaFile(defect_str_info, args.cutoff,
                                              args.min_displace_w_arrows,
                                              args.arrow_factor, args.title)
        make_vesta_file.initial_vesta.write_file(_dir / "defect_initial.vesta")
        make_vesta_file.final_vesta.write_file(_dir / "defect.vesta")

    parse_dirs(args.dirs, _inner)
Esempio n. 4
0
def test_parse_dirs_fail(tmpdir):
    parse_dirs([Path(tmpdir) / "y"], _inner_function=print_a_to_file_x)
Esempio n. 5
0
def test_parse_dirs_file(tmpdir):
    tmpfile = Path(tmpdir) / "file"
    tmpfile.touch()
    parse_dirs([tmpfile], _inner_function=print_a_to_file_x)
Esempio n. 6
0
def test_parse_dirs(tmpdir):
    pathlib_tmpdir = Path(tmpdir)
    parse_dirs([Path(tmpdir)], _inner_function=print_a_to_file_x)

    actual = pathlib_tmpdir / "x"
    assert actual.read_text() == "a"