def get_wann2csh(nbmax, corbs_list): ''' get transformation from wannier basis to complex spherical harmonics basis. ''' # basis transformation matrix which merges the corelated orbitals # to the first places, followed by the uncorrelated orbitals. ubasis = np.zeros((nbmax, nbmax), dtype=np.complex) # the spin-orbital index remapping accordingly. orbs_map = [] for i, corbs in enumerate(corbs_list): norbs = len(corbs) for j1 in range(norbs): orbs_map.append(corbs[j1]) # appending the uncorrelated orbitals for i in range(nbmax): if i not in orbs_map: orbs_map.append(i) # ubasis: <original basis | correlated orbs-first basis> for i in range(nbmax): ubasis[orbs_map[i], i] = 1. # Unitary transformation from complex Harmonics to wannier. u_csh2wan_list = get_u_csh2wan_all([len(corbs) for corbs in corbs_list]) # get the transformation from wannier basis to correlated # orbital-ordered complex spherical Harmonics basis. u_csh2wan = block_diag(*u_csh2wan_list) ncorbs = u_csh2wan.shape[0] u_wan2csh = ubasis.copy() u_wan2csh[:, :ncorbs] = ubasis[:, :ncorbs].dot(u_csh2wan.T.conj()) return u_wan2csh
def get_h1e_list_wannier(gwannier, corbs_list): # List of one-body parts of Hamiltonian. h1e_list = [[]] for i, corbs in enumerate(corbs_list): norbs = len(corbs) h1e_list[0].append(np.zeros((norbs, norbs), dtype=np.complex)) for j1 in range(norbs): _j1 = corbs[j1] for j2 in range(norbs): _j2 = corbs[j2] h1e_list[0][-1][j1,j2] = gwannier.ham_r[(0,0,0)]["h"][_j1,_j2]\ /float(gwannier.ham_r[(0,0,0)]["deg"]) # Unitary transformation from complex Harmonics to wannier. u_csh2wan_list = get_u_csh2wan_all([len(corbs) for corbs in corbs_list]) for i, u_csh2wan in enumerate(u_csh2wan_list): h1e_list[0][i] = u_csh2wan.dot(h1e_list[0][i]).dot(u_csh2wan.T.conj()) return h1e_list