Esempio n. 1
0
    def model_from_ebands(cls, ebands, tmesh=(0, 300, 600), poorman_polaron=False):
        ebands = ElectronBands.as_ebands(ebands)

        ntemp = len(tmesh)
        nwr = 1000
        wr_step = 0.01

        aw = np.empty((ebands.nsppol, ebands.nkpt, ebands.mband, ntemp, nwr))
        aw_meshes = np.empty((ebands.nsppol, ebands.nkpt, ebands.mband, nwr))
        #aw: [nwr, ntemp, max_nbcalc, nkcalc, nsppol] array
        #aw_meshes: [max_nbcalc, nkcalc, nsppol] array with energy mesh in eV
        from abipy.tools.numtools import lorentzian
        from scipy.integrate import cumtrapz
        for spin in ebands.spins:
            for ik, kpt in enumerate(ebands.kpoints):
                for band in range(ebands.nband_sk[spin, ik]):
                    e0 = ebands.eigens[spin, ik, band]
                    emin = e0 - wr_step * (nwr // 2)
                    emax = e0 + wr_step * (nwr // 2)
                    emesh = np.linspace(emin, emax, num=nwr)
                    aw_meshes[spin, ik, band] = emesh
                    # Naive model: lorentzian centered on KS energy with T-dep broadening
                    for itemp, temp in enumerate(tmesh):
                        width = 0.2 + (temp / 300) * 0.2
                        avals = lorentzian(emesh, width=width, center=e0, height=None)
                        if poorman_polaron:
                            if band in (1, 2, 3) and kpt.norm < 0.3:
                                avals += 1.1 * lorentzian(emesh, width=0.1 * width, center=e0 - 0.4, height=None)
                            avals /= cumtrapz(avals, x=emesh)[-1]
                        aw[spin, ik, band, itemp] = avals

        return cls(ebands, aw, aw_meshes, tmesh)
Esempio n. 2
0
    def model_from_ebands(cls, ebands, tmesh=(0, 300, 600), poorman_polaron=False):
        ebands = ElectronBands.as_ebands(ebands)

        ntemp = len(tmesh)
        nwr =  1000
        wr_step = 0.01

        aw = np.empty((ebands.nsppol, ebands.nkpt, ebands.mband, ntemp, nwr))
        aw_meshes = np.empty((ebands.nsppol, ebands.nkpt, ebands.mband, nwr))
        #aw: [nwr, ntemp, max_nbcalc, nkcalc, nsppol] array
        #aw_meshes: [max_nbcalc, nkcalc, nsppol] array with energy mesh in eV
        from abipy.tools.numtools import lorentzian
        from scipy.integrate import cumtrapz
        for spin in ebands.spins:
            for ik, kpt in enumerate(ebands.kpoints):
                for band in range(ebands.nband_sk[spin, ik]):
                    e0 = ebands.eigens[spin, ik, band]
                    emin = e0 - wr_step * (nwr // 2)
                    emax = e0 + wr_step * (nwr // 2)
                    emesh = np.linspace(emin, emax, num=nwr)
                    aw_meshes[spin, ik, band] = emesh
                    # Naive model: lorentzian centered on KS energy with T-dep broadening
                    for itemp, temp in enumerate(tmesh):
                        width = 0.2 + (temp / 300) * 0.2
                        avals = lorentzian(emesh, width=width, center=e0, height=None)
                        if poorman_polaron:
                            if band in (1, 2, 3) and kpt.norm < 0.3:
                                avals += 1.1 * lorentzian(emesh, width=0.1 * width, center=e0 - 0.4, height=None)
                            avals /= cumtrapz(avals, x=emesh)[-1]
                        aw[spin, ik, band, itemp] = avals

        return cls(ebands, aw, aw_meshes, tmesh)