Exemplo n.º 1
0
def test_projection_to_df_third():
    """
    Test the method with the following input
    {
        "In": [],
        "Sb": []
    }
    """
    projections = {"In": [], "Sb": []}

    projection_to_df(projections)
Exemplo n.º 2
0
def test_projection_to_df_fourth():
    """
    Test the method with the following input
    {
        "In": [1, 2, 3, 4, 5],
        "Sb": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18]
    }
    """
    projections = {
        "In": [1, 2, 3, 4, 5],
        "Sb": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
    }

    projection_to_df(projections)
Exemplo n.º 3
0
def cbm_character(software: str, base_path: str) -> None:
    """Uses output files from softwares that perform ab initio calculations to
      discover the first conduction band (CBM) 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)
    cbm_projection = band_structure.cbm_projection()
    normalized_df = projection_to_df(cbm_projection)
    click.echo(normalized_df.to_markdown())

    end_message()
Exemplo n.º 4
0
def test_projection_to_df_first():
    """
    Test the method with the following input
    {"In": [1, 2, 3, 4, 5], "Sb": [1, 2, 3, 4, 5, 6]}
    """
    projections = {"In": [1, 2, 3, 4, 5], "Sb": [1, 2, 3, 4, 5, 6]}

    data_frame = projection_to_df(projections)
    assert np.isclose(data_frame["d"]["In"], 14.0)
    assert np.isclose(data_frame["d"]["Sb"], 31.0)
    assert np.isclose(data_frame["p"]["In"], 25.0)
    assert np.isclose(data_frame["p"]["Sb"], 25.0)
    assert np.isclose(data_frame["s"]["In"], 3.0)
    assert np.isclose(data_frame["s"]["Sb"], 3.0)
Exemplo n.º 5
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"
Exemplo n.º 6
0
def test_projection_to_df_second():
    """
    Test the method with the following input
    {
        "In": [1, 2, 3, 4, 5],
        "Sb": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    }
    """
    projections = {
        "In": [1, 2, 3, 4, 5],
        "Sb": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    }

    data_frame = projection_to_df(projections)
    assert np.isclose(data_frame["d"]["In"], 7.0)
    assert np.isclose(data_frame["d"]["Sb"], 50.0)
    assert np.isclose(data_frame["p"]["In"], 13.0)
    assert np.isclose(data_frame["p"]["Sb"], 13.0)
    assert np.isclose(data_frame["s"]["In"], 1.0)
    assert np.isclose(data_frame["s"]["Sb"], 1.0)
    assert np.isclose(data_frame["f"]["In"], 0.0)
    assert np.isclose(data_frame["f"]["Sb"], 14.0)
Exemplo n.º 7
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"
Exemplo n.º 8
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
Exemplo n.º 9
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