def ldos_defect(h,v,e=0.0,delta=0.001,n=1): """Calculates the LDOS of a cell with a defect, writting the n neighring cells""" raise # still not finished import green # number of repetitions rep = 2*n +1 # calculate pristine green function g,selfe = green.supercell_selfenergy(h,e=e,delta=delta,nk=100,nsuper=rep) # now calculate defected green function ez = e + 1j*delta # complex energy emat = np.matrix(np.identity(len(g)))*ez # E +i\delta import supercell pintra = supercell.intra_super2d(h,n=rep) # pristine vintra = supercell.intra_super2d(h,n=rep,central=v) # defective selfe = emat - pintra - g.I # dyson euqation, get selfenergy gv = (emat - vintra -selfe).I # Green function of a vacancy, with selfener return