Exemplo n.º 1
0
Arquivo: df.py Projeto: v3op01/pyscf
    def build(self):
        t0 = (time.clock(), time.time())
        log = logger.Logger(self.stdout, self.verbose)
        mol = self.mol
        auxmol = self.auxmol = incore.format_aux_basis(self.mol, self.auxbasis)
        nao = mol.nao_nr()
        naux = auxmol.nao_nr()
        nao_pair = nao * (nao + 1) // 2

        max_memory = (self.max_memory - lib.current_memory()[0]) * .8
        if nao_pair * naux * 3 * 8 / 1e6 < max_memory:
            self._cderi = incore.cholesky_eri(mol, auxmol=auxmol, verbose=log)
        else:
            if not isinstance(self._cderi, str):
                if isinstance(self._cderi_file, str):
                    self._cderi = self._cderi_file
                else:
                    self._cderi = self._cderi_file.name
            outcore.cholesky_eri(mol,
                                 self._cderi,
                                 dataname='j3c',
                                 auxmol=auxmol,
                                 verbose=log)
            if nao_pair * nao * 8 / 1e6 < max_memory:
                with addons.load(self._cderi, 'j3c') as feri:
                    cderi = numpy.asarray(feri)
                self._cderi = cderi
            log.timer_debug1('Generate density fitting integrals', *t0)

        return self
Exemplo n.º 2
0
Arquivo: df.py Projeto: eronca/pyscf
    def build(self):
        t0 = (time.clock(), time.time())
        log = logger.Logger(self.stdout, self.verbose)
        mol = self.mol
        auxmol = self.auxmol = incore.format_aux_basis(self.mol, self.auxbasis)
        nao = mol.nao_nr()
        naux = auxmol.nao_nr()
        nao_pair = nao*(nao+1)//2

        max_memory = (self.max_memory - lib.current_memory()[0]) * .8
        if nao_pair*naux*3*8/1e6 < max_memory:
            self._cderi = incore.cholesky_eri(mol, auxmol=auxmol, verbose=log)
        else:
            if not isinstance(self._cderi, str):
                if isinstance(self._cderi_file, str):
                    self._cderi = self._cderi_file
                else:
                    self._cderi = self._cderi_file.name
            outcore.cholesky_eri(mol, self._cderi, auxmol=auxmol, verbose=log)
            if nao_pair*nao*8/1e6 < max_memory:
                with addons.load(self._cderi) as feri:
                    cderi = numpy.asarray(feri)
                self._cderi = cderi
            log.timer_debug1('Generate density fitting integrals', *t0)

        return self
Exemplo n.º 3
0
    def build(self):
        t0 = (logger.process_clock(), logger.perf_counter())
        log = logger.Logger(self.stdout, self.verbose)

        self.check_sanity()
        self.dump_flags()

        mol = self.mol
        auxmol = self.auxmol = addons.make_auxmol(self.mol, self.auxbasis)
        nao = mol.nao_nr()
        naux = auxmol.nao_nr()
        nao_pair = nao * (nao + 1) // 2

        max_memory = self.max_memory - lib.current_memory()[0]
        int3c = mol._add_suffix('int3c2e')
        int2c = mol._add_suffix('int2c2e')
        if (nao_pair * naux * 8 / 1e6 < .9 * max_memory
                and not isinstance(self._cderi_to_save, str)):
            self._cderi = incore.cholesky_eri(mol,
                                              int3c=int3c,
                                              int2c=int2c,
                                              auxmol=auxmol,
                                              max_memory=max_memory,
                                              verbose=log)
        else:
            if isinstance(self._cderi_to_save, str):
                cderi = self._cderi_to_save
            else:
                cderi = self._cderi_to_save.name

            if isinstance(self._cderi, str):
                # If cderi needs to be saved in
                log.warn(
                    'Value of _cderi is ignored. DF integrals will be '
                    'saved in file %s .', cderi)

            if self._compatible_format or isinstance(self._cderi_to_save, str):
                outcore.cholesky_eri(mol,
                                     cderi,
                                     dataname='j3c',
                                     int3c=int3c,
                                     int2c=int2c,
                                     auxmol=auxmol,
                                     max_memory=max_memory,
                                     verbose=log)
            else:
                # Store DF tensor in blocks. This is to reduce the
                # initiailzation overhead
                outcore.cholesky_eri_b(mol,
                                       cderi,
                                       dataname='j3c',
                                       int3c=int3c,
                                       int2c=int2c,
                                       auxmol=auxmol,
                                       max_memory=max_memory,
                                       verbose=log)
            self._cderi = cderi
            log.timer_debug1('Generate density fitting integrals', *t0)
        return self
Exemplo n.º 4
0
    def build(self):
        t0 = (time.clock(), time.time())
        log = logger.Logger(self.stdout, self.verbose)

        self.check_sanity()
        self.dump_flags()

        mol = self.mol
        auxmol = self.auxmol = addons.make_auxmol(self.mol, self.auxbasis)
        nao = mol.nao_nr()
        naux = auxmol.nao_nr()
        nao_pair = nao * (nao + 1) // 2

        max_memory = (self.max_memory - lib.current_memory()[0]) * .8
        int3c = mol._add_suffix('int3c2e')
        int2c = mol._add_suffix('int2c2e')
        if (nao_pair * naux * 3 * 8 / 1e6 < max_memory
                and not isinstance(self._cderi_to_save, str)):
            self._cderi = incore.cholesky_eri(mol,
                                              int3c=int3c,
                                              int2c=int2c,
                                              auxmol=auxmol,
                                              verbose=log)
        else:
            if isinstance(self._cderi_to_save, str):
                cderi = self._cderi_to_save
            else:
                cderi = self._cderi_to_save.name
            if isinstance(self._cderi, str):
                log.warn(
                    'Value of _cderi is ignored. DF integrals will be '
                    'saved in file %s .', cderi)
            outcore.cholesky_eri(mol,
                                 cderi,
                                 dataname='j3c',
                                 int3c=int3c,
                                 int2c=int2c,
                                 auxmol=auxmol,
                                 max_memory=max_memory,
                                 verbose=log)
            if nao_pair * naux * 8 / 1e6 < max_memory:
                with addons.load(cderi, 'j3c') as feri:
                    cderi = numpy.asarray(feri)
            self._cderi = cderi
            log.timer_debug1('Generate density fitting integrals', *t0)
        return self
Exemplo n.º 5
0
Arquivo: df.py Projeto: chrinide/pyscf
    def build(self):
        t0 = (time.clock(), time.time())
        log = logger.Logger(self.stdout, self.verbose)

        self.check_sanity()
        self.dump_flags()

        mol = self.mol
        auxmol = self.auxmol = addons.make_auxmol(self.mol, self.auxbasis)
        nao = mol.nao_nr()
        naux = auxmol.nao_nr()
        nao_pair = nao*(nao+1)//2

        max_memory = (self.max_memory - lib.current_memory()[0]) * .8
        int3c = mol._add_suffix('int3c2e')
        int2c = mol._add_suffix('int2c2e')
        if (nao_pair*naux*3*8/1e6 < max_memory and
            not isinstance(self._cderi_to_save, str)):
            self._cderi = incore.cholesky_eri(mol, int3c=int3c, int2c=int2c,
                                              auxmol=auxmol, verbose=log)
        else:
            if isinstance(self._cderi_to_save, str):
                cderi = self._cderi_to_save
            else:
                cderi = self._cderi_to_save.name
            if isinstance(self._cderi, str):
                log.warn('Value of _cderi is ignored. DF integrals will be '
                         'saved in file %s .', cderi)
            outcore.cholesky_eri(mol, cderi, dataname='j3c',
                                 int3c=int3c, int2c=int2c, auxmol=auxmol,
                                 max_memory=max_memory, verbose=log)
            if nao_pair*naux*8/1e6 < max_memory:
                with addons.load(cderi, 'j3c') as feri:
                    cderi = numpy.asarray(feri)
            self._cderi = cderi
            log.timer_debug1('Generate density fitting integrals', *t0)
        return self