def turn_spinful(h): """Turn a hamiltonian spinful""" from increase_hilbert import spinful if h.has_eh: raise if h.has_spin: return # return if already has spin h.has_spin = True # put spin h.intra = spinful(h.intra) # spinful intra for i in range(len(h.hopping)): h.hopping[i].m = spinful(h.hopping[i].m) # spinful hopping
def ylm2xyz_l1(has_spin=True): """Return the matrix that converts the cartesian into spherical harmonics""" m = angular.ylm2xyz_l1() # return change of bassi matrix if has_spin: from increase_hilbert import spinful m = spinful(m) # with spin degree of freedom return m
def ylm2xyz_l1(): """Return the matrix that converts the cartesian into spherical harmonics""" m = np.matrix([[0.0j for i in range(3)] for j in range(3)]) s2 = np.sqrt(2.) m[1,2] = 1. # pz m[0,0] = 1./s2 # dxz m[2,0] = -1./s2 # dxz m[0,1] = 1j/s2 # dyz m[2,1] = 1j/s2 # dyz from increase_hilbert import spinful m = spinful(m) # with spin degree of freedom return m
def get_atomic_projection(specie,input_file="wannier.win",has_spin=False): """Get the matrix that projects onto a certain atom""" orbs = get_orbitals(specie,input_file=input_file) # read the orbitals nat = get_atoms_specie(specie,input_file=input_file) # number of atoms norb = get_num_wannier(input_file) # number of wannier orbitals proj = np.matrix([[0.0j for i in range(norb)] for j in range(norb)]) for iat in range(nat): # loop over atoms of this type for iorb in orbs: # loop over orbitals i = get_index_orbital(specie,iat+1,iorb) - 1 proj[i,i] = 1.0 # non vanishing if has_spin: from increase_hilbert import spinful return spinful(proj) else: return proj
def ylm2xyz_l2(): """Return the matrix that converts the cartesian into spherical harmonics""" m = np.matrix([[0.0j for i in range(5)] for j in range(5)]) s2 = np.sqrt(2.) m[2, 0] = 1. # dz2 m[1, 1] = 1. / s2 # dxz m[3, 1] = -1. / s2 # dxz m[1, 2] = 1j / s2 # dyz m[3, 2] = 1j / s2 # dyz m[0, 3] = 1j / s2 # dxy m[4, 3] = -1j / s2 # dxy m[0, 4] = 1. / s2 # dx2y2 m[4, 4] = 1. / s2 # dx2y2 # m = m.T # inverse from increase_hilbert import spinful m = spinful(m) # with spin degree of freedom return m # return change of bassi matrix
def ylm2xyz_l2(): """Return the matrix that converts the cartesian into spherical harmonics""" m = np.matrix([[0.0j for i in range(5)] for j in range(5)]) s2 = np.sqrt(2.) m[2,0] = 1. # dz2 m[1,1] = 1./s2 # dxz m[3,1] = -1./s2 # dxz m[1,2] = 1j/s2 # dyz m[3,2] = 1j/s2 # dyz m[0,3] = 1j/s2 # dxy m[4,3] = -1j/s2 # dxy m[0,4] = 1./s2 # dx2y2 m[4,4] = 1./s2 # dx2y2 # m = m.T # inverse from increase_hilbert import spinful m = spinful(m) # with spin degree of freedom return m # return change of bassi matrix
def turn_spinful(self): """Turn the hamiltonian spinful""" from increase_hilbert import spinful if not self.has_spin: self.has_spin = True self.intra = spinful(self.intra) if self.dimensionality==1: self.inter = spinful(self.inter) if self.dimensionality==2: self.tx = spinful(self.tx) self.ty = spinful(self.ty) self.txy = spinful(self.txy) self.txmy = spinful(self.txmy)
def turn_spinful(self): """Turn the hamiltonian spinful""" if self.is_multicell: # if multicell from multicell import turn_spinful as ts ts(self) # turn spinful else: from increase_hilbert import spinful if not self.has_spin: self.has_spin = True self.intra = spinful(self.intra) if self.dimensionality==1: self.inter = spinful(self.inter) if self.dimensionality==2: self.tx = spinful(self.tx) self.ty = spinful(self.ty) self.txy = spinful(self.txy) self.txmy = spinful(self.txmy)
def fun(m): return spinful(m)