|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +""" |
| 3 | +Example for calculation of band structure: Triangular optical lattice |
| 4 | +
|
| 5 | +Created on Thu Feb 15 20:37:38 2018 |
| 6 | +@author: gitrymt |
| 7 | +""" |
| 8 | +import sys |
| 9 | +import numpy as np |
| 10 | +import matplotlib.pyplot as plt |
| 11 | +from mpl_toolkits.mplot3d import axes3d |
| 12 | +from matplotlib import cm |
| 13 | +import pandas as pd |
| 14 | + |
| 15 | +# import user library |
| 16 | +sys.path.append('../function') |
| 17 | +#from func_band_calc import calcBand_1d |
| 18 | + |
| 19 | +# Lattice depth V_lat = s Er |
| 20 | +s = 1 |
| 21 | + |
| 22 | +# Calculation |
| 23 | +m = 6 |
| 24 | +Nsite = 2 * m + 1 |
| 25 | + |
| 26 | +b1 = np.array([1, 0]) |
| 27 | +b2 = np.array([-1, -np.sqrt(3)])/2 |
| 28 | +b3 = np.array([-1, np.sqrt(3)])/2 |
| 29 | + |
| 30 | +p_Gamma = 0 * b1 + 0 * b2 |
| 31 | +p_M = 1/2 * b1 + 0 * b2 |
| 32 | +p_K = 1/3 * b1 - 1/3 * b2 |
| 33 | +fig = plt.figure() |
| 34 | +ax = fig.add_subplot(111) |
| 35 | +# 5点(0.1,0.1),(0.1,0.6),(0.7,0.8),(0.6,0.4),(0.6,0.1)を通る多角形を描画 |
| 36 | +poly = plt.Polygon((p_Gamma, p_M, p_K, p_Gamma),fc="#ff0000", alpha=0.5) |
| 37 | +ax.add_patch(poly) |
| 38 | +plt.show() |
| 39 | + |
| 40 | + |
| 41 | +dn = 25 |
| 42 | + |
| 43 | +n_list = [(x, 0) for x in np.linspace(0, 1/2, int(dn * np.sqrt(3)))] # Gamma -> M |
| 44 | +n_M = len(n_list) - 0.5 |
| 45 | + |
| 46 | +n_list = n_list + [(1/2 - x/6, -x/3) for x in np.linspace(0, 1, dn) if x>0] # M -> K |
| 47 | +#n_K = len([(0.5, -x) for x in np.linspace(0, 1/3, dn)]) |
| 48 | +n_K = len(n_list) - 0.5 |
| 49 | + |
| 50 | +n_list = n_list + [(x/3, -x/3) for x in np.linspace(1, 0, dn*2) if x<1] # K -> Gamma |
| 51 | +#n_Gamma = len([(x, -x) for x in np.linspace(1/3, 0, dn*2)]) |
| 52 | +n_Gamma = len(n_list) |
| 53 | + |
| 54 | +l_list = [(x, y) for x in np.linspace(-m, m, Nsite) for y in np.linspace(-m, m, Nsite)] |
| 55 | +E = np.zeros([len(n_list), Nsite**2]) |
| 56 | + |
| 57 | +list_emp = [] |
| 58 | +condition = pd.DataFrame([[list_emp, list_emp, list_emp, |
| 59 | + False, False, False]], |
| 60 | + columns = ["(l1, l2)", "(l1', l2')", "(l1-l1', l2-l2')", |
| 61 | + "Condition 1", "Condition 2", "Condition 3" |
| 62 | + ]) |
| 63 | + |
| 64 | +for i_n, n in enumerate(n_list): |
| 65 | + H = np.zeros([Nsite**2, Nsite**2]) |
| 66 | + |
| 67 | + for i_1, ls_1 in enumerate(l_list): |
| 68 | + for i_2, ls_2 in enumerate(l_list): |
| 69 | + l_diff = np.array(ls_1) - np.array(ls_2) |
| 70 | + |
| 71 | + if (ls_1[0] == ls_2[0]) and (ls_1[1] == ls_2[1]): |
| 72 | + H[i_1][i_2] = 3 * ((n[0] + ls_1[0])**2 + (n[1] + ls_1[1])**2 - (n[0] + ls_1[0]) * (n[1] + ls_1[1])) - 3 * s / 4 |
| 73 | + |
| 74 | +# if ((np.abs(ls_1[0] - ls_2[0]) == 1) and (ls_1[1] == ls_2[1])\ |
| 75 | +# or ((ls_1[0] == ls_2[0]) and np.abs(ls_1[1] - ls_2[1]) == 1)\ |
| 76 | +# or ((ls_1[0] - ls_2[0] == ls_1[1] - ls_2[1]) and (np.abs(ls_1[1] - ls_2[1]) == 1))): |
| 77 | + |
| 78 | + |
| 79 | + condition_1 = (int(np.abs(ls_1[0] - ls_2[0])) == 1) and (ls_1[1] == ls_2[1]) |
| 80 | + condition_2 = (ls_1[0] == ls_2[0]) and (int(np.abs(ls_1[1] - ls_2[1])) == 1) |
| 81 | +# condition_3 = (int(ls_1[0] - ls_1[1]) == int(ls_2[0] - ls_2[1])) and (int(np.abs(ls_2[0] - ls_2[1])) == 1) |
| 82 | + condition_3 = ((l_diff[0] == 1) and (l_diff[1] == 1)) or ((l_diff[0] == -1) and (l_diff[1] == -1)) |
| 83 | +# condition_1 = (np.abs(l_diff[0] == 1)) and (ls_1[1] == ls_2[1]) |
| 84 | +# condition_2 = (np.abs(l_diff[1] == 1)) and (ls_1[0] == ls_2[0]) |
| 85 | +# condition_3 = (l_diff[0] * l_diff[1]) == -1 |
| 86 | + if condition_1 or condition_2 or condition_3: |
| 87 | + H[i_1][i_2] = - s / 4 |
| 88 | + |
| 89 | + tmp = pd.DataFrame([[ls_1, ls_2, l_diff, |
| 90 | + condition_1, condition_2, condition_3]], |
| 91 | + columns = ["(l1, l2)", "(l1', l2')", "(l1-l1', l2-l2')", |
| 92 | + "Condition 1", "Condition 2", "Condition 3" |
| 93 | + ]) |
| 94 | + condition = condition.append(tmp) |
| 95 | + |
| 96 | + E0, P = np.linalg.eig(H) |
| 97 | + rearrangedEvalsVecs = sorted(zip(E0, P.T), key=lambda x: x[0].real, reverse=False) |
| 98 | + |
| 99 | + for i in range(Nsite**2): |
| 100 | + E[i_n, i] = rearrangedEvalsVecs[i][0] |
| 101 | +# P[:, i] = rearrangedEvalsVecs[i][1] |
| 102 | + |
| 103 | + |
| 104 | +q = np.linspace(0, len(n_list), len(n_list)) |
| 105 | +plt.figure(dpi=200) |
| 106 | +plt.plot(q, E[:, 0:4] - E[0, 0]) |
| 107 | +plt.grid(ls=':') |
| 108 | +plt.ylabel('Energy ($E_R$)') |
| 109 | +plt.xticks([0, n_M, n_K, n_Gamma], ['$\Gamma$', 'M', 'K', '$\Gamma$']) # xlocs:位置の配列 xlabels:ラベルの配列 |
0 commit comments