def create_tpp_nn_matrix(VS, tpp_nn_hop_fac): ''' similar to comments in create_tpd_nn_matrix ''' print "start create_tpp_nn_matrix" print "==========================" dim = VS.dim data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # only hole hops with tpd if start_state['type'] == 'no_eh': continue if start_state['type'] == 'one_eh': s1 = start_state['e_spin'] orb1 = start_state['e_orb'] orb2 = start_state['h_orb'] x1, y1, z1 = start_state['e_coord'] x2, y2, z2 = start_state['h_coord'] # hole hops, only p-orbitals has t_pp if orb2 in pam.O_orbs and orb2 not in pam.ap_orbs and orb2 != 'pz1' and orb2 != 'pz2': for dir_ in tpp_nn_hop_dir: vx, vy, vz = directions_to_vecs[dir_] orbs2 = lat.get_unit_cell_rep(x2 + vx, y2 + vy, z2 + vz) if orbs2 != pam.O1_orbs and orbs2 != pam.O2_orbs: continue if not vs.check_in_vs_condition(x1, y1, x2 + vx, y2 + vy): continue for o2 in orbs2: if o2 == 'pz1' or o2 == 'pz2': continue new_state = vs.create_state(s1, orb1, x1, y1, z1, o2, x2 + vx, y2 + vy, z2 + vz) o12 = sorted([orb2, dir_, o2]) o12 = tuple(o12) set_matrix_element(row, col, data, new_state, i, VS, tpp_nn_hop_fac[o12]) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) #assert(check_spin_group(row,col,data,VS)==True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tNdNd_nn_matrix(VS, tNdNd): ''' similar to comments in create_tNdNd_nn_matrix ''' print "start create_tNdNd_nn_matrix" print "============================" dim = VS.dim data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) if start_state['type'] == 'one_eh': se = start_state['e_spin'] orbe = start_state['e_orb'] orbh = start_state['h_orb'] xe, ye, ze = start_state['e_coord'] xh, yh, zh = start_state['h_coord'] # Nd electron hops for dir_ in tNdNd_nn_hop_dir: vx, vy, vz = directions_to_vecs[dir_] orbse = lat.get_unit_cell_rep(xe + vx, ye + vy, ze + vz) if orbse != pam.Nd_orbs: continue if not vs.check_in_vs_condition(xe + vx, ye + vy, xh, yh): continue for oe in orbse: new_state = vs.create_one_eh_state(se, oe, xe + vx, ye + vy, ze + vz, orbh, xh, yh, zh) set_matrix_element(row, col, data, new_state, i, VS, tNdNd) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) #assert(check_spin_group(row,col,data,VS)==True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tpp_nn_matrix(phase, VS, tpp_nn_hop_fac): ''' similar to comments in create_tpd_nn_matrix ''' print "start create_tpp_nn_matrix" print "==========================" dim = VS.dim data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # below check has been done in create_tpd_nn_matrix so here not necessary #assert VS.get_uid(start_state) == VS.lookup_tbl[i] s1 = start_state['hole1_spin'] s2 = start_state['hole2_spin'] orb1 = start_state['hole1_orb'] orb2 = start_state['hole2_orb'] x1, y1 = start_state['hole1_coord'] x2, y2 = start_state['hole2_coord'] # only p-orbitals has t_pp if orb1 in pam.O_orbs: # hole 1 hops (coordninates need to be shifted -> phase change) for dir_ in tpp_nn_hop_dir: vx, vy = directions_to_vecs[dir_] x1_new, y1_new = x1 + vx, y1 + vy # get the position of reference site(Cu) in the same unit cell orbs1_new, Rx_new, Ry_new = lat.get_unit_cell_rep( x1_new, y1_new) if orbs1_new == ['NotOnSublattice' ] or orbs1_new == pam.Cu_orbs: continue x1_shift = x1_new - Rx_new y1_shift = y1_new - Ry_new x2_shift = x2 - Rx_new y2_shift = y2 - Ry_new # consider t_pp for all cases for o1 in orbs1_new: if s1 == s2 and o1 == orb2 and x1_shift == x2_shift and y1_shift == y2_shift: continue #if pam.if_project_out_two_holes_on_different_Cu == 1: # if (o1 in pam.Cu_orbs and orb2 in pam.Cu_orbs and (x1_shift,y1_shift)!=(x2_shift,y2_shift)): # continue if vs.check_in_vs_condition(x1_shift, y1_shift, x2_shift, y2_shift): tmp_state = vs.create_state(s1,o1, x1_shift,y1_shift,\ s2,orb2,x2_shift,y2_shift) new_state, ph = vs.make_state_canonical(tmp_state) o12 = sorted([orb1, dir_, o1]) o12 = tuple(o12) set_matrix_element(row,col,data,new_state,i,VS,\ tpp_nn_hop_fac[o12]*phase[(Rx_new,Ry_new)]*ph) # hole 2 hops, only p-orbitals has t_pp if orb2 in pam.O_orbs: for dir_ in tpp_nn_hop_dir: vx, vy = directions_to_vecs[dir_] x2_new, y2_new = x2 + vx, y2 + vy orbs2_new, _, _ = lat.get_unit_cell_rep(x2_new, y2_new) if orbs2_new == ['NotOnSublattice' ] or orbs2_new == pam.Cu_orbs: continue for o2 in orbs2_new: # consider Pauli principle if s1 == s2 and orb1 == o2 and x1 == x2_new and y1 == y2_new: continue #if pam.if_project_out_two_holes_on_different_Cu == 1: # if (orb1 in pam.Cu_orbs and o2 in pam.Cu_orbs and (x1,y1)!=(x2_new,y2_new)): # continue if vs.check_in_vs_condition(x1, y1, x2_new, y2_new): tmp_state = vs.create_state(s1, orb1, x1, y1, s2, o2, x2_new, y2_new) new_state, ph = vs.make_state_canonical(tmp_state) o12 = sorted([orb2, dir_, o2]) o12 = tuple(o12) set_matrix_element(row, col, data, new_state, i, VS, tpp_nn_hop_fac[o12] * ph) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) assert (check_spin_group(row, col, data, VS) == True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tpd_nn_matrix(phase, VS, tpd_nn_hop_dir, if_tpd_nn_hop, tpd_nn_hop_fac): ''' Create nearest neighbor (NN) pd hopping part of the Hamiltonian Parameters ---------- phase: dictionary containing the phase values exp(-kx*Rx*1j/2.0-ky*Ry*1j/2.0). Created with create_phase_dict. VS: VariationalSpace class from the module variationalSpace Returns ------- matrix: (sps coo format) t_pd hopping part of the Hamiltonian without the prefactor t_pd. Note from the sps documentation ------------------------------- By default when converting to CSR or CSC format, duplicate (i,j) entries will be summed together IMPORTANT ------------------------------- See note_on_set_hopping_term.jpg for how to set up the hopping elements The convention is to assign the phase to hole1 hopping When hole1 hops, there is an additional phase It seems hole2 can hop to another orb, but actually not, j'+n-1=j-n only change hole2's coordinate, not the orb For multiorbital cases, should make sure that hole2 does not change orb ''' print "start create_tpd_nn_matrix" print "==========================" dim = VS.dim tpd_orbs = tpd_nn_hop_fac.keys() data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # double check which cost some time, might not necessary assert VS.get_uid(start_state) == VS.lookup_tbl[i] s1 = start_state['hole1_spin'] s2 = start_state['hole2_spin'] orb1 = start_state['hole1_orb'] orb2 = start_state['hole2_orb'] x1, y1 = start_state['hole1_coord'] x2, y2 = start_state['hole2_coord'] #print s1,s2,orb1,orb2,x1, y1,x2, y2 # some d-orbitals might have no tpd if if_tpd_nn_hop[orb1] == 1: # hole 1 hops (coordninates need to be shifted -> phase change) for dir_ in tpd_nn_hop_dir[orb1]: vx, vy = directions_to_vecs[dir_] # recall that x1, y1 are kept in (1,0), (0,1), (0,0) x1_new, y1_new = x1 + vx, y1 + vy # it is possible that up hole hops to neighboring unit cell # so need to get the position of reference site(Cu) after hopping orb, Rx_new, Ry_new = lat.get_unit_cell_rep(x1_new, y1_new) if orb == ['NotOnSublattice']: continue # get the coordinates relative to the new unit cell origin x1_shift = x1_new - Rx_new y1_shift = y1_new - Ry_new # dn hole needs change coor corresponding to the new unit cell of up hole # but not change orb. see above and note_on_set_hopping_term.jpg x2_shift = x2 - Rx_new y2_shift = y2 - Ry_new orbs1_new, _, _ = lat.get_unit_cell_rep(x1_shift, y1_shift) orbs2_new, _, _ = lat.get_unit_cell_rep(x2_shift, y2_shift) if orbs1_new == ['NotOnSublattice' ] or orbs2_new == ['NotOnSublattice']: continue # consider t_pd for all cases # recall that when up hole hops, dn hole should not change orb for o1 in orbs1_new: if if_tpd_nn_hop[o1] == 0: continue # consider Pauli principle if s1 == s2 and o1 == orb2 and x1_shift == x2_shift and y1_shift == y2_shift: continue #if pam.if_project_out_two_holes_on_different_Cu == 1: # if (o1 in pam.Cu_orbs and orb2 in pam.Cu_orbs and (x1_shift,y1_shift)!=(x2_shift,y2_shift)): # continue if vs.check_in_vs_condition(x1_shift, y1_shift, x2_shift, y2_shift): tmp_state = vs.create_state(s1,o1, x1_shift,y1_shift,\ s2,orb2,x2_shift,y2_shift) new_state, ph = vs.make_state_canonical(tmp_state) o12 = tuple([orb1, dir_, o1]) if o12 in tpd_orbs: set_matrix_element(row,col,data,new_state,i,VS,\ tpd_nn_hop_fac[o12]*phase[(Rx_new,Ry_new)]*ph) # hole 2 hops; some d-orbitals might have no tpd if if_tpd_nn_hop[orb2] == 1: for dir_ in tpd_nn_hop_dir[orb2]: vx, vy = directions_to_vecs[dir_] x2_new, y2_new = x2 + vx, y2 + vy orbs2_new, _, _ = lat.get_unit_cell_rep(x2_new, y2_new) if orbs2_new == ['NotOnSublattice']: continue for o2 in orbs2_new: if if_tpd_nn_hop[o2] == 0: continue # consider Pauli principle if s1 == s2 and orb1 == o2 and x1 == x2_new and y1 == y2_new: continue #if pam.if_project_out_two_holes_on_different_Cu == 1: # if (orb1 in pam.Cu_orbs and o2 in pam.Cu_orbs and (x1,y1)!=(x2_new,y2_new)): # continue if vs.check_in_vs_condition(x1, y1, x2_new, y2_new): tmp_state = vs.create_state(s1, orb1, x1, y1, s2, o2, x2_new, y2_new) new_state, ph = vs.make_state_canonical(tmp_state) o12 = tuple([orb2, dir_, o2]) if o12 in tpd_orbs: set_matrix_element(row, col, data, new_state, i, VS, tpd_nn_hop_fac[o12] * ph) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) assert (check_spin_group(row, col, data, VS) == True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tpp_nn_matrix(VS, tpp_nn_hop_fac): ''' similar to comments in create_tpd_nn_matrix ''' print "start create_tpp_nn_matrix" print "==========================" dim = VS.dim data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # below check has been done in create_tpd_nn_matrix so here not necessary #assert VS.get_uid(start_state) == VS.lookup_tbl[i] s1 = start_state['hole1_spin'] s2 = start_state['hole2_spin'] orb1 = start_state['hole1_orb'] orb2 = start_state['hole2_orb'] x1, y1 = start_state['hole1_coord'] x2, y2 = start_state['hole2_coord'] # hole1 hops: only p-orbitals has t_pp if orb1 in pam.O_orbs: for dir_ in tpp_nn_hop_dir: vx, vy = directions_to_vecs[dir_] orbs1 = lat.get_unit_cell_rep(x1 + vx, y1 + vy) if orbs1 == ['NotOnSublattice'] or orbs1 == pam.Cu_orbs: continue # consider t_pd for all cases; when up hole hops, dn hole should not change orb for o1 in orbs1: # consider Pauli principle if s1 == s2 and o1 == orb2 and (x1 + vx, y1 + vy) == (x2, y2): continue if vs.check_in_vs_condition(x1 + vx, y1 + vy, x2, y2): tmp_state = vs.create_state(s1, o1, x1 + vx, y1 + vy, s2, orb2, x2, y2) new_state, ph = vs.make_state_canonical(tmp_state) s1n = new_state['hole1_spin'] s2n = new_state['hole2_spin'] orb1n = new_state['hole1_orb'] orb2n = new_state['hole2_orb'] x1n, y1n = new_state['hole1_coord'] x2n, y2n = new_state['hole2_coord'] #print x1,y1,orb1,s1,x2,y2,orb2,s2,'tpp hops to',x1n, y1n,orb1n,s1n,x2n, y2n,orb2n,s2n o12 = sorted([orb1, dir_, o1]) o12 = tuple(o12) set_matrix_element(row, col, data, new_state, i, VS, tpp_nn_hop_fac[o12] * ph) # hole 2 hops, only p-orbitals has t_pp if orb2 in pam.O_orbs: for dir_ in tpp_nn_hop_dir: vx, vy = directions_to_vecs[dir_] orbs2 = lat.get_unit_cell_rep(x2 + vx, y2 + vy) if orbs2 == ['NotOnSublattice'] or orbs2 == pam.Cu_orbs: continue for o2 in orbs2: # consider Pauli principle if s1 == s2 and orb1 == o2 and (x1, y1) == (x2 + vx, y2 + vy): continue if vs.check_in_vs_condition(x1, y1, x2 + vx, y2 + vy): tmp_state = vs.create_state(s1, orb1, x1, y1, s2, o2, x2 + vx, y2 + vy) new_state, ph = vs.make_state_canonical(tmp_state) s1n = new_state['hole1_spin'] s2n = new_state['hole2_spin'] orb1n = new_state['hole1_orb'] orb2n = new_state['hole2_orb'] x1n, y1n = new_state['hole1_coord'] x2n, y2n = new_state['hole2_coord'] #print x1,y1,orb1,s1,x2,y2,orb2,s2,'tpp hops to',x1n, y1n,orb1n,s1n,x2n, y2n,orb2n,s2n o12 = sorted([orb2, dir_, o2]) o12 = tuple(o12) set_matrix_element(row, col, data, new_state, i, VS, tpp_nn_hop_fac[o12] * ph) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) assert (check_spin_group(row, col, data, VS) == True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tpd_nn_matrix(VS, tpd_nn_hop_dir, if_tpd_nn_hop, tpd_nn_hop_fac): ''' Create nearest neighbor (NN) pd hopping part of the Hamiltonian Parameters ---------- VS: VariationalSpace class from the module variationalSpace Returns ------- matrix: (sps coo format) t_pd hopping part of the Hamiltonian without the prefactor t_pd. Note from the sps documentation ------------------------------- By default when converting to CSR or CSC format, duplicate (i,j) entries will be summed together ''' print "start create_tpd_nn_matrix" print "==========================" dim = VS.dim tpd_orbs = tpd_nn_hop_fac.keys() data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # double check which cost some time, might not necessary assert VS.get_uid(start_state) == VS.lookup_tbl[i] s1 = start_state['hole1_spin'] s2 = start_state['hole2_spin'] orb1 = start_state['hole1_orb'] orb2 = start_state['hole2_orb'] x1, y1 = start_state['hole1_coord'] x2, y2 = start_state['hole2_coord'] # hole 1 hops: some d-orbitals might have no tpd if if_tpd_nn_hop[orb1] == 1: for dir_ in tpd_nn_hop_dir[orb1]: vx, vy = directions_to_vecs[dir_] orbs1 = lat.get_unit_cell_rep(x1 + vx, y1 + vy) if orbs1 == ['NotOnSublattice']: continue # consider t_pd for all cases; when up hole hops, dn hole should not change orb for o1 in orbs1: if if_tpd_nn_hop[o1] == 0: continue # consider Pauli principle if s1 == s2 and o1 == orb2 and (x1 + vx, y1 + vy) == (x2, y2): continue if vs.check_in_vs_condition(x1 + vx, y1 + vy, x2, y2): tmp_state = vs.create_state(s1, o1, x1 + vx, y1 + vy, s2, orb2, x2, y2) new_state, ph = vs.make_state_canonical(tmp_state) s1n = new_state['hole1_spin'] s2n = new_state['hole2_spin'] orb1n = new_state['hole1_orb'] orb2n = new_state['hole2_orb'] x1n, y1n = new_state['hole1_coord'] x2n, y2n = new_state['hole2_coord'] # print x1,y1,orb1,s1,x2,y2,orb2,s2,'tpd hops to',x1n, y1n,orb1n,s1n,x2n, y2n,orb2n,s2n o12 = tuple([orb1, dir_, o1]) if o12 in tpd_orbs: set_matrix_element(row, col, data, new_state, i, VS, tpd_nn_hop_fac[o12] * ph) # hole 2 hops; some d-orbitals might have no tpd if if_tpd_nn_hop[orb2] == 1: for dir_ in tpd_nn_hop_dir[orb2]: vx, vy = directions_to_vecs[dir_] orbs2 = lat.get_unit_cell_rep(x2 + vx, y2 + vy) if orbs2 == ['NotOnSublattice']: continue for o2 in orbs2: if if_tpd_nn_hop[o2] == 0: continue # consider Pauli principle if s1 == s2 and orb1 == o2 and (x1, y1) == (x2 + vx, y2 + vy): continue if vs.check_in_vs_condition(x1, y1, x2 + vx, y2 + vy): tmp_state = vs.create_state(s1, orb1, x1, y1, s2, o2, x2 + vx, y2 + vy) new_state, ph = vs.make_state_canonical(tmp_state) s1n = new_state['hole1_spin'] s2n = new_state['hole2_spin'] orb1n = new_state['hole1_orb'] orb2n = new_state['hole2_orb'] x1n, y1n = new_state['hole1_coord'] x2n, y2n = new_state['hole2_coord'] #print x1,y1,orb1,s1,x2,y2,orb2,s2,'tpd hops to',x1n, y1n,orb1n,s1n,x2n, y2n,orb2n,s2n o12 = tuple([orb2, dir_, o2]) if o12 in tpd_orbs: set_matrix_element(row, col, data, new_state, i, VS, tpd_nn_hop_fac[o12] * ph) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) assert (check_spin_group(row, col, data, VS) == True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out
def create_tpd_nn_matrix(VS, tpd_nn_hop_dir, if_tpd_nn_hop, tpd_nn_hop_fac): ''' Create nearest neighbor (NN) pd hopping part of the Hamiltonian Only hole can hop with tpd Parameters ---------- VS: VariationalSpace class from the module variationalSpace Returns ------- matrix: (sps coo format) t_pd hopping part of the Hamiltonian without the prefactor t_pd. Note from the sps documentation ------------------------------- By default when converting to CSR or CSC format, duplicate (i,j) entries will be summed together ''' print "start create_tpd_nn_matrix" print "==========================" dim = VS.dim tpd_orbs = tpd_nn_hop_fac.keys() data = [] row = [] col = [] for i in xrange(0, dim): start_state = VS.get_state(VS.lookup_tbl[i]) # double check which cost some time, might not necessary assert VS.get_uid(start_state) == VS.lookup_tbl[i] # only hole hops with tpd if start_state['type'] == 'no_eh': continue if start_state['type'] == 'one_eh': s1 = start_state['e_spin'] orb1 = start_state['e_orb'] orb2 = start_state['h_orb'] x1, y1, z1 = start_state['e_coord'] x2, y2, z2 = start_state['h_coord'] # hole hops; some d-orbitals might have no tpd if if_tpd_nn_hop[orb2] == 1: for dir_ in tpd_nn_hop_dir[orb2]: vx, vy, vz = directions_to_vecs[dir_] orbs2 = lat.get_unit_cell_rep(x2 + vx, y2 + vy, z2 + vz) if orbs2 == ['NotOnSublattice'] or orbs2 == pam.Nd_orbs: continue if not vs.check_in_vs_condition(x1, y1, x2 + vx, y2 + vy): continue for o2 in orbs2: if if_tpd_nn_hop[o2] == 0: continue new_state = vs.create_one_eh_state( s1, orb1, x1, y1, z1, o2, x2 + vx, y2 + vy, z2 + vz) o12 = tuple([orb2, dir_, o2]) if o12 in tpd_orbs: set_matrix_element(row, col, data, new_state, i, VS, tpd_nn_hop_fac[o12]) row = np.array(row) col = np.array(col) data = np.array(data) # check if hoppings occur within groups of (up,up), (dn,dn), and (up,dn) #assert(check_spin_group(row,col,data,VS)==True) out = sps.coo_matrix((data, (row, col)), shape=(dim, dim)) return out