def dos(self): energies = self.dos_total['energies'] - self.fermi total = [] for ispin in self.dos_total: if ispin == 'energies': continue total.append(self.dos_total[ispin]) # total = np.array(total).T return DensityOfStates( energies=energies, total=total, projected=self.dos_projected, interpolation_factor=self.dos_interpolation_factor)
def dos_parametric(self, atoms=None, orbitals=None, spin=None, title=None): """ This function sums over the list of atoms and orbitals given for example dos_paramateric(atoms=[0,1,2],orbitals=[1,2,3],spin=[0,1]) will sum all the projections of atoms 0,1,2 and all the orbitals of 1,2,3 (px,py,pz) and return separatly for the 2 spins as a DensityOfStates object from pychemia.visual.DensityofStates :param atoms: list of atom index needed to be sumed over. count from zero with the same order as POSCAR :param orbitals: list of orbitals needed to be sumed over | s || py || pz || px || dxy || dyz || dz2 || dxz ||x2-y2|| | 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || :param spin: which spins to be included. count from 0 There are no sum over spins """ projected = self.dos_projected dos_projected, labelsInfo = self._get_dos_projected() self.availiableOrbitals = list(labelsInfo.keys()) self.availiableOrbitals.pop(0) if atoms == None: atoms = arange(self.nions, dtype=int) if spin == None: spin = [0, 1] if orbitals == None: orbitals = arange((len(projected[0].labels) - 1) // 2, dtype=int) if title == None: title = 'Sum' orbitals = array(orbitals) if len(spin) == 2: labels = ['Energy', 'Spin-Up', 'Spin-Down'] new_orbitals = [] for ispin in spin: new_orbitals.append( list(orbitals + ispin * (len(projected[0].labels) - 1) // 2)) orbitals = new_orbitals else: for x in orbitals: if (x + 1 > (len(projected[0].labels) - 1) // 2): print('listed wrong amount of orbitals') print('Only use one or more of the following ' + str( arange((len(projected[0].labels) - 1) // 2, dtype=int))) print('Only use one or more of the following ' + str( arange((len(projected[0].labels) - 1) // 2, dtype=int))) print('They correspond to the following orbitals : ' + str(self.availiableOrbitals)) print('Again do not trust the plot that was just produced') if spin[0] == 0: labels = ['Energy', 'Spin-Up'] elif spin[0] == 1: labels = ['Energy', 'Spin-Down'] ret = zeros(shape=(len(projected[0].energies), len(spin) + 1)) ret[:, 0] = projected[0].energies for iatom in atoms: if len(spin) == 2: ret[:, 1:] += self.dos_projected[iatom].values[:, orbitals].sum( axis=2) elif len(spin) == 1: ret[:, 1] += self.dos_projected[iatom].values[:, orbitals].sum( axis=1) return DensityOfStates(table=ret, title=title, labels=labels)