def _common_init_(self, agf2, mo_coeff=None): if mo_coeff is None: mo_coeff = agf2.mo_coeff self.mo_coeff = mo_coeff dm = agf2._scf.make_rdm1(agf2.mo_coeff, agf2.mo_occ) h1e_ao = agf2._scf.get_hcore() fock_ao = h1e_ao + agf2._scf.get_veff(agf2.mol, dm) self.h1e = np.dot(np.dot(mo_coeff.conj().T, h1e_ao), mo_coeff) self.fock = np.dot(np.dot(mo_coeff.conj().T, fock_ao), mo_coeff) self.h1e = mpi_helper.bcast(self.h1e) self.fock = mpi_helper.bcast(self.fock) self.e_hf = mpi_helper.bcast(agf2._scf.e_tot) self.nmo = agf2.nmo self.nocc = agf2.nocc self.mol = agf2.mol mo_e = self.fock.diagonal() gap = abs(mo_e[:self.nocc, None] - mo_e[None, self.nocc:]).min() if gap < 1e-5: logger.warn(agf2, 'H**O-LUMO gap %s may be too small for AGF2', gap) return self
def _common_init_(self, agf2, mo_coeff=None): if mo_coeff is None: mo_coeff = agf2.mo_coeff self.mo_coeff = mo_coeff dm = agf2._scf.make_rdm1(agf2.mo_coeff, agf2.mo_occ) h1e_ao = agf2._scf.get_hcore() vhf = agf2._scf.get_veff(agf2.mol, dm) fock_ao = agf2._scf.get_fock(vhf=vhf, dm=dm) self.h1e = (np.dot(np.dot(mo_coeff[0].conj().T, h1e_ao), mo_coeff[0]), np.dot(np.dot(mo_coeff[1].conj().T, h1e_ao), mo_coeff[1])) self.fock = (np.dot(np.dot(mo_coeff[0].conj().T, fock_ao[0]), mo_coeff[0]), np.dot(np.dot(mo_coeff[1].conj().T, fock_ao[1]), mo_coeff[1])) self.h1e = (mpi_helper.bcast(self.h1e[0]), mpi_helper.bcast(self.h1e[1])) self.fock = (mpi_helper.bcast(self.fock[0]), mpi_helper.bcast(self.fock[1])) self.e_hf = mpi_helper.bcast(agf2._scf.e_tot) self.nmo = agf2.nmo nocca, noccb = self.nocc = agf2.nocc self.mol = agf2.mol mo_e = (self.fock[0].diagonal(), self.fock[1].diagonal()) gap_a = abs(mo_e[0][:nocca,None] - mo_e[0][None,nocca:]).min() gap_b = abs(mo_e[1][:noccb,None] - mo_e[1][None,noccb:]).min() gap = min(gap_a, gap_b) if gap < 1e-5: logger.warn(agf2, 'H**O-LUMO gap %s may be too small for AGF2', gap) return self
def __init__(self, mf, frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None): if mo_energy is None: mo_energy = mpi_helper.bcast(mf.mo_energy) if mo_coeff is None: mo_coeff = mpi_helper.bcast(mf.mo_coeff) if mo_occ is None: mo_occ = mpi_helper.bcast(mf.mo_occ) self.mol = mf.mol self._scf = mf self.verbose = self.mol.verbose self.stdout = self.mol.stdout self.max_memory = mf.max_memory self.incore_complete = self.incore_complete or self.mol.incore_anyway self.conv_tol = getattr(__config__, 'agf2_conv_tol', 1e-7) self.conv_tol_rdm1 = getattr(__config__, 'agf2_conv_tol_rdm1', 1e-8) self.conv_tol_nelec = getattr(__config__, 'agf2_conv_tol_nelec', 1e-6) self.max_cycle = getattr(__config__, 'agf2_max_cycle', 50) self.max_cycle_outer = getattr(__config__, 'agf2_max_cycle_outer', 20) self.max_cycle_inner = getattr(__config__, 'agf2_max_cycle_inner', 50) self.weight_tol = getattr(__config__, 'agf2_weight_tol', 1e-11) self.fock_diis_space = getattr(__config__, 'agf2_diis_space', 6) self.fock_diis_min_space = getattr(__config__, 'agf2_diis_min_space', 1) self.diis = getattr(__config__, 'agf2_diis', True) self.diis_space = getattr(__config__, 'agf2_diis_space', 8) self.diis_min_space = getattr(__config__, 'agf2_diis_min_space', 1) self.os_factor = getattr(__config__, 'agf2_os_factor', 1.0) self.ss_factor = getattr(__config__, 'agf2_ss_factor', 1.0) self.damping = getattr(__config__, 'agf2_damping', 0.0) self.mo_energy = mo_energy self.mo_coeff = mo_coeff self.mo_occ = mo_occ self.se = None self.gf = None self.e_1b = mf.e_tot self.e_2b = 0.0 self.e_init = 0.0 self.frozen = frozen self._nmo = None self._nocc = None self.converged = False self.chkfile = mf.chkfile self._keys = set(self.__dict__.keys())
def e_corr(self): e_hf = mpi_helper.bcast(self._scf.e_tot) return self.e_tot - e_hf