Exemplo n.º 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()
Exemplo n.º 2
0
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())
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
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())
Exemplo n.º 5
0
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()
Exemplo n.º 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")