def build(self): log = logger.Logger(self.stdout, self.verbose) mol = self.mol auxmol = self.auxmol = addons.make_auxmol(self.mol, self.auxbasis) n2c = mol.nao_2c() naux = auxmol.nao_nr() nao_pair = n2c * (n2c + 1) // 2 max_memory = (self.max_memory - lib.current_memory()[0]) * .8 mem_incore = nao_pair * naux * 3 * 16 / 1e6 * 2 mem_now = lib.current_memory()[0] if mem_incore < max_memory: self._cderi = (r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s1', int3c='int3c2e_spinor', verbose=log), r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s1', int3c='int3c2e_spsp1_spinor', verbose=log)) else: raise NotImplementedError("Outcore not available, requested :", mem_incore) return self
def build(self): log = logger.Logger(self.stdout, self.verbose) mol = self.mol auxmol = self.auxmol = addons.make_auxmol(self.mol, self.auxbasis) n2c = mol.nao_2c() naux = auxmol.nao_nr() nao_pair = n2c*(n2c+1)//2 max_memory = (self.max_memory - lib.current_memory()[0]) * .8 if nao_pair*naux*3*16/1e6*2 < max_memory: self._cderi =(r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s2', int3c='int3c2e_spinor', verbose=log), r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s2', int3c='int3c2e_spsp1_spinor', verbose=log)) else: raise NotImplementedError return self
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) n2c = mol.nao_2c() naux = auxmol.nao_nr() nao_pair = n2c * (n2c + 1) // 2 max_memory = (self.max_memory - lib.current_memory()[0]) * .8 if nao_pair * naux * 3 * 16 / 1e6 * 2 < max_memory: self._cderi = (r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s2', int3c='int3c2e_spinor', verbose=log), r_incore.cholesky_eri(mol, auxmol=auxmol, aosym='s2', int3c='int3c2e_spsp1_spinor', verbose=log)) else: raise NotImplementedError return self
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) n2c = mol.nao_2c() naux = auxmol.nao_nr() nao_pair = n2c*(n2c+1)//2 max_memory = (self.max_memory - lib.current_memory()[0]) * .8 if nao_pair*naux*3*16/1e6*2 < max_memory: self._cderi = r_incore.cholesky_eri(mol, auxbasis=self.auxbasis, aosym='s2', verbose=log) else: raise NotImplementedError self._cderifile = self._cderi self._cderi = r_outcore.cholesky_eri(mol, self._cderi.name, auxbasis=self.auxbasis, verbose=log) return self
mol = gto.Mole() mol.basis = 'unc-dzp-dk' mol.atom = ''' O 0.000000 0.000000 0.118351 H 0.000000 0.761187 -0.469725 H 0.000000 -0.761187 -0.469725 ''' mol.charge = 0 mol.spin = 0 mol.symmetry = 0 mol.verbose = 4 mol.build() t = time.time() cderi = r_incore.cholesky_eri(mol, int3c='int3c2e_spinor', verbose=4) def fjk2c(mol, dm, *args, **kwargs): n2c = dm.shape[0] cderi_ll = cderi.reshape(-1, n2c, n2c) vj = numpy.zeros((n2c, n2c), dtype=dm.dtype) vk = numpy.zeros((n2c, n2c), dtype=dm.dtype) rho = (numpy.dot(cderi, dm.T.reshape(-1))) vj = numpy.dot(rho, cderi).reshape(n2c, n2c) v1 = lib.einsum('pij,jk->pik', cderi_ll, dm) vk = lib.einsum('pik,pkj->ij', v1, cderi_ll) return vj, vk mf = x2c.UHF(mol)
mol = gto.Mole() mol.basis = 'unc-dzp-dk' mol.atom = ''' O 0.000000 0.000000 0.118351 H 0.000000 0.761187 -0.469725 H 0.000000 -0.761187 -0.469725 ''' mol.charge = 0 mol.spin = 0 mol.symmetry = 0 mol.verbose = 4 mol.build() t = time.time() cderi = r_incore.cholesky_eri(mol, int3c='int3c2e_spinor', auxbasis='def2-svp-jkfit', verbose=4) def fjk2c(mol, dm, *args, **kwargs): n2c = dm.shape[0] cderi_ll = cderi.reshape(-1, n2c, n2c) vj = numpy.zeros((n2c, n2c), dtype=dm.dtype) vk = numpy.zeros((n2c, n2c), dtype=dm.dtype) rho = numpy.dot(cderi, dm.T.reshape(-1)) vj = numpy.dot(rho, cderi).reshape(n2c, n2c) v1 = lib.einsum('pij,jk->pik', cderi_ll, dm) vk = lib.einsum('pik,pkj->ij', v1, cderi_ll) return vj, vk