def get_coor_hop(self): ''' Get the site coordinates in hopping space only considering the nearest neighbours hoppings. ''' error_handling.empty_hop(self.hop) visited = np.zeros(self.lat.sites, 'u2') self.coor_hop = np.zeros(self.lat.sites, dtype=[('x','f8'), ('y','f8'), ('tag', 'S1')]) self.coor_hop['tag'] = self.lat.coor['tag'] hop = self.hop[self.hop['n'] == 1] hop_down = np.copy(hop) hop_down['i'] = hop['j'] hop_down['j'] = hop[ 'i'] hop_down['ang'] = -180 + hop['ang'] hop = np.concatenate([hop, hop_down]) i_visit = np.min(hop['i']) while True: hs = hop[hop['i'] == i_visit] for h in hs: if visited[h['j']] == 2: continue self.coor_hop['x'][h['j']] = self.coor_hop['x'][i_visit] + \ h['t'].real*cos(PI / 180 * h['ang']) self.coor_hop['y'][h['j']] = self.coor_hop['y'][i_visit] + \ h['t'].real*sin(PI / 180 * h['ang']) visited[h['j']] = 1 visited[i_visit] = 2 explored = np.argwhere(visited == 1) if not explored.any(): break i_visit = explored[0]
def change_hopping_square(self, list_hop, xlims, ylims=[-1., 1.]): ''' Change hopping values. :param list_hop: List of Dictionary (see set_hopping definition). :param xlims: List or Tuple. :math:`x` interval. :param ylims: List or Tuple. :math:`y` interval. ''' error_handling.empty_hop(self.hop) error_handling.set_hopping(list_hop, self.nmax) ind = self.find_square(xlims, ylims) self.set_new_hopping(list_hop, ind)
def set_hopping_dis(self, alpha): ''' Set uniform hopping disorder. :param alpha: Complex or Real number. Disorder stength. Example usage:: sys.set_hopping_dis(alpha=0.1) ''' error_handling.empty_hop(self.hop) error_handling.number(alpha, 'alpha') self.hop['t'] *= 1. + alpha * rand.uniform(-1., 1., len(self.hop))
def get_ham(self): ''' Get the Tight-Binding Hamiltonian using sys.hop. ''' error_handling.empty_hop(self.hop) error_handling.hop_sites(self.hop, self.lat.sites) if np.all(self.hop['ang'] >= 0) or np.all(self.hop['ang'] < 0): self.ham = sparse.csr_matrix((self.hop['t'], (self.hop['i'], self.hop['j'])), shape=(self.lat.sites, self.lat.sites)) \ + sparse.csr_matrix((self.hop['t'].conj(), (self.hop['j'], self.hop['i'])), shape=(self.lat.sites, self.lat.sites)) else: self.ham = sparse.csr_matrix((self.hop['t'], (self.hop['i'], self.hop['j'])), shape=(self.lat.sites, self.lat.sites)) if self.onsite.size == self.lat.sites: self.ham += sparse.diags(self.onsite, 0)
def change_hopping_ellipse(self, list_hop, rx, ry, x0=0., y0=0.): ''' Change hopping values. :param list_hop: List of Dictionary (see set_hopping definition). :param rx: Positive Float. Radius along :math:`x`. :param ry: Positive Float. Radius along :math:`y`. :param x0: Float. Default value 0. :math:`x` center. :param y0: Float. Default value 0. :math:`y` center. ''' error_handling.empty_hop(self.hop) error_handling.set_hopping(list_hop, self.nmax) error_handling.positive_real(rx, 'rx') error_handling.positive_real(ry, 'rx') error_handling.real_number(x0, 'x0') error_handling.real_number(y0, 'y0') ind = self.find_ellipse(rx, ry, x0, y0) self.set_new_hopping(list_hop, ind)
def set_hopping_def(self, hopping_def): ''' Set specific hoppings. :param hopping_def: Dictionary of hoppings. key: hopping indices, val: hopping values. Example usage:: sys.set_hopping_def({(0, 1): 1., (1, 2): -1j}) ''' error_handling.empty_hop(self.hop) error_handling.set_hopping_def(self.hop, hopping_def, self.lat.sites) for key, val in hopping_def.items(): cond = (self.hop['i'] == key[0]) & (self.hop['j'] == key[1]) self.hop['t'][cond] = val self.hop['ang'] = self.vec_hop['ang'][key[0], key[1]] self.hop['tag'] = npc.add(self.lat.coor['tag'][key[0]], self.lat.coor['tag'][key[1]])