Beispiel #1
0
def test_cbm_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.055, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000],
        "N": [0.132, 0.000, 0.000, 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)

    cbm_projection = band_structure.cbm_projection()

    for atom_index, projections in cbm_projection.items():
        for index, element in enumerate(projections):
            assert np.isclose(element, projection[atom_index][index])
Beispiel #2
0
def test_get_band_projection_kpt_9_band_8_aln_2d(file_path):
    """
    Verify if the informations returned about projection
    in the 11ª band of the 9º kpoint is correct for the 2d GeC.
    """
    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)

    kpt_9_band_8_projection = {
        "Al": [0.000, 0.000, 0.033, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000],
        "N": [0.000, 0.000, 0.011, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
    }

    band_projection = band_structure.band_projection(9, 8)

    for atom_index, projections in band_projection.items():
        for index, element in enumerate(projections):
            assert np.isclose(element,
                              kpt_9_band_8_projection[atom_index][index])
def test_parse_eigenvalues_gan_3d(file_path):
    """
    Test if the eigenvalues module
    collect all the eigenvalues.
    """
    filename = file_path("/gan-3d/EIGENVAL")
    eigenval = Eigenvalues(filename)

    number_of_bands = 16
    number_of_kpoints = 10
    for _, band in eigenval.eigenvalues.items():

        assert len(band) == number_of_bands

    assert len(eigenval.eigenvalues) == number_of_kpoints
Beispiel #4
0
def test_is_metal_gan_3d(file_path):
    """
    Confirms that ge GaN 3d is not an metal.
    """
    procar_filename = file_path("/gan-3d/PROCAR")
    eigenval_filename = file_path("/gan-3d/EIGENVAL")
    vasprun_filename = file_path("/gan-3d/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)

    assert band_structure.is_metal() is False
Beispiel #5
0
def test_band_gap_aln_2d(file_path):
    """
    Test AlN 2d band gap
    """
    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)

    assert np.isclose(band_structure.band_gap()["gap"], 2.924163)
Beispiel #6
0
def test_band_gap_gan_3d(file_path):
    """
    Tests GaN 3d band gap .
    """
    procar_filename = file_path("/gan-3d/PROCAR")
    eigenval_filename = file_path("/gan-3d/EIGENVAL")
    vasprun_filename = file_path("/gan-3d/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)

    assert np.isclose(band_structure.band_gap()["gap"], 1.5380389999999995)
Beispiel #7
0
def test_gec_2d_cbm(file_path):
    """
    Test with GeC-2d
    """
    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)

    cbm_projection = band_structure.cbm_projection()
    cbm_df = projection_to_df(cbm_projection)
    correction_indexes = get_fractionary_correction_indexes(cbm_df)
    assert correction_indexes["Ge"][0] == "p"
Beispiel #8
0
def test_cbm_index_gan_3d(file_path):
    """
    Test if the index of the conduction minimum band is correct
    """
    procar_filename = file_path("/gan-3d/PROCAR")
    eigenval_filename = file_path("/gan-3d/EIGENVAL")
    vasprun_filename = file_path("/gan-3d/vasprun.xml")
    kpoint_cbm = 1
    band_cbm = 10

    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)

    cbm_index = band_structure.cbm_index()
    assert cbm_index[0] == kpoint_cbm
    assert cbm_index[1] == band_cbm
Beispiel #9
0
def test_vbm_index_aln_2d(file_path):
    """
    Test if the index 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")
    kpoint_vbm = 16
    band_vbm = 4

    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_index = band_structure.vbm_index()
    assert vbm_index[0] == kpoint_vbm
    assert vbm_index[1] == band_vbm
Beispiel #10
0
def test_bn_2d_vbm_without_treshold(file_path):
    """
    Test with BN-2d without treshold
    """
    procar_filename = file_path("/bn-2d/PROCAR")
    eigenval_filename = file_path("/bn-2d/EIGENVAL")
    vasprun_filename = file_path("/bn-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=0)
    assert correction_indexes["N"][0] == "p"
    assert correction_indexes["B"][0] == "p"
Beispiel #11
0
def test_aln_2d_cbm_treshold_30(file_path):
    """
    Test with AlN-2d with treshold 29
    """
    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)

    cbm_projection = band_structure.cbm_projection()
    cbm_df = projection_to_df(cbm_projection)
    correction_indexes = get_fractionary_correction_indexes(cbm_df,
                                                            treshold=29)
    assert correction_indexes["N"][0] == "s"
    assert len(correction_indexes["Al"]) == 0
Beispiel #12
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