예제 #1
0
    def run(self):
        maxiter = self.options['maxiter']
        etol = self.options['etol']

        for self.iteration in range(1, maxiter + 1):
            log.iteration(self.iteration, self.verbose)

            self.fock_loop()
            self.build()
            self.energy()

            if self.iteration > 1:
                e_dif = abs(self._energies['tot'][-2] -
                            self._energies['tot'][-1])

                if e_dif < etol and self.converged:
                    break

                self.converged = e_dif < etol

        if self.converged:
            log.write(
                '\nAuxiliary GF2 converged after %d iterations.\n' %
                self.iteration, self.verbose)
        else:
            log.write('\nAuxiliary GF2 failed to converge.\n', self.verbose)

        self._timings['total'] = self._timings.get('total',
                                                   0.0) + self._timer.total()
        log.title('Timings', self.verbose)
        log.timings(self._timings, self.verbose)

        return self
예제 #2
0
    def run(self):
        maxiter = self.options['maxiter']
        etol = self.options['etol']
        checkpoint = self.options['checkpoint']

        for self.iteration in range(1, maxiter + 1):
            log.iteration(self.iteration, self.verbose)

            self.fock_loop()
            self.build()
            self.energy()

            if self.iteration > 1:
                e_dif = abs(self._energies['tot'][-2] -
                            self._energies['tot'][-1])

                if e_dif < etol and self.converged:
                    break

                self.converged = e_dif < etol

            if checkpoint and mpi.rank == 0:
                np.savetxt('rdm1_alph_chk.dat', self.rdm1[0])
                np.savetxt('rdm1_beta_chk.dat', self.rdm1[1])
                self.se[0].save('se_alph_chk.pickle')
                self.se[1].save('se_beta_chk.pickle')

        if self.converged:
            log.write(
                '\nAuxiliary GF2 converged after %d iterations.\n' %
                self.iteration, self.verbose)
        else:
            log.write('\nAuxiliary GF2 failed to converge.\n', self.verbose)

        self._timings['total'] = self._timings.get('total',
                                                   0.0) + self._timer.total()
        log.title('Timings', self.verbose)
        log.timings(self._timings, self.verbose)

        return self
예제 #3
0
    def run(self):
        for self.iteration in range(1, self.options['maxiter'] + 1):
            log.iteration(self.iteration, self.verbose)

            self.build_gf()

            if self.iteration == 1 or self.options['update_w']:
                self.solve_casida()

            self.build_se()
            self.merge()
            self.energy()

            if self.options['update_eig']:
                self.iterate_qp()

            if self.iteration > 1:
                e_dif = abs(self._energies['tot'][-2] - \
                            self._energies['tot'][-1])

                if e_dif < self.options['etol'] and self.converged:
                    break

                self.converged = e_dif < self.options['etol']

        if self.converged:
            log.write(
                '\nAuxiliary GW converged after %d iterations.\n' %
                self.iteration, self.verbose)
        else:
            log.write('\nAuxiliary GW failed to converge.\n', self.verbose)

        self._timings['total'] = self._timings.get('total', 0.0) \
                                 + self._timer.total()
        log.title('Timings', self.verbose)
        log.timings(self._timings, self.verbose)

        return self
예제 #4
0
 def test_iteration(self):
     sys.stdout = stdout = StringIO()
     log.iteration(0)
     sys.stdout = sys.__stdout__
예제 #5
0
    def run_mp2(self):
        log.iteration(0, self.verbose)

        self.build()
        self.energy_mp2()