Exemplo 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.Orbitals.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.HamiltonianSp(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.num_eigs), 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()[:, :h.num_eigs],
        atol=1e-4)
Exemplo n.º 2
0
def main():
    # specify atomic coordinates in xyz format
    path_to_xyz_file = """2
                          Bulk Si cell
                          Si1       0.000    0.000    0.000
                          Si2       1.375    1.375    1.375"""

    # specify basis set
    Orbitals.orbital_sets = {'Si': 'SiliconSP3D5S'}

    # create a Hamiltonian object storing the Hamiltonian matrices
    h = Hamiltonian(xyz=path_to_xyz_file)
    h.initialize()

    # set periodic boundary conditions
    h.set_periodic_bc(primitive_cell)

    # define wave vector coordinates
    sym_points = ['L', 'GAMMA', 'X', 'W', 'K', 'L', 'W', 'X', 'K', 'GAMMA']
    num_points = [15, 20, 15, 10, 15, 15, 15, 15, 20]
    k_points = get_k_coords(sym_points, num_points, 'Si')

    # compute band structure
    band_structure = np.zeros((sum(num_points), h.h_matrix.shape[0]))

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

    # visualize
    ax = plt.axes()
    ax.set_title('Band structure of the bulk silicon')
    ax.set_ylabel('Energy (eV)')
    ax.plot(np.sort(np.real(band_structure))[:, :8], 'k')
    ax.plot([0, band_structure.shape[0]], [0, 0],
            '--',
            color='k',
            linewidth=0.5)
    plt.xticks(np.insert(np.cumsum(num_points) - 1, 0, 0), labels=sym_points)
    ax.xaxis.grid()
    plt.show()
Exemplo n.º 3
0
def preprocess_data(param_file, k_points_file, xyz, code_name):
    """

    Parameters
    ----------
    param_file :
        
    k_points_file :
        
    xyz :
        
    code_name :
        

    Returns
    -------

    """
    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, 'Si')
        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
Exemplo n.º 4
0
                   [a1, -a2, 0.0]])

# --------------------------- wave vectors -------------------------

lat_const_rec = 2 * np.pi / (3 * np.sqrt(3) * lat_const)

special_k_points = {
    'GAMMA': [0, 0, 0],
    'K': [lat_const_rec * np.sqrt(3), lat_const_rec, 0],
    'K_prime': [lat_const_rec * np.sqrt(3), -lat_const_rec, 0],
    'M': [lat_const_rec * np.sqrt(3), 0, 0]
}

sym_points = ['GAMMA', 'M', 'K', 'GAMMA']
num_points = [25, 25, 25]
k_points = get_k_coords(sym_points, num_points, special_k_points)

# ------------------------------------------------------------------

fig_counter = 1


def graphene_first_nearest_neighbour():

    coords = """2
    Graphene
    C1   0.00   0.00   0.00
    C2   {}   0.00   0.00
    """.format(lat_const)

    # --------------------------- Basis set --------------------------