Beispiel #1
0
def kdos1d_sites(h,
                 sites=[0],
                 scale=10.,
                 nk=100,
                 npol=100,
                 kshift=0.,
                 ewindow=None,
                 info=False):
    """ Calculate kresolved density of states of
  a 1d system for a certain orbitals"""
    if h.dimensionality != 1: raise  # only for 1d
    ks = np.linspace(0., 1., nk)  # number of kpoints
    h.turn_sparse()  # turn the hamiltonian sparse
    hkgen = h.get_hk_gen()  # get generator
    if ewindow is None: xs = np.linspace(-0.9, 0.9, nk)  # x points
    else: xs = np.linspace(-ewindow / scale, ewindow / scale, nk)  # x points
    import kpm
    write_kdos()  # initialize file
    for k in ks:  # loop over kpoints
        mus = np.array([0.0j
                        for i in range(2 * npol)])  # initialize polynomials
        hk = hkgen(k + kshift)  # hamiltonian
        for isite in sites:
            mus += kpm.local_dos(hk / scale, i=isite, n=npol)
        ys = kpm.generate_profile(mus, xs)  # generate the profile
        write_kdos(k, xs * scale, ys, new=False)  # write in file (append)
        if info: print("Done", k)
Beispiel #2
0
def dos0d_sites(h,sites=[0],scale=10.,npol=500,ewindow=None,refine_e=1.0):
  """ Calculate density of states of a 1d system for a certain orbitals"""
  if h.dimensionality!=0: raise # only for 1d
  h.turn_sparse() # turn the hamiltonian sparse
  mus = np.array([0.0j for i in range(2*npol)]) # initialize polynomials
  import kpm
  hk = h.intra # hamiltonian
  for isite in sites:
    mus += kpm.local_dos(hk/scale,i=isite,n=npol)
  if ewindow is None:  xs = np.linspace(-0.9,0.9,int(npol*refine_e)) # x points
  else:  xs = np.linspace(-ewindow/scale,ewindow/scale,npol) # x points
  ys = kpm.generate_profile(mus,xs) # generate the profile
  write_dos(xs*scale,ys) # write in file
Beispiel #3
0
def dos1d_sites(h,sites=[0],scale=10.,nk=100,npol=100,info=False,ewindow=None):
  """ Calculate density of states of a 1d system for a certain orbitals"""
  if h.dimensionality!=1: raise # only for 1d
  ks = np.linspace(0.,1.,nk,endpoint=False) # number of kpoints
  h.turn_sparse() # turn the hamiltonian sparse
  hkgen = h.get_hk_gen() # get generator
  mus = np.array([0.0j for i in range(2*npol)]) # initialize polynomials
  import kpm
  for k in ks: # loop over kpoints
    hk = hkgen(k) # hamiltonian
    for isite in sites:
      mus += kpm.local_dos(hk/scale,i=isite,n=npol)
    if info: print("Done",k)
  mus /= nk # normalize by the number of kpoints
  if ewindow is None:  xs = np.linspace(-0.9,0.9,npol) # x points
  else:  xs = np.linspace(-ewindow/scale,ewindow/scale,npol) # x points
  ys = kpm.generate_profile(mus,xs) # generate the profile
  write_dos(xs*scale,ys) # write in file
Beispiel #4
0
def kdos1d_sites(h,sites=[0],scale=10.,nk=100,npol=100,kshift=0.,
                  ewindow=None,info=False):
  """ Calculate kresolved density of states of
  a 1d system for a certain orbitals"""
  if h.dimensionality!=1: raise # only for 1d
  ks = np.linspace(0.,1.,nk) # number of kpoints
  h.turn_sparse() # turn the hamiltonian sparse
  hkgen = h.get_hk_gen() # get generator
  if ewindow is None:  xs = np.linspace(-0.9,0.9,nk) # x points
  else:  xs = np.linspace(-ewindow/scale,ewindow/scale,nk) # x points
  import kpm
  write_kdos() # initialize file
  for k in ks: # loop over kpoints
    mus = np.array([0.0j for i in range(2*npol)]) # initialize polynomials
    hk = hkgen(k+kshift) # hamiltonian
    for isite in sites:
      mus += kpm.local_dos(hk/scale,i=isite,n=npol)
    ys = kpm.generate_profile(mus,xs) # generate the profile
    write_kdos(k,xs*scale,ys,new=False) # write in file (append)
    if info: print "Done",k
Beispiel #5
0
def dos1d_sites(h,
                sites=[0],
                scale=10.,
                nk=100,
                npol=100,
                info=False,
                ewindow=None):
    """ Calculate density of states of a 1d system for a certain orbitals"""
    if h.dimensionality != 1: raise  # only for 1d
    ks = np.linspace(0., 1., nk, endpoint=False)  # number of kpoints
    h.turn_sparse()  # turn the hamiltonian sparse
    hkgen = h.get_hk_gen()  # get generator
    mus = np.array([0.0j for i in range(2 * npol)])  # initialize polynomials
    import kpm
    for k in ks:  # loop over kpoints
        hk = hkgen(k)  # hamiltonian
        for isite in sites:
            mus += kpm.local_dos(hk / scale, i=isite, n=npol)
        if info: print "Done", k
    mus /= nk  # normalize by the number of kpoints
    if ewindow is None: xs = np.linspace(-0.9, 0.9, npol)  # x points
    else: xs = np.linspace(-ewindow / scale, ewindow / scale, npol)  # x points
    ys = kpm.generate_profile(mus, xs)  # generate the profile
    write_dos(xs * scale, ys)  # write in file