예제 #1
0
파일: cubic.py 프로젝트: ngoettin/bandcalc
b3 = np.array([0, 0, 2*np.pi/a])
b = np.vstack([b1, b2, b3])
lattice = bandcalc.generate_lattice_by_shell(b, 2)

# k path
points = np.array([[0, 0, 0],    # Gamma
    [0, np.pi/a, 0],             # X
    [np.pi/a, np.pi/a, 0],       # M
    [0, 0, 0],                   # Gamma
    [np.pi/a, np.pi/a, np.pi/a]]) # R
k_names = [r"$\Gamma$", r"X", r"M", r"$\Gamma$", r"R"]
path = bandcalc.generate_k_path(points, N)

# Calculate band structure
potential_matrix = bandcalc.calc_potential_matrix(lattice)
hamiltonian = bandcalc.calc_hamiltonian(lattice, potential_matrix, m)
bandstructure, prefix = bandcalc.get_unit_prefix(
        bandcalc.calc_bandstructure(path, hamiltonian))

# Plots
fig = plt.figure(figsize=(11,5))
ax0 = fig.add_subplot(121, projection="3d")
ax1 = fig.add_subplot(122)
bandcalc.plot_lattice_3d(ax0, lattice, "ko")
bandcalc.plot_k_path_3d(ax0, path, "r")
bandcalc.plot_bandstructure(ax1, bandstructure, k_names, "k")

ax1.set_ylabel(r"$E - \hbar\Omega_0$ in {}eV".format(prefix))
ax1.set_ylim([0, 4])

plt.tight_layout()
예제 #2
0
# Real space moire lattice vectors
moire_lattice = bandcalc.generate_lattice_by_shell(m, shells)

if potential == "MoS2":
    # Moire potential coefficients
    V = 6.6 * 1e-3 * np.exp(-1j * 94 * np.pi / 180)  # in eV
    Vj = np.array([V if i % 2 else np.conjugate(V) for i in range(1, 7)])
    potential_matrix = bandcalc.calc_potential_matrix_from_coeffs(
        rec_moire_lattice, Vj)
elif potential == "off":
    potential_matrix = bandcalc.calc_potential_matrix(rec_moire_lattice)

## Calculate eigenstates for every k point in the MBZ
k_points = bandcalc.generate_monkhorst_pack_set(rec_m, 30).astype(np.float32)
hamiltonian = bandcalc.calc_hamiltonian(rec_moire_lattice, potential_matrix,
                                        mass)

## Calculate MBZ and choose some K-points for the k-path
vor_m = Voronoi(rec_moire_lattice)
sorted_vertices = np.array(
    sorted(vor_m.vertices, key=lambda x: np.abs(x.view(complex))))[:6]
sorted_vertices = np.array(
    sorted(sorted_vertices, key=lambda x: np.angle(x.view(complex))))
points = np.array([[0, 0], sorted_vertices[0], sorted_vertices[1],
                   sorted_vertices[3]])
k_names = [r"$\gamma$", r"$\kappa'$", r"$\kappa''$", r"$\kappa$"]
path = bandcalc.generate_k_path(points, N)

## Calculate bandstructure
bandstructure, prefix = bandcalc.get_unit_prefix(
    bandcalc.calc_bandstructure(path, hamiltonian))
예제 #3
0
    # Moire potential for reference
    moire_potential = bandcalc.calc_moire_potential_on_grid(grid, GM, Vj)

elif potential == "off":
    potential_matrix = bandcalc.calc_potential_matrix(rec_moire_lattice)
    moire_potential = np.zeros(grid[0].shape)

# Calculate MBZ and find a K-point
vor_m = Voronoi(rec_moire_lattice)
sorted_vertices = np.array(
    sorted(vor_m.vertices, key=lambda x: np.abs(x.view(complex))))
k_point = sorted_vertices[0]

# Calculate the wavefunction
hamiltonian = bandcalc.calc_hamiltonian(rec_moire_lattice, potential_matrix, m)

wavefunction = bandcalc.calc_wave_function_on_grid(k_point, rec_moire_lattice,
                                                   grid, hamiltonian,
                                                   energy_level)

# Energies for reference
energies, prefix = bandcalc.get_unit_prefix(
    np.sort(
        np.linalg.eigvals(
            bandcalc.calc_hamiltonian(rec_moire_lattice, potential_matrix,
                                      m)(k_point))))
energy_slice = energies[energy_level -
                        5 if energy_level - 5 > -1 else None:energy_level +
                        5 if energy_level + 5 < len(energies) else None]
energy = np.real(energies[energy_level])