def z2_invariant(h,nk=100): """Calculates the Z2 invariant by the path evolution algorithm""" import klist kst = klist.tr_klist(nk=nk) # class with the klist wfs1 = [occ_states2d(h,k) for k in kst.path1] # lower path wfs2 = [occ_states2d(h,k) for k in kst.path2] # lower path wfsc1 = [occ_states2d(h,k) for k in kst.common] # lower path # related with the other by symmetry wfsc2 = [wfsc1[-i] for i in range(len(wfsc1))] # invert the order wfs = wfs1 + wfsc1 + wfs2 + wfsc2 # all the paths phi = 0.0 # initialize phase # connection contribution for i in range(len(wfs)): m = uij(wfs[i-1],wfs[i]) # matrix of wavefunctions d = lg.det(m) # calculate determinant phi += np.arctan2(d.imag,d.real) # add contribution phi = phi/(2.*np.pi) # curvature contribution halfc = 0.0 for ik in np.linspace(-.5,.5,nk): for jk in np.linspace(-.0,.5,nk/2): halfc += berry_curvature(h,np.array([ik,jk])) halfc = halfc/(2.*np.pi*nk*nk) print halfc,phi return phi-halfc
def z2_invariant(h, nk=100): """Calculates the Z2 invariant by the path evolution algorithm""" import klist kst = klist.tr_klist(nk=nk) # class with the klist wfs1 = [occ_states2d(h, k) for k in kst.path1] # lower path wfs2 = [occ_states2d(h, k) for k in kst.path2] # lower path wfsc1 = [occ_states2d(h, k) for k in kst.common] # lower path # related with the other by symmetry wfsc2 = [wfsc1[-i] for i in range(len(wfsc1))] # invert the order wfs = wfs1 + wfsc1 + wfs2 + wfsc2 # all the paths phi = 0.0 # initialize phase # connection contribution for i in range(len(wfs)): m = uij(wfs[i - 1], wfs[i]) # matrix of wavefunctions d = lg.det(m) # calculate determinant phi += np.arctan2(d.imag, d.real) # add contribution phi = phi / (2. * np.pi) # curvature contribution halfc = 0.0 for ik in np.linspace(-.5, .5, nk): for jk in np.linspace(-.0, .5, nk / 2): halfc += berry_curvature(h, np.array([ik, jk])) halfc = halfc / (2. * np.pi * nk * nk) print halfc, phi return phi - halfc