Ejemplo n.º 1
0
def test_bulk_silicon():
    a_si = 5.50
    PRIMITIVE_CELL = [[0, 0.5 * a_si, 0.5 * a_si], [0.5 * a_si, 0, 0.5 * a_si],
                      [0.5 * a_si, 0.5 * a_si, 0]]

    tb.Atom.orbital_sets = {'Si': 'SiliconSP3D5S'}

    xyz_file = """2
    Si2 cell
    Si1       0.0000000000    0.0000000000    0.0000000000
    Si2       1.3750000000    1.3750000000    1.3750000000
    """

    h = tb.Hamiltonian(xyz=xyz_file, nn_distance=2.5)
    h.initialize()
    h.set_periodic_bc(PRIMITIVE_CELL)

    sym_points = ['L', 'GAMMA', 'X']
    num_points = [10, 25]
    k = tb.get_k_coords(sym_points, num_points, 'Si')
    band_sructure = []

    vals = np.zeros((sum(num_points), h.h_matrix.shape[0]), dtype=np.complex)

    for jj, item in enumerate(k):
        vals[jj, :], _ = h.diagonalize_periodic_bc(item)

    band_structure = np.real(np.array(vals))
    np.testing.assert_allclose(band_structure,
                               expected_bulk_silicon_band_structure(),
                               atol=1e-4)
Ejemplo n.º 2
0
def main4():

    from tb.aux_functions import get_k_coords

    path_to_xyz_file = """2
                              Bilayer Bismuth
                              Bi   0.000000    2.499364    0.868720
                              Bi   2.164513    1.249682   -0.868720
                           """

    # path_to_pdf_file = '../band_structure_of_bulk_bismuth.pdf'
    species = 'Bi'
    basis_set = 'Bismuth'
    sym_points = ['M', 'GAMMA', 'K']
    # sym_points = ['GAMMA', 'GAMMA']

    num_points = [40, 40]
    # num_points = [1]
    indices_of_bands = range( 0, 16 )

    primitive_cell = data_bi_bulk.cell

    Atom.orbital_sets = { species: basis_set }

    h = Hamiltonian(xyz=path_to_xyz_file, nn_distance=4.7, so_coupling=0.9)
    h.initialize(radial_dep)
    h.set_periodic_bc(primitive_cell)
    plot_atom_positions(h.atom_list, h.ct.virtual_and_interfacial_atoms, radial_dep)

    k_points = get_k_coords( sym_points, num_points, species )

    list_of_spin_orbit_couplings = [0.27]
    # list_of_spin_orbit_couplings = np.linspace(0, 0.333333, 40)

    band_structure = []
    for ii, item in enumerate(list_of_spin_orbit_couplings):
        for jj, item in enumerate(k_points):
            # h = Hamiltonian(xyz=path_to_xyz_file, nn_distance=5.6)
            # h.initialize(radial_dep)
            # h.set_periodic_bc(primitive_cell, radial_dep)data_bi_bulk.py
            data_bi_bulk.LAMBDA = list_of_spin_orbit_couplings[ii]
            [eigenvalues, _] = h.diagonalize_periodic_bc(k_points[jj])
            band_structure.append(eigenvalues)

    band_structure = np.array(band_structure)

    ax = plt.axes()
    ax.plot(band_structure[ :, indices_of_bands ])
    ax.set_xlabel( "" )
    ax.set_ylabel( "Energy (eV)" )
    ax.set_title( "" )
    plt.tight_layout()
    plt.ylim((-2, 2))
    plt.show()
Ejemplo n.º 3
0
def main2():

    from tb.aux_functions import get_k_coords

    path_to_xyz_file = 'input_samples/bulk_bismuth.xyz'
    # path_to_pdf_file = '../band_structure_of_bulk_bismuth.pdf'
    species = 'Bi'
    basis_set = 'Bismuth'
    sym_points = ['K', 'GAMMA', 'T', 'W', 'L', 'LAMBDA']
    # sym_points = ['K', 'X', 'GAMMA', 'L', 'U', 'T']
    # sym_points = ['GAMMA', 'GAMMA']
    # sym_points = ['K', 'GAMMA', 'T']

    num_points = [20, 20, 20, 20, 20]
    # num_points = [1]
    # num_points = [20, 20]
    indices_of_bands = range(0, 16)

    cell_a = examples.data_bi_bulk.a_bi * np.array([[(-1.0 / 2.0), (-np.sqrt(3.0) / 6.0), 0.0],
                                                    [ (  1.0 / 2.0 ), ( -np.sqrt(3.0) / 6.0 ), 0.0 ],
                                                    [ 0.0,            (  np.sqrt(3.0) / 3.0 ), 0.0 ]])
    cell_c = examples.data_bi_bulk.c_bi * np.array([[0.0, 0.0, (1.0 / 3.0)],
                                                    [ 0.0, 0.0, ( 1.0 / 3.0 ) ],
                                                    [ 0.0, 0.0, ( 1.0 / 3.0 ) ]])
    primitive_cell = cell_a + cell_c

    Atom.orbital_sets = { species: basis_set }

    h = Hamiltonian( xyz = path_to_xyz_file, nn_distance = 4.6, so_coupling=1.2)
    h.initialize( radial_dep )
    h.set_periodic_bc(primitive_cell.tolist())

    k_points = get_k_coords( sym_points, num_points, species )

    band_structure = []
    for jj, item in enumerate( k_points ):
        [ eigenvalues, _ ] = h.diagonalize_periodic_bc( k_points[ jj ] )
        band_structure.append( eigenvalues )

    band_structure = np.array( band_structure )

    print(h.is_hermitian())

    ax = plt.axes()
    ax.plot( band_structure[ :, indices_of_bands ] )
    ax.set_xlabel( "" )
    ax.set_ylabel( "Energy (eV)" )
    ax.set_title( "" )
    plt.tight_layout()
    plt.show()
Ejemplo n.º 4
0
def main1():

    from tb import get_k_coords

    path_to_xyz_file = 'input_samples/bulk_silicon.xyz'
    species = 'Si'
    basis_set = 'SiliconSP3D5S'
    sym_points = [ 'L', 'GAMMA', 'X' ]

    num_points = [ 20, 20 ]
    indices_of_bands = range( 0, 8 )

    primitive_cell = examples.data_bi_bulk.a_si * np.array([[0.0, 0.5, 0.5],
                                                            [0.5, 0.0, 0.5],
                                                            [0.5, 0.5, 0.0]])

    Atom.orbital_sets = { species: basis_set }

    h = Hamiltonian( xyz = path_to_xyz_file)
    h.initialize()
    h.set_periodic_bc( primitive_cell )

    k_points = get_k_coords( sym_points, num_points, species )

    band_structure = []
    for jj, item in enumerate( k_points ):
        [ eigenvalues, _ ] = h.diagonalize_periodic_bc( k_points[ jj ] )
        band_structure.append( eigenvalues )

    band_structure = np.array( band_structure )

    ax = plt.axes()
    ax.plot( band_structure[ :, indices_of_bands ] )
    ax.set_xlabel( "" )
    ax.set_ylabel( "Energy (eV)" )
    ax.set_title( "" )
    plt.tight_layout()
    plt.show()
Ejemplo n.º 5
0
def preprocess_data(param_file, k_points_file, xyz, code_name):
    params = tb.yaml_parser(param_file)  # parse parameter file

    if k_points_file is None:  # default k-points
        if len(params['primitive_cell']) == 3:
            sym_points = [
                'L', 'GAMMA', 'X', 'W', 'K', 'L', 'W', 'X', 'K', 'GAMMA'
            ]
            num_points = [15, 20, 15, 10, 15, 15, 15, 15, 20]
            wave_vector = tb.get_k_coords(sym_points, num_points)
        else:
            wave_vector = [[0.0, 0.0, 0.0]]
    else:  # read k-points file if its path is provided from the command line arguments
        wave_vector = np.loadtxt(k_points_file)

    # read xyz file if its path is provided from the command line arguments
    if isinstance(xyz, str):
        with open(xyz, 'r') as myfile:
            params['xyz'] = myfile.read()

    if not isinstance(code_name, str):
        code_name = 'band_structure'

    return params, wave_vector, code_name