def get_orbital_ldos(self, a, spin=0, angular='spdf', npts=201, width=None): """The Local Density of States, using atomic orbital basis functions. Project wave functions onto an atom orbital at atom ``a``, and use this as weight when summing the eigenvalues. The atomic orbital has angular momentum ``angular``, which can be 's', 'p', 'd', 'f', or any combination (e.g. 'sdf'). An integer value for ``angular`` can also be used to specify a specific projector function to project onto. """ if width is None: width = self.get_electronic_temperature() if width == 0.0: width = 0.1 from gpaw.utilities.dos import raw_orbital_LDOS, fold energies, weights = raw_orbital_LDOS(self, a, spin, angular) return fold(energies * Hartree, weights, npts, width)
def get_orbital_ldos(self, a, spin=0, angular='spdf', npts=201, width=None, nbands=None, spinorbit=False): """The Local Density of States, using atomic orbital basis functions. Project wave functions onto an atom orbital at atom ``a``, and use this as weight when summing the eigenvalues. The atomic orbital has angular momentum ``angular``, which can be 's', 'p', 'd', 'f', or any combination (e.g. 'sdf'). An integer value for ``angular`` can also be used to specify a specific projector function to project onto. Setting nbands limits the number of bands included. This speeds up the calculation if one has many bands in the calculator but is only interested in the DOS at low energies. """ from gpaw.utilities.dos import (raw_orbital_LDOS, raw_spinorbit_orbital_LDOS, fold) if width is None: width = 0.1 if not spinorbit: energies, weights = raw_orbital_LDOS(self, a, spin, angular, nbands) else: energies, weights = raw_spinorbit_orbital_LDOS( self, a, spin, angular) return fold(energies * Ha, weights, npts, width)
def ldos(calc, a, spin, l, width, energies): eigs, weights = raw_orbital_LDOS(calc, a, spin, l) eigs *= Ha eigs -= calc.get_fermi_level() if width > 0.0: dos = 0.0 for e, w in zip(eigs, weights): dos += w * delta(energies, e, width) else: kd = calc.wfs.kd eigs.shape = (kd.nibzkpts, -1) eigs = eigs[kd.bz2ibz_k] eigs.shape = tuple(kd.N_c) + (-1,) weights.shape = (kd.nibzkpts, -1) weights /= kd.weight_k[:, np.newaxis] w = weights[kd.bz2ibz_k] w.shape = tuple(kd.N_c) + (-1,) dos = ltidos(calc.atoms.cell, eigs, energies, w) return dos
Hnospin = Atoms([Atom('H')], cell=[5, 5, 5], pbc=False) Hspin = Atoms([Atom('H', magmom=1)], cell=[5, 5, 5], pbc=False) LiH = Atoms([Atom('Li', [.0, .0, .41]), Atom('H', [.0, .0, -1.23])]) Hnospin.center() Hspin.center() LiH.center(vacuum=3.0) # This is needed for the Wigner-Seitz test to give # architecture-independent results: LiH.translate(0.003234) calc = GPAW(gpts=(24, 24, 24), communicator=comm) Hnospin.set_calculator(calc) e_Hnospin = Hnospin.get_potential_energy() niter_Hnospin = calc.get_number_of_iterations() energies, sweight = raw_orbital_LDOS(calc, a=0, spin=0, angular='s') energies, pdfweight = raw_orbital_LDOS(calc, a=0, spin=0, angular='pdf') calc = GPAW(gpts=(24, 24, 24), occupations=FermiDirac(width=0, fixmagmom=True), hund=True, communicator=comm) Hspin.set_calculator(calc) e_Hspin = Hspin.get_potential_energy() niter_Hspin = calc.get_number_of_iterations() energies, sweight_spin = raw_orbital_LDOS(calc, a=0, spin=0, angular='s') calc = GPAW( gpts=(32, 32, 40), nbands=2, #eigensolver='dav', communicator=comm)
Hspin = Atoms([Atom('H', magmom=1)], cell=[5, 5, 5], pbc=False) LiH = Atoms([Atom('Li', [.0, .0, .41]), Atom('H', [.0, .0, -1.23])]) Hnospin.center() Hspin.center() LiH.center(vacuum=3.0) # This is needed for the Wigner-Seitz test to give # architecture-independent results: LiH.translate(0.003234) calc = GPAW(gpts=(24, 24, 24), communicator=comm) Hnospin.set_calculator(calc) e_Hnospin = Hnospin.get_potential_energy() niter_Hnospin = calc.get_number_of_iterations() energies, sweight = raw_orbital_LDOS(calc, a=0, spin=0, angular='s') energies, pdfweight = raw_orbital_LDOS(calc, a=0, spin=0, angular='pdf') calc = GPAW(gpts=(24, 24, 24), occupations=FermiDirac(width=0, fixmagmom=True), hund=True, communicator=comm) Hspin.set_calculator(calc) e_Hspin = Hspin.get_potential_energy() niter_Hspin = calc.get_number_of_iterations() energies,sweight_spin = raw_orbital_LDOS(calc, a=0, spin=0, angular='s') calc = GPAW(gpts=(32, 32, 40), nbands=2, #eigensolver='dav', communicator=comm) LiH.set_calculator(calc) e_LiH = LiH.get_potential_energy() niter_LiH = calc.get_number_of_iterations() energies, Li_orbitalweight = raw_orbital_LDOS(calc, a=0, spin=0, angular=None)