def get_partial_doses(self, tdos, eband_ud, spins, enr, npts_mu, T, progress): """ Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos progress: Default False, If True a progress bar is shown. """ if not self.data.proj: raise BoltztrapError("No projections loaded.") bkp_data_ebands = np.copy(self.data.ebands) pdoss = {} if progress: n_iter = np.prod( np.sum( [np.array(i.shape)[2:] for i in self.data.proj.values()])) t = tqdm(total=n_iter * 2) for spin, eb in zip(spins, eband_ud): for isite, site in enumerate(self.data.structure.sites): if site not in pdoss: pdoss[site] = {} for iorb, orb in enumerate(Orbital): if progress: t.update() if iorb == self.data.proj[spin].shape[-1]: break if orb not in pdoss[site]: pdoss[site][orb] = {} self.data.ebands = self.data.proj[spin][:, :, isite, iorb].T coeffs = fite.fitde3D(self.data, self.equivalences) proj, vvproj, cproj = fite.getBTPbands( self.equivalences, coeffs, self.data.lattvec) edos, pdos = BL.DOS(eb, npts=npts_mu, weights=np.abs(proj.real), erange=enr) if T: pdos = BL.smoothen_DOS(edos, pdos, T) pdoss[site][orb][spin] = pdos self.data.ebands = bkp_data_ebands return CompleteDos(self.data.structure, total_dos=tdos, pdoss=pdoss)
def get_partial_doses(self, tdos, npts_mu, T): """ Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos """ spin = self.data.spin if isinstance(self.data.spin, int) else 1 if not isinstance(self.data.proj, np.ndarray): raise BoltztrapError("No projections loaded.") bkp_data_ebands = np.copy(self.data.ebands) pdoss = {} # for spin in self.data.proj: for isite, site in enumerate(self.data.structure.sites): if site not in pdoss: pdoss[site] = {} for iorb, orb in enumerate(Orbital): if iorb == self.data.proj.shape[-1]: break if orb not in pdoss[site]: pdoss[site][orb] = {} self.data.ebands = self.data.proj[:, :, isite, iorb].T coeffs = fite.fitde3D(self.data, self.equivalences) proj, vvproj, cproj = fite.getBTPbands(self.equivalences, coeffs, self.data.lattvec) edos, pdos = BL.DOS(self.eband, npts=npts_mu, weights=np.abs(proj.real)) if T is not None: pdos = BL.smoothen_DOS(edos, pdos, T) pdoss[site][orb][Spin(spin)] = pdos self.data.ebands = bkp_data_ebands return CompleteDos(self.data.structure, total_dos=tdos, pdoss=pdoss)