예제 #1
0
파일: df.py 프로젝트: 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
예제 #2
0
파일: df.py 프로젝트: 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
예제 #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
예제 #4
0
파일: r_incore.py 프로젝트: MSwenne/BEP
def cholesky_eri(mol,
                 auxbasis='weigend+etb',
                 auxmol=None,
                 int3c='int3c2e_spinor',
                 aosym='s1',
                 int2c='int2c2e_sph',
                 comp=1,
                 verbose=0):
    return incore.cholesky_eri(mol, auxbasis, auxmol, int3c, aosym, int2c,
                               comp, verbose, aux_e2)
예제 #5
0
파일: df.py 프로젝트: yoshida-lab/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
예제 #6
0
파일: df.py 프로젝트: 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
예제 #7
0
파일: outcore.py 프로젝트: v1j4y/pyscf
    else:
        return 's' + sym


if __name__ == '__main__':
    mol = pyscf.gto.Mole()
    mol.verbose = 0
    mol.output = None

    mol.atom = [
        ["O" , (0. , 0.     , 0.)],
        [1   , (0. , -0.757 , 0.587)],
        [1   , (0. , 0.757  , 0.587)]]

    mol.basis = 'cc-pvtz'
    mol.build()

    cderi0 = incore.cholesky_eri(mol)
    cholesky_eri(mol, 'cderi.dat')
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['eri_mo'], cderi0))

    cholesky_eri(mol, 'cderi.dat', ioblk_size=.5)
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['eri_mo'], cderi0))

    general(mol, (numpy.eye(mol.nao_nr()),)*2, 'cderi.dat',
            max_memory=.5, ioblk_size=.2, verbose=6)
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['eri_mo'], cderi0))
예제 #8
0
del (MAX_MEMORY)

if __name__ == '__main__':
    from pyscf.df import incore
    mol = gto.Mole()
    mol.verbose = 0
    mol.output = None

    mol.atom = [["O", (0., 0., 0.)], [1, (0., -0.757, 0.587)],
                [1, (0., 0.757, 0.587)]]

    mol.basis = 'cc-pvtz'
    mol.build()

    cderi0 = incore.cholesky_eri(mol)
    cholesky_eri(mol, 'cderi.dat')
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['j3c'], cderi0))

    cholesky_eri(mol, 'cderi.dat', ioblk_size=.5)
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['j3c'], cderi0))

    general(mol, (numpy.eye(mol.nao_nr()), ) * 2,
            'cderi.dat',
            max_memory=.5,
            ioblk_size=.2,
            verbose=6)
    with h5py.File('cderi.dat') as feri:
        print(numpy.allclose(feri['j3c'], cderi0))
예제 #9
0
파일: r_incore.py 프로젝트: chrinide/pyscf
def cholesky_eri(mol, auxbasis='weigend+etb', auxmol=None,
                 int3c='int3c2e_spinor', aosym='s1', int2c='int2c2e_sph', comp=1,
                 verbose=0):
    return incore.cholesky_eri(mol, auxbasis, auxmol, int3c, aosym, int2c,
                               comp, verbose, aux_e2)