Exemplo n.º 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
Exemplo n.º 2
0
    def run(self):
        self.build()
        self.merge()
        self.energy_mp2()

        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
Exemplo n.º 3
0
    def run(self):
        self.get_1p_or_1h()
        self.build()
        self.merge()
        self.diagonalise()

        log.write('E(mp2) = %.12f\n' % self.e_mp2, self.verbose)
        e_excite = self.ip[0] if self.method == 'ip' else self.ea[0]
        log.write('E(%s)  = %.12f\n' % (self.method, e_excite), 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
Exemplo n.º 4
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
Exemplo n.º 5
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
Exemplo n.º 6
0
 def test_timings(self):
     sys.stdout = stdout = StringIO()
     log.timings({'setup': 0.0})
     sys.stdout = sys.__stdout__