示例#1
0
def write_surface_2d(h,
                     energies=None,
                     klist=None,
                     delta=0.01,
                     operator=None,
                     hs=None):
    bout = []  # empty list, bulk
    sout = []  # empty list, surface
    if klist is None: klist = np.linspace(-.5, .5, 50)
    if energies is None: energies = np.linspace(-.5, .5, 50)
    fo = open("KDOS.OUT", "w")  # open file
    for k in klist:
        print("Doing k-point", k)
        for energy in energies:
            gs, sf = green.green_kchain(h,
                                        k=k,
                                        energy=energy,
                                        delta=delta,
                                        only_bulk=False,
                                        hs=hs)  # surface green function
            if operator is None:
                op = np.identity(h.intra.shape[0])  # identity matrix
            elif callable(operator):
                op = callable(op)
            else:
                op = operator  # assume a matrix
            db = -(gs * op).trace()[0, 0].imag  # bulk
            ds = -(sf * op).trace()[0, 0].imag  # surface
            fo.write(
                str(k) + "   " + str(energy) + "   " + str(ds) + "   " +
                str(db) + "\n")
            fo.flush()
    fo.close()
示例#2
0
文件: kdos.py 项目: joselado/pygra
def surface(h,energies=None,klist=None,delta=0.01):
  bout = [] # empty list, bulk
  sout = [] # empty list, surface
  for k in klist:
    for energy in energies:
      gs,sf = green.green_kchain(h,k=k,energy=energy,delta=delta,only_bulk=False) 
      bout.append(gs.trace()[0,0].imag) # bulk
      sout.append(sf.trace()[0,0].imag) # surface
  bout = np.array(bout).reshape((len(energies),len(klist))) # convert to array
  sout = np.array(sout).reshape((len(energies),len(klist))) # convert to array
  return (bout.transpose(),sout.transpose())
示例#3
0
文件: kdos.py 项目: joselado/pygra
def write_surface(h,energies=None,klist=None,delta=0.01):
  bout = [] # empty list, bulk
  sout = [] # empty list, surface
  if klist is None: klist = np.linspace(-.5,.5,50)
  if energies is None: klist = np.linspace(-.5,.5,50)
  fo  = open("KDOS.OUT","w") # open file
  for k in klist:
    for energy in energies:
      gs,sf = green.green_kchain(h,k=k,energy=energy,delta=delta,only_bulk=False) 
      db = -gs.trace()[0,0].imag # bulk
      ds = -sf.trace()[0,0].imag # surface
      fo.write(str(k)+"   "+str(energy)+"   "+str(ds)+"   "+str(db)+"\n")
  fo.close()
示例#4
0
文件: kdos.py 项目: restart668/pygra
def surface(h, energies=None, klist=None, delta=0.01):
    bout = []  # empty list, bulk
    sout = []  # empty list, surface
    for k in klist:
        for energy in energies:
            gs, sf = green.green_kchain(h,
                                        k=k,
                                        energy=energy,
                                        delta=delta,
                                        only_bulk=False)
            bout.append(gs.trace()[0, 0].imag)  # bulk
            sout.append(sf.trace()[0, 0].imag)  # surface
    bout = np.array(bout).reshape(
        (len(energies), len(klist)))  # convert to array
    sout = np.array(sout).reshape(
        (len(energies), len(klist)))  # convert to array
    return (bout.transpose(), sout.transpose())
示例#5
0
文件: kdos.py 项目: restart668/pygra
def write_surface(h, energies=None, klist=None, delta=0.01):
    bout = []  # empty list, bulk
    sout = []  # empty list, surface
    if klist is None: klist = np.linspace(-.5, .5, 50)
    if energies is None: klist = np.linspace(-.5, .5, 50)
    fo = open("KDOS.OUT", "w")  # open file
    for k in klist:
        for energy in energies:
            gs, sf = green.green_kchain(h,
                                        k=k,
                                        energy=energy,
                                        delta=delta,
                                        only_bulk=False)
            db = -gs.trace()[0, 0].imag  # bulk
            ds = -sf.trace()[0, 0].imag  # surface
            fo.write(
                str(k) + "   " + str(energy) + "   " + str(ds) + "   " +
                str(db) + "\n")
    fo.close()
示例#6
0
def write_surface_3d(h, energies=None, klist=None, delta=0.01):
    raise  # not implemented
    if h.dimensionality != 3: raise  # only for 3d
    ho = h.copy()  # copy Hamiltonian
    ho = ho.turn_multicell()  # multicell Hamiltonian
    bout = []  # empty list, bulk
    sout = []  # empty list, surface
    if klist is None: raise
    if energies is None: energies = np.linspace(-.5, .5, 50)
    fo = open("KDOS.OUT", "w")  # open file
    for k in klist:
        for energy in energies:
            gs, sf = green.green_kchain(h,
                                        k=k,
                                        energy=energy,
                                        delta=delta,
                                        only_bulk=False)
            db = -gs.trace()[0, 0].imag  # bulk
            ds = -sf.trace()[0, 0].imag  # surface
            fo.write(
                str(k) + "   " + str(energy) + "   " + str(ds) + "   " +
                str(db) + "\n")