class ReferenceEnergy(API.Analysis): def __init__(self, system, method, ): self.__dos = PDOS(system=system, method=method) self.__fermi = FermiLevel(system=system, method=method) API.Analysis.__init__( self, system=system, method=method, inputs=[self.__dos, self.__fermi], ) def read(self): if not self.isDone(): return None all_ref_indices = [self.system().atoms().tag('Reference').indices()] if isinstance(self.system(), Surface): all_ref_indices.append(self.system().atoms().tag('ReferenceBulk').indices()) zeros = [] for ref_indices in all_ref_indices: values, energies = self.__dos.read(target_indices=ref_indices) E_F = self.__fermi.read() values = values.sum(axis=1) below_fermi = energies < E_F energies = energies[below_fermi] values = values[below_fermi] zero = (energies*values).sum()/values.sum() zeros.append(zero) return zeros
def __init__(self, system, method, ): self.__dos = PDOS(system=system, method=method) self.__fermi = FermiLevel(system=system, method=method) API.Analysis.__init__( self, system=system, method=method, inputs=[self.__dos, self.__fermi], )