Beispiel #1
0
def get_fock(nmrobj, dm0=None, gauge_orig=None):
    '''First order Fock matrix wrt external magnetic field'''
    if dm0 is None: dm0 = nmrobj._scf.make_rdm1()
    if gauge_orig is None: gauge_orig = nmrobj.gauge_orig

    mol = nmrobj.mol

    if gauge_orig is None:
        log = logger.Logger(nmrobj.stdout, nmrobj.verbose)
        log.debug('First-order GIAO Fock matrix')

        mf = nmrobj._scf
        ni = mf._numint
        omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, spin=mol.spin)

        mem_now = lib.current_memory()[0]
        max_memory = max(2000, mf.max_memory * .9 - mem_now)
        # Attach mo_coeff and mo_occ to improve get_vxc_giao efficiency
        dm0 = lib.tag_array(dm0, mo_coeff=mf.mo_coeff, mo_occ=mf.mo_occ)
        h1 = -get_vxc_giao(ni,
                           mol,
                           mf.grids,
                           mf.xc,
                           dm0,
                           max_memory=max_memory,
                           verbose=nmrobj.verbose)

        intor = mol._add_suffix('int2e_ig1')
        if abs(hyb) > 1e-10:
            vj, vk = rhf_nmr.get_jk(mol, dm0)
            h1 += vj[0] + vj[1] - hyb * vk
            if abs(omega) > 1e-10:
                with mol.with_range_coulomb(omega):
                    h1 -= (alpha - hyb) * rhf_nmr.get_jk(mol, dm0)[1]
        else:
            vj = _vhf.direct_mapdm(intor, 'a4ij', 'lk->s1ij', dm0, 3, mol._atm,
                                   mol._bas, mol._env)
            h1 -= vj[0] + vj[1]

        h1 -= .5 * mol.intor('int1e_giao_irjxp', 3)
        h1 -= mol.intor_asymmetric('int1e_ignuc', 3)
        if mol.has_ecp():
            h1 -= mol.intor_asymmetric('ECPscalar_ignuc', 3)
        h1 -= mol.intor('int1e_igkin', 3)
    else:
        with mol.with_common_origin(gauge_orig):
            h1 = -.5 * mol.intor('int1e_cg_irxp', 3)
            h1 = (h1, h1)
    if nmrobj.chkfile:
        lib.chkfile.dump(nmrobj.chkfile, 'nmr/h1', h1)
    return h1
Beispiel #2
0
def make_h10giao(mol, dm0):
    vj, vk = rhf_nmr.get_jk(mol, dm0)
    h1 = vj[0] + vj[1] - vk
    h1 -= mol.intor_asymmetric('int1e_ignuc', 3)
    if mol.has_ecp():
        h1 -= mol.intor_asymmetric('ECPscalar_ignuc', 3)
    h1 -= mol.intor('int1e_igkin', 3)
    return h1
Beispiel #3
0
def make_h10giao(mol, dm0):
    vj, vk = rhf_nmr.get_jk(mol, dm0)
    h1 = vj[0] + vj[1] - vk
    h1 -= mol.intor_asymmetric('int1e_ignuc', 3)
    if mol.has_ecp():
        h1 -= mol.intor_asymmetric('ECPscalar_ignuc', 3)
    h1 -= mol.intor('int1e_igkin', 3)
    return h1
Beispiel #4
0
def get_fock(nmrobj, dm0=None, gauge_orig=None):
    '''First order Fock matrix wrt external magnetic field'''
    if dm0 is None: dm0 = nmrobj._scf.make_rdm1()
    if gauge_orig is None: gauge_orig = nmrobj.gauge_orig

    mol = nmrobj.mol

    if gauge_orig is None:
        log = logger.Logger(nmrobj.stdout, nmrobj.verbose)
        log.debug('First-order GIAO Fock matrix')

        mf = nmrobj._scf
        ni = mf._numint
        omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, spin=mol.spin)

        mem_now = lib.current_memory()[0]
        max_memory = max(2000, mf.max_memory*.9-mem_now)
        # Attach mo_coeff and mo_occ to improve get_vxc_giao efficiency
        dm0 = lib.tag_array(dm0, mo_coeff=mf.mo_coeff, mo_occ=mf.mo_occ)
        h1 = -get_vxc_giao(ni, mol, mf.grids, mf.xc, dm0,
                           max_memory=max_memory, verbose=nmrobj.verbose)

        intor = mol._add_suffix('int2e_ig1')
        if abs(hyb) > 1e-10:
            vj, vk = rhf_nmr.get_jk(mol, dm0)
            h1 += vj[0] + vj[1] - hyb * vk
            if abs(omega) > 1e-10:
                with mol.with_range_coulomb(omega):
                    h1 -= (alpha-hyb) * rhf_nmr.get_jk(mol, dm0)[1]
        else:
            vj = _vhf.direct_mapdm(intor, 'a4ij', 'lk->s1ij',
                                   dm0, 3, mol._atm, mol._bas, mol._env)
            h1 -= vj[0] + vj[1]

        h1 -= .5 * mol.intor('int1e_giao_irjxp', 3)
        h1 -= mol.intor_asymmetric('int1e_ignuc', 3)
        if mol.has_ecp():
            h1 -= mol.intor_asymmetric('ECPscalar_ignuc', 3)
        h1 -= mol.intor('int1e_igkin', 3)
    else:
        with mol.with_common_origin(gauge_orig):
            h1 = -.5 * mol.intor('int1e_cg_irxp', 3)
            h1 = (h1, h1)
    if nmrobj.chkfile:
        lib.chkfile.dump(nmrobj.chkfile, 'nmr/h1', h1)
    return h1
Beispiel #5
0
    def make_h10(self, mol=None, dm0=None, gauge_orig=None):
        if mol is None: mol = self.mol
        if dm0 is None: dm0 = self._scf.make_rdm1()
        if gauge_orig is None: gauge_orig = self.gauge_orig

        if gauge_orig is None:
            log = logger.Logger(self.stdout, self.verbose)
            log.debug('First-order GIAO Fock matrix')

            h1 = -.5 * mol.intor('int1e_giao_irjxp', 3)
            h1 -= mol.intor_asymmetric('int1e_ignuc', 3)
            h1 -= mol.intor('int1e_igkin', 3)

            mf = self._scf
            ni = mf._numint
            hyb = ni.hybrid_coeff(mf.xc, spin=mol.spin)

            mem_now = lib.current_memory()[0]
            max_memory = max(2000, mf.max_memory * .9 - mem_now)
            # Attach mo_coeff and mo_occ to improve get_vxc_giao efficiency
            dm0 = lib.tag_array(dm0, mo_coeff=mf.mo_coeff, mo_occ=mf.mo_occ)
            h1 -= get_vxc_giao(ni,
                               mol,
                               mf.grids,
                               mf.xc,
                               dm0,
                               max_memory=max_memory,
                               verbose=self.verbose)

            intor = mol._add_suffix('int2e_ig1')
            if abs(hyb) > 1e-10:
                vj, vk = rhf_nmr.get_jk(mol, dm0)
                h1 += vj - .5 * hyb * vk
            else:
                vj = _vhf.direct_mapdm(intor, 'a4ij', 'lk->s1ij', dm0, 3,
                                       mol._atm, mol._bas, mol._env)
                h1 -= vj
        else:
            mol.set_common_origin(gauge_orig)
            h1 = -.5 * mol.intor('int1e_cg_irxp', 3)
        lib.chkfile.dump(self.chkfile, 'nmr/h1', h1)
        return h1