예제 #1
0
 def get_xc_difference(self, xc):
     if isinstance(xc, str):
         xc = XC(xc)
     xc.initialize(self.density, self.hamiltonian, self.wfs,
                   self.occupations)
     xc.set_positions(self.atoms.get_scaled_positions() % 1.0)
     if xc.orbital_dependent:
         self.converge_wave_functions()
     return self.hamiltonian.get_xc_difference(xc, self.density) * Hartree
예제 #2
0
파일: aseinterface.py 프로젝트: qsnake/gpaw
 def get_xc_difference(self, xc):
     if isinstance(xc, str):
         xc = XC(xc)
     xc.initialize(self.density, self.hamiltonian, self.wfs,
                   self.occupations)
     xc.set_positions(self.atoms.get_scaled_positions() % 1.0)
     if xc.orbital_dependent:
         self.converge_wave_functions()
     return self.hamiltonian.get_xc_difference(xc, self.density) * Hartree
예제 #3
0
파일: paw.py 프로젝트: thonmaker/gpaw
 def get_xc_difference(self, xc):
     if isinstance(xc, (str, dict)):
         xc = XC(xc)
     xc.set_grid_descriptor(self.density.finegd)
     xc.initialize(self.density, self.hamiltonian, self.wfs,
                   self.occupations)
     xc.set_positions(self.spos_ac)
     if xc.orbital_dependent:
         self.converge_wave_functions()
     return self.hamiltonian.get_xc_difference(xc, self.density) * Ha
예제 #4
0
    def initialize_fxc(self, niter):
        self.has_fxc = self.fxc_name is not None
        if not self.has_fxc:
            return
        self.timer.start('Initialize fxc')
        # XXX: Similar functionality is available in
        # paw.py: PAW.linearize_to_xc(self, newxc)
        # See test/lcaotddft/fxc_vs_linearize.py

        get_H_MM = self.get_hamiltonian_matrix

        # Calculate deltaXC: 1. take current H_MM
        if niter == 0:
            self.deltaXC_H_uMM = [None] * len(self.wfs.kpt_u)
            for u, kpt in enumerate(self.wfs.kpt_u):
                self.deltaXC_H_uMM[u] = get_H_MM(kpt, addfxc=False)

        # Update hamiltonian.xc
        if self.fxc_name == 'RPA':
            xc_name = 'null'
        else:
            xc_name = self.fxc_name
        # XXX: xc is not written to the gpw file
        # XXX: so we need to set it always
        xc = XC(xc_name)
        xc.initialize(self.density, self.hamiltonian, self.wfs,
                      self.occupations)
        xc.set_positions(self.hamiltonian.spos_ac)
        self.hamiltonian.xc = xc
        self.update()

        # Calculate deltaXC: 2. update with new H_MM
        if niter == 0:
            for u, kpt in enumerate(self.wfs.kpt_u):
                self.deltaXC_H_uMM[u] -= get_H_MM(kpt, addfxc=False)
        self.timer.stop('Initialize fxc')