def TightBinding(kpoints, model="Model1", return_vectors=True, **model_params): actual_model_params = dict(DEFAULT_MODEL_PARAMETERS) actual_model_params.update(model_params) t0 = actual_model_params["t0"] t1 = actual_model_params["t1"] cell = Lattice(points=POINTS, vectors=VECTORS) ids = [[0, 0], [1, -1], [0, -1], [-1, 0], [-1, 1], [0, 1], [1, 0]] points_collection = np.concatenate( [np.dot([i, j], VECTORS) + POINTS for i, j in ids]) inter_hopping_indices = [ [5, 83], [5, 82], [6, 82], [6, 81], [6, 63], [7, 63], [7, 71], [8, 71], [8, 53], [8, 52], [9, 52], [9, 51], ] if model == "Model1": intra_hopping_indices0 = [[0, 4], [4, 5], [1, 7], [7, 8], [2, 10], [10, 11]] intra_hopping_indices1 = [ [0, 1], [1, 2], [2, 0], [0, 3], [0, 10], [0, 11], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 4], [3, 11], [6, 5], [6, 7], [9, 8], [9, 10], ] else: intra_hopping_indices0 = [ [0, 4], [4, 5], [5, 6], [1, 7], [7, 8], [8, 9], [2, 10], [10, 11], [11, 3], ] intra_hopping_indices1 = [ [0, 1], [1, 2], [2, 0], [0, 3], [0, 10], [0, 11], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 4], [6, 7], [9, 10], ] terms = [] for coeff, hopping_indices in [ (t0, intra_hopping_indices0), (t1, intra_hopping_indices1), (t1, inter_hopping_indices), ]: for ij in hopping_indices: p0, p1 = points_collection[ij] p0_eqv, dR0 = cell.decompose(p0) p1_eqv, dR1 = cell.decompose(p1) index0 = cell.getIndex(p0_eqv, fold=False) index1 = cell.getIndex(p1_eqv, fold=False) terms.append((index0, index1, coeff, dR0 - dR1)) site_num = cell.point_num kpoint_num = kpoints.shape[0] HMs = np.zeros((kpoint_num, site_num, site_num), dtype=np.complex128) for i, j, coeff, dR in terms: HMs[:, i, j] += coeff * np.exp(1j * np.matmul(kpoints, dR)) HMs += np.transpose(HMs, (0, 2, 1)).conj() if return_vectors: return np.linalg.eigh(HMs) else: return np.linalg.eigvalsh(HMs)
dtype=np.float64) VECTORS = np.array([[4.0, 0.0], [2.0, 2 * SQRT3]], dtype=np.float64) t0 = 0.0 t1 = -1.00 t2 = -0.25 id = "t0={0:.2f}_t1={1:.2f}_t2={2:.2f}".format(t0, t1, t2) cluster = Lattice(POINTS, VECTORS) intra_bonds_1st, inter_bonds_1st = cluster.bonds(nth=1) intra_bonds_2nd, inter_bonds_2nd = cluster.bonds(nth=2) intra_bonds_6th, inter_bonds_6th = cluster.bonds(nth=6) HTerms = [] for bond in intra_bonds_1st + inter_bonds_1st: p0, p1 = bond.endpoints p0_eqv, dR0 = cluster.decompose(p0) p1_eqv, dR1 = cluster.decompose(p1) index0 = cluster.getIndex(p0_eqv) index1 = cluster.getIndex(p1_eqv) HTerms.append((index0, index1, t0, dR0 - dR1)) for bond in intra_bonds_2nd + inter_bonds_2nd: p0, p1 = bond.endpoints p0_eqv, dR0 = cluster.decompose(p0) p1_eqv, dR1 = cluster.decompose(p1) index0 = cluster.getIndex(p0_eqv) index1 = cluster.getIndex(p1_eqv) HTerms.append((index0, index1, t1, dR0 - dR1)) for bond in intra_bonds_6th + inter_bonds_6th: p0, p1 = bond.endpoints
def TightBinding(kpoints, model="Model1", return_vectors=True, **model_params): actual_model_params = dict(DEFAULT_MODEL_PARAMETERS) actual_model_params.update(model_params) t0 = actual_model_params["t0"] t1 = actual_model_params["t1"] mu0 = actual_model_params["mu0"] / 2 mu1 = actual_model_params["mu1"] / 2 ids = ([0, 0], [-1, 0], [1, 0], [0, -1], [0, 1]) cell = Lattice(ALL_POINTS[0:20], TRANSLATION_VECTORS) points_collection = np.concatenate( [np.dot(ij, TRANSLATION_VECTORS) + ALL_POINTS[0:20] for ij in ids] ) intra_hopping_indices0 = [ [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 19], ] intra_hopping_indices1 = [ [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 11], [6, 11] ] inter_hopping_indices = [[3, 37], [9, 74]] if model == "Model2": intra_hopping_indices1 += [[6, 12], [6, 19], [5, 11], [7, 11]] inter_hopping_indices += [ [3, 36], [3, 38], [2, 37], [4, 37], [9, 73], [9, 75], [1, 74], [8, 74], ] terms = [] zero_dr = np.array([0.0, 0.0], dtype=np.float64) for point in cell.points: index = cell.getIndex(point, fold=False) mu = mu0 if index in (0, 10) else mu1 terms.append((2 * index, 2 * index, mu, zero_dr)) terms.append((2 * index + 1, 2 * index + 1, mu, zero_dr)) for t, ijs in [(t0, intra_hopping_indices0), (t1, intra_hopping_indices1)]: for ij in ijs: p0, p1 = points_collection[ij] coeff = t / np.dot(p1 - p0, p1 - p0) index0 = cell.getIndex(p0, fold=False) index1 = cell.getIndex(p1, fold=False) terms.append((2 * index0, 2 * index1, coeff, zero_dr)) terms.append((2 * index0 + 1, 2 * index1 + 1, coeff, zero_dr)) for ij in inter_hopping_indices: p0, p1 = points_collection[ij] coeff = t1 / np.dot(p1 - p0, p1 - p0) p0_eqv, dR0 = cell.decompose(p0) p1_eqv, dR1 = cell.decompose(p1) index0 = cell.getIndex(p0_eqv, fold=False) index1 = cell.getIndex(p1_eqv, fold=False) terms.append((2 * index0, 2 * index1, coeff, dR1 - dR0)) terms.append((2 * index0 + 1, 2 * index1 + 1, coeff, dR1 - dR0)) # msg = "({0:2d},{1:2d}), t={2:.8f}, dR=({3:.8f}, {4:.8f})" # print("Hamiltonian Terms:") # for i, j, coeff, dR in terms: # print(msg.format(i, j, coeff, dR[0], dR[1])) point_num = cell.point_num shape = (kpoints.shape[0], 2 * point_num, 2 * point_num) HMs = np.zeros(shape, dtype=np.complex128) for i, j, coeff, dR in terms: HMs[:, i, j] += coeff * np.exp(1j * np.matmul(kpoints, dR)) HMs += np.transpose(HMs, (0, 2, 1)).conj() if return_vectors: return np.linalg.eigh(HMs) else: return np.linalg.eigvalsh(HMs)