pyscf / pyscf

Python module for quantum chemistry
Apache License 2.0
1.24k stars 579 forks source link

Custom density fitted integrals in CC #2409

Closed sanshar closed 1 month ago

sanshar commented 1 month ago

Hi, There is a way to construct CC object by giving it mean field objects with custom 2-electron integrals. Is it possible to use density fitted 3-index integrals instead of 4-index integrals? For larger systems it is expensive to store the full electron integrals and a DF object can be quite useful.

Sandeep.

obackhouse commented 1 month ago

You can density fit a mean-field object and then change the mf.with_df._cderi flag i.e.:

from pyscf import gto, scf, cc
import numpy as np

mol = gto.M(
    atom="H 0 0 0; Li 0 0 1.64",
    basis="cc-pvdz",
    max_memory=1e9,
)

mf = scf.RHF(mol)
mf = mf.density_fit()
mf.kernel()

mf.with_df._cderi = mf.with_df._cderi + 1e-3

ccsd = cc.CCSD(mf)
ccsd.kernel()

I added a max_memory flag to the Mole definition which should make sure that everything is done in-core, otherwise I think that it may be trickier since the CDERI array may be expected to be a HDF5 file for larger systems (it may still work if you're setting mf.with_df._cderi with a completely new array, not sure).

gkc1000 commented 1 month ago

Closing as this issue is addressed, reopen if more help is needed.