Esempio n. 1
0
def dos1d_ewindow(h,
                  energies=np.linspace(-1., 1., 30),
                  delta=None,
                  info=False,
                  use_green=True,
                  nk=300):
    """Calculate the density of states in certain eenrgy window"""
    ys = []  # density of states
    if delta is None:  # pick a good delta value
        delta = 0.1 * (max(energies) - min(energies)) / len(energies)
    if True:  # do not use green function
        from dosf90 import calculate_dos  # import fortran library
        import scipy.linalg as lg
        kxs = np.linspace(0., 1., nk)
        hkgen = h.get_hk_gen()  # get hamiltonian generator
        ys = energies * 0.
        weight = 1. / (nk)
        for ix in kxs:
            hk = hkgen(ix)  # get hk hamiltonian
            evals = lg.eigvalsh(hk)  # get eigenvalues
            ys += weight * calculate_dos(evals, energies,
                                         delta)  # add this contribution
        if info: print("Done", ix)
        write_dos(energies, ys)  # write in file
        return
Esempio n. 2
0
def dos2d_ewindow(h,energies=np.linspace(-1.,1.,30),delta=None,info=False,
                    use_green=True,nk=300,mode="adaptive"):
  """Calculate the density of states in certain eenrgy window"""
  ys = [] # density of states
  if delta is None: # pick a good delta value
    delta = 0.1*(max(energies) - min(energies))/len(energies)
  if use_green:
    from green import bloch_selfenergy
    for energy in energies:
      (g,selfe) = bloch_selfenergy(h,nk=nk,energy=energy, delta=delta,
                   mode=mode)
      ys.append(-g.trace()[0,0].imag)
      if info: print("Done",energy)
    write_dos(energies,ys) # write in file
    return
  else: # do not use green function    
    from dosf90 import calculate_dos # import fortran library
    import scipy.linalg as lg
    kxs = np.linspace(0.,1.,nk)
    kys = np.linspace(0.,1.,nk)
    hkgen= h.get_hk_gen() # get hamiltonian generator
    ys = energies*0.
    weight = 1./(nk*nk)
    for ix in kxs:
      for iy in kys:
        k = np.array([ix,iy,0.]) # create kpoint
        hk = hkgen(k) # get hk hamiltonian
        evals = lg.eigvalsh(hk) # get eigenvalues
        ys += weight*calculate_dos(evals,energies,delta) # add this contribution
      if info: print("Done",ix)
    write_dos(energies,ys) # write in file
    return
Esempio n. 3
0
def dos1d_ewindow(h,energies=np.linspace(-1.,1.,30),delta=None,info=False,
                    use_green=True,nk=300):
  """Calculate the density of states in certain energy window"""
  ys = [] # density of states
  if delta is None: # pick a good delta value
    delta = 0.1*(max(energies) - min(energies))/len(energies)
  if True: # do not use green function    
    from dosf90 import calculate_dos # import fortran library
    import scipy.linalg as lg
    kxs = np.linspace(0.,1.,nk)
    hkgen= h.get_hk_gen() # get hamiltonian generator
    ys = energies*0.
    weight = 1./(nk)
    for ix in kxs:
      hk = hkgen(ix) # get hk hamiltonian
      evals = lg.eigvalsh(hk) # get eigenvalues
      ys += weight*calculate_dos(evals,energies,delta) # add this contribution
    if info: print("Done",ix)
    write_dos(energies,ys) # write in file
    return