Ejemplo n.º 1
0
def para(magobj, gauge_orig=None, h1=None, s1=None, with_cphf=None):
    '''Part of rotational g-tensors from the first order wavefunctions. Unit
    hbar/mu_N is not included.  This part may be different to the conventional
    para-magnetic contributions of rotational g-tensors.
    '''
    mol = magobj.mol
    im, mass_center = inertia_tensor(mol)

    if gauge_orig is None:
        # The first order Hamiltonian for rotation part is the same to the
        # first order Hamiltonian for magnetic field except a factor of 2. It can
        # be computed using the magnetizability code.
        mag_para = rhf_mag.para(magobj, gauge_orig, h1, s1, with_cphf) * 2

    else:
        mf = magobj._scf
        mo_energy = mf.mo_energy
        mo_coeff = mf.mo_coeff
        mo_occ = mf.mo_occ
        orbo = mo_coeff[:,mo_occ>0]

        # for magnetic field
        with mol.with_common_origin(mass_center):
            h10 = .5 * mol.intor('int1e_cg_irxp', 3)
            h10 = lib.einsum('xpq,pi,qj->xij', h10, mo_coeff.conj(), orbo)

        # for rotation part
        with mol.with_common_origin(gauge_orig):
            h01 = -mol.intor('int1e_cg_irxp', 3)
            h01 = lib.einsum('xpq,pi,qj->xij', h01, mo_coeff.conj(), orbo)

        s10 = numpy.zeros_like(h10)
        mo10 = rhf_nmr._solve_mo1_uncoupled(mo_energy, mo_occ, h10, s10)[0]

        mag_para = numpy.einsum('xji,yji->xy', mo10.conj(), h01)
        mag_para = (mag_para + mag_para.conj()) * 2  # *2 for double occupancy

    mag_para = _safe_solve(im, mag_para)
    # unit = hbar/mu_N, mu_N is nuclear magneton
    unit = -2 * nist.PROTON_MASS_AU
    return mag_para * unit
Ejemplo n.º 2
0
def para(magobj, gauge_orig=None, h1=None, s1=None, with_cphf=None):
    '''Part of rotational g-tensors from the first order wavefunctions. Unit
    hbar/mu_N is not included.  This part may be different to the conventional
    para-magnetic contributions of rotational g-tensors.
    '''
    mol = magobj.mol
    im, mass_center = inertia_tensor(mol)

    if gauge_orig is None:
        # The first order Hamiltonian for rotation part is the same to the
        # first order Hamiltonian for magnetic field except a factor of 2. It can
        # be computed using the magnetizability code.
        mag_para = rhf_mag.para(magobj, gauge_orig, h1, s1, with_cphf) * 2

    else:
        mf = magobj._scf
        mo_energy = mf.mo_energy
        mo_coeff = mf.mo_coeff
        mo_occ = mf.mo_occ
        orbo = mo_coeff[:,mo_occ>0]

        # for magnetic field
        with mol.with_common_origin(mass_center):
            h10 = .5 * mol.intor('int1e_cg_irxp', 3)
            h10 = lib.einsum('xpq,pi,qj->xij', h10, mo_coeff.conj(), orbo)

        # for rotation part
        with mol.with_common_origin(gauge_orig):
            h01 = -mol.intor('int1e_cg_irxp', 3)
            h01 = lib.einsum('xpq,pi,qj->xij', h01, mo_coeff.conj(), orbo)

        s10 = numpy.zeros_like(h10)
        mo10 = rhf_nmr._solve_mo1_uncoupled(mo_energy, mo_occ, h10, s10)[0]

        mag_para = numpy.einsum('xji,yji->xy', mo10.conj(), h01)
        mag_para = (mag_para + mag_para.conj()) * 2  # *2 for double occupancy

    mag_para = _safe_solve(im, mag_para)
    # unit = hbar/mu_N, mu_N is nuclear magneton
    unit = -2 * nist.PROTON_MASS_AU
    return mag_para * unit