Ejemplo n.º 1
0
Archivo: dhf.py Proyecto: raybrad/pyscf
def para(mol, mo10, mo_coeff, mo_occ, shielding_nuc=None):
    if shielding_nuc is None:
        shielding_nuc = range(1, mol.natm+1)
    n4c = mo_coeff.shape[1]
    n2c = n4c // 2
    msc_para = numpy.zeros((len(shielding_nuc),3,3))
    para_neg = numpy.zeros((len(shielding_nuc),3,3))
    para_occ = numpy.zeros((len(shielding_nuc),3,3))
    h01 = numpy.zeros((3, n4c, n4c), complex)
    for n, atm_id in enumerate(shielding_nuc):
        mol.set_rinv_origin_(mol.atom_coord(atm_id-1))
        t01 = mol.intor('cint1e_sa01sp', 3)
        for m in range(3):
            h01[m,:n2c,n2c:] = .5 * t01[m]
            h01[m,n2c:,:n2c] = .5 * t01[m].conj().T
        h01_mo = hf._mat_ao2mo(h01, mo_coeff, mo_occ)
        for b in range(3):
            for m in range(3):
                # + c.c.
                p = numpy.einsum('ij,ij->i', mo10[b].conj(), h01_mo[m]).real * 2
                msc_para[n,b,m] = p.sum()
                para_neg[n,b,m] = p[:n2c].sum()
                para_occ[n,b,m] = p[mo_occ>0].sum()
    para_pos = msc_para - para_neg - para_occ
    return msc_para, para_pos, para_neg, para_occ
Ejemplo n.º 2
0
Archivo: dhf.py Proyecto: raybrad/pyscf
    def _vind(self, mo1):
        '''Induced potential'''
        mo_coeff = self._scf.mo_coeff
        mo_occ = self._scf.mo_occ
        dm1 = self.make_rdm1_1(mo1, mo_coeff, mo_occ)
        direct_scf_bak, self._scf.direct_scf = self._scf.direct_scf, False
# hermi=1 because dm1 = C^1 C^{0dagger} + C^0 C^{1dagger}
        v_ao = self._scf.get_veff(self.mol, dm1, hermi=1)
        self._scf.direct_scf = direct_scf_bak
        return hf._mat_ao2mo(v_ao, mo_coeff, mo_occ)