Esempio n. 1
0
def test_vbm_projection_aln_2d(file_path):
    """
    Test if the projection of the valence maximum band is correct
    """
    procar_filename = file_path("/aln-2d/PROCAR")
    eigenval_filename = file_path("/aln-2d/EIGENVAL")
    vasprun_filename = file_path("/aln-2d/vasprun.xml")
    projection = {
        "Al": [0.000, 0.000, 0.002, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000],
        "N": [0.000, 0.000, 0.510, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
    }

    procar = Procar(procar_filename)
    vasprun = Vasprun(vasprun_filename)
    eigenval = Eigenvalues(eigenval_filename)

    band_structure = BandStructure(eigenvalues=eigenval.eigenvalues,
                                   fermi_energy=vasprun.fermi_energy,
                                   atoms_map=vasprun.atoms_map,
                                   num_bands=procar.num_bands,
                                   band_projection=procar)

    vbm_projection = band_structure.vbm_projection()

    for atom_index, projections in vbm_projection.items():
        for index, element in enumerate(projections):
            assert np.isclose(element, projection[atom_index][index])
Esempio n. 2
0
def vbm_character(software: str, base_path: str) -> None:
    """Uses output files from softwares that perform ab initio calculations to discover the
       last valence band (VBM) and extract, in percentage, its character corresponding to each
       orbital type (s, p, d, ... ). The names of the files required for each
       software are listed below, it is worth mentioning that their names cannot be modified.

    VASP: PROCAR, EIGENVAL, vasprun.xml
    """

    welcome_message("minushalf")

    softwares = {"VASP": Vasp()}

    factory = softwares[software.upper()]

    eigenvalues = factory.get_eigenvalues(base_path=base_path)
    fermi_energy = factory.get_fermi_energy(base_path=base_path)
    atoms_map = factory.get_atoms_map(base_path=base_path)
    num_bands = factory.get_number_of_bands(base_path=base_path)
    band_projection_file = factory.get_band_projection_class(
        base_path=base_path)

    band_structure = BandStructure(eigenvalues, fermi_energy, atoms_map,
                                   num_bands, band_projection_file)
    vbm_projection = band_structure.vbm_projection()
    normalized_df = projection_to_df(vbm_projection)

    click.echo(normalized_df.to_markdown())

    end_message()
Esempio n. 3
0
def test_aln_2d_vbm(file_path):
    """
    Test with AlN-2d
    """
    procar_filename = file_path("/aln-2d/PROCAR")
    eigenval_filename = file_path("/aln-2d/EIGENVAL")
    vasprun_filename = file_path("/aln-2d/vasprun.xml")

    procar = Procar(procar_filename)
    vasprun = Vasprun(vasprun_filename)
    eigenval = Eigenvalues(eigenval_filename)

    band_structure = BandStructure(eigenvalues=eigenval.eigenvalues,
                                   fermi_energy=vasprun.fermi_energy,
                                   atoms_map=vasprun.atoms_map,
                                   num_bands=procar.num_bands,
                                   band_projection=procar)

    vbm_projection = band_structure.vbm_projection()
    vbm_df = projection_to_df(vbm_projection)
    correction_indexes = get_fractionary_correction_indexes(vbm_df)
    assert correction_indexes["N"][0] == "p"
Esempio n. 4
0
def test_gec_2d_vbm_changing_treshold_13(file_path):
    """
    Test with GeC-2d with treshold_13
    """
    procar_filename = file_path("/gec-2d/PROCAR")
    eigenval_filename = file_path("/gec-2d/EIGENVAL")
    vasprun_filename = file_path("/gec-2d/vasprun.xml")

    procar = Procar(procar_filename)
    vasprun = Vasprun(vasprun_filename)
    eigenval = Eigenvalues(eigenval_filename)

    band_structure = BandStructure(eigenvalues=eigenval.eigenvalues,
                                   fermi_energy=vasprun.fermi_energy,
                                   atoms_map=vasprun.atoms_map,
                                   num_bands=procar.num_bands,
                                   band_projection=procar)

    vbm_projection = band_structure.vbm_projection()
    vbm_df = projection_to_df(vbm_projection)
    correction_indexes = get_fractionary_correction_indexes(vbm_df,
                                                            treshold=12)
    assert correction_indexes["C"][0] == "p"
    assert len(correction_indexes["Ge"]) == 0