def __init__(self, calculator): self.calculator = calculator State.__init__(self, calculator.gd) self.pw = PlaneWave(self.gd) # get effective potential hamiltonian = self.calculator.hamiltonian if 1: self.vt_G = hamiltonian.vt_sG[0] # XXX treat spin else: self.vt_G = np.where(hamiltonian.vt_sG[0] > 0, 0.0, hamiltonian.vt_sG[0]) self.intvt = self.gd.integrate(self.vt_G) print('# int(vt_G)=', self.intvt, np.sometrue(self.vt_G > 0)) self.solve()
def __init__(self, calculator): self.calculator = calculator State.__init__(self, calculator.gd) self.pw = PlaneWave(self.gd) # get effective potential hamiltonian = self.calculator.hamiltonian if 1: self.vt_G = hamiltonian.vt_sG[0] # XXX treat spin else: self.vt_G = np.where(hamiltonian.vt_sG[0] > 0, 0.0, hamiltonian.vt_sG[0]) self.intvt = self.gd.integrate(self.vt_G) print "# int(vt_G)=", self.intvt, np.sometrue(self.vt_G > 0) self.solve()
def Dyson_orbital(self, I): """Return the Dyson orbital corresponding to excition I.""" if not hasattr(self, "g"): self._calculate() if not hasattr(self, "morbitals"): nbands = self.c_m.get_number_of_bands() spin = self.c_m.get_number_of_spins() == 2 morbitals_ig = [] for i in self.gs_m: k = int(i >= nbands) * spin i -= nbands * int(i >= nbands) morbitals_ig.append(self.c_m.wfs.kpt_u[k].psit_nG[i]) self.morbitals_ig = np.array(morbitals_ig) dyson = State(self.gd) gridnn = self.gd.zeros() for i, g in enumerate(self.g_Ii[I]): gridnn += g * self.morbitals_ig[i] dyson.set_grid(gridnn) dyson.set_energy(-self.be[I]) return dyson
def Dyson_orbital(self, I): """Return the Dyson orbital corresponding to excition I.""" if not hasattr(self, 'g'): self._calculate() if not hasattr(self, 'morbitals'): nbands = self.c_m.get_number_of_bands() spin = self.c_m.get_number_of_spins() == 2 morbitals_ig = [] for i in self.gs_m: k = int(i >= nbands) * spin i -= nbands * int(i >= nbands) morbitals_ig.append(self.c_m.wfs.kpt_u[k].psit_nG[i]) self.morbitals_ig = np.array(morbitals_ig) dyson = State(self.gd) gridnn = self.gd.zeros() for i, g in enumerate(self.g_Ii[I]): gridnn += g * self.morbitals_ig[i] dyson.set_grid(gridnn) dyson.set_energy(-self.be[I]) return dyson