Exemple #1
0
 def test_init_denisty_fit(self):
     from pyscf.df import df_jk
     from pyscf import cc
     from pyscf.cc import dfccsd
     self.assertTrue(isinstance(df.density_fit(scf.RHF(mol)), df_jk._DFHF))
     self.assertTrue(isinstance(df.density_fit(cc.CCSD(scf.RHF(mol))),
                                dfccsd.RCCSD))
Exemple #2
0
 def DFCASCI(mf, ncas, nelecas, auxbasis=None, **kwargs):
     mf = _convert_to_rhf(mf, False)
     if mf.mol.symmetry:
         mc = casci_symm.CASCI(mf, ncas, nelecas, **kwargs)
     else:
         mc = casci.CASCI(mf, ncas, nelecas, **kwargs)
     return df.density_fit(mc, auxbasis)
Exemple #3
0
 def DFCASCI(mf, ncas, nelecas, auxbasis=None, **kwargs):
     mf = _convert_to_rhf(mf, False)
     if mf.mol.symmetry:
         mc = casci_symm.CASCI(mf, ncas, nelecas, **kwargs)
     else:
         mc = casci.CASCI(mf, ncas, nelecas, **kwargs)
     return df.density_fit(mc, auxbasis)
Exemple #4
0
 def density_fit(mc, auxbasis=None, with_df=None):
     if hasattr(mc._scf, 'with_df') and mc._scf.with_df:
         return df.density_fit(mc, auxbasis, with_df)
     else:
         from pyscf.lib import logger
         logger.warn(mc, 'NOTE: approx_hessian function is available for DF orbital hessian!\n'
                     'The CASSCF object is built on normal SCF object %s '
                     '(without density fitting).  Currently, this density_fit '
                     'function will call approx_hessian to approximate orbital '
                     'hessian for backward compatibility.\n'
                     'In the future release, it will be removed and the '
                     'density_fit function will only generate DF-CASSCF method.',
                     mc._scf.__class__)
         return approx_hessian(mc, auxbasis, with_df)
Exemple #5
0
 def density_fit(mc, auxbasis=None, with_df=None):
     if hasattr(mc._scf, 'with_df') and mc._scf.with_df:
         return df.density_fit(mc, auxbasis, with_df)
     else:
         from pyscf.lib import logger
         logger.warn(mc, 'NOTE: approx_hessian function is available for DF orbital hessian!\n'
                     'The CASSCF object is built on normal SCF object %s '
                     '(without density fitting).  Currently, this density_fit '
                     'function will call approx_hessian to approximate orbital '
                     'hessian for backward compatibility.\n'
                     'In the future release, it will be removed and the '
                     'density_fit function will only generate DF-CASSCF method.',
                     mc._scf.__class__)
         return approx_hessian(mc, auxbasis, with_df)
Exemple #6
0
examples/pbc/11-gamma_point_all_electron_scf.py
'''

from pyscf import gto, scf, df
from pyscf.pbc import gto as pgto
from pyscf.pbc import dft as pdft
from pyscf.pbc import df as pdf

#
# Method 1: Initialize a DF-SCF object based on the given SCF object.
#
# An attribute .with_df is created in the DF-SCF object.  with_df attribute
# holds all methods and informations of the DF integrals.
#
mol = gto.M(atom='N 0 0 0; N 0 0 1.2', basis='ccpvdz')
mf = df.density_fit(scf.RHF(mol), auxbasis='weigend')
print(mf.with_df)
mf.kernel()

#
# Method 2: SCF object has density_fit method.
#
mf = scf.RHF(mol).density_fit(auxbasis='weigend')
mf.kernel()

# DF method can be switched off by assigning None to with_df object
mf.with_df = None
mf.kernel()

#
# In PBC calculations, DF/MDF method should be used for all-electron
Exemple #7
0
examples/pbc/11-gamma_point_all_electron_scf.py
'''

from pyscf import gto, scf, df
from pyscf.pbc import gto as pgto
from pyscf.pbc import dft as pdft
from pyscf.pbc import df as pdf

#
# Method 1: Initialize a DF-SCF object based on the given SCF object.
#
# An attribute .with_df is created in the DF-SCF object.  with_df attribute
# holds all methods and informations of the DF integrals.
#
mol = gto.M(atom='N 0 0 0; N 0 0 1.2', basis='ccpvdz')
mf = df.density_fit(scf.RHF(mol), auxbasis='weigend')
print(mf.with_df)
mf.kernel()

#
# Method 2: SCF object has density_fit method.
#
mf = scf.RHF(mol).density_fit(auxbasis='weigend')
mf.kernel()

# DF method can be switched off by assigning None to with_df object
mf.with_df = None
mf.kernel()


#