def RAGF2(mf, nmom=(None, 0), frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None): if nmom != (None, 0): # redundant if nmom[1] == 0 and nmom[0] != 0: nmom = (None, 0) if nmom != (None, 0) and getattr(mf, 'with_df', None) is not None: raise RuntimeError('AGF2 with custom moment orders does not ' 'density fitting.') elif nmom != (None, 0): lib.logger.warn( mf, 'AGF2 called with custom moment orders - ' 'falling back on _slow implementations.') return ragf2_slow.RAGF2(mf, nmom, frozen, mo_energy, mo_coeff, mo_occ) elif getattr(mf, 'with_df', None) is not None: return dfragf2.DFRAGF2(mf, frozen, mo_energy, mo_coeff, mo_occ) else: return ragf2.RAGF2(mf, frozen, mo_energy, mo_coeff, mo_occ)
def density_fit(self, auxbasis=None, with_df=None): from pyscf.agf2 import dfragf2 myagf2 = dfragf2.DFRAGF2(self._scf) myagf2.__dict__.update(self.__dict__) if with_df is not None: myagf2.with_df = with_df if auxbasis is not None and myagf2.with_df.auxbasis != auxbasis: import copy myagf2.with_df = copy.copy(myagf2.with_df) myagf2.with_df.auxbasis = auxbasis return myagf2