def test_is_metal_aln_2d(file_path): """ Confirms that AlN 2d is not an metal. """ 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 band_structure.is_metal() is False
def test_band_gap_gec_2d(file_path): """ Test GeC 2d band gap. """ 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) assert np.isclose(band_structure.band_gap()["gap"], 2.1609610000000004)
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"
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
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
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"
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
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