def test_ibo_PM(self): mf = scf.RHF(mol).run() b = ibo.ibo(mol, mf.mo_coeff[:,mf.mo_occ>0], locmethod='PM', exponent=4).kernel() pop = pipek.atomic_pops(mol, b) z = numpy.einsum('xii,xii->', pop, pop) self.assertAlmostEqual(z, 3.9201797890974261, 5) b = ibo.ibo(mol, mf.mo_coeff[:,mf.mo_occ>0], locmethod='PM', exponent=2).kernel() pop = pipek.atomic_pops(mol, b) z = numpy.einsum('xii,xii->', pop, pop) self.assertAlmostEqual(z, 3.9201797890974261, 5)
def test_ibo(self): mf = scf.RHF(mol).run() b = ibo.ibo(mol, mf.mo_coeff[:,mf.mo_occ>0], exponent=4) s_b = reduce(numpy.dot, (b.T, mf.get_ovlp(), b)) self.assertTrue(abs(s_b.diagonal() - 1).max() < 1e-9) pop = pipek.atomic_pops(mol, b) z = numpy.einsum('xii,xii->', pop, pop) self.assertAlmostEqual(z, 4.0663610846219127, 5) b = ibo.ibo(mol, mf.mo_coeff[:,mf.mo_occ>0], exponent=2) s_b = reduce(numpy.dot, (b.T, mf.get_ovlp(), b)) self.assertTrue(abs(s_b.diagonal() - 1).max() < 1e-9) pop = pipek.atomic_pops(mol, b) z = numpy.einsum('xii,xii->', pop, pop) self.assertAlmostEqual(z, 4.0663609732471571, 5)
def localizeValence(mf, mo_coeff, method="iao"): if (method == "iao"): return iao.iao(mf.mol, mo_coeff) elif (method == "ibo"): a = iao.iao(mf.mol, mo_coeff) a = lo.vec_lowdin(a, mf.get_ovlp()) return ibo.ibo(mf.mol, mo_coeff, iaos=a) elif (method == "boys"): return boys.Boys(mf.mol).kernel(mo_coeff) elif (method == "er"): return edmiston.ER(mf.mol).kernel(mo_coeff)
def localizeAllElectron(mf, method="lowdin"): if (method == "lowdin"): return fractional_matrix_power(mf.get_ovlp(), -0.5).T elif (method == "pm"): return pipek.PM(mf.mol).kernel(mf.mo_coeff) elif (method == "boys"): return boys.Boys(mf.mol).kernel(mf.mo_coeff) elif (method == "er"): return edmiston.ER(mf.mol).kernel(mf.mo_coeff) elif (method == "iao"): return iao.iao(mf.mol, mf.mo_coeff) elif (method == "ibo"): a = iao.iao(mf.mol, mf.mo_coeff) a = lo.vec_lowdin(a, mf.get_ovlp()) return ibo.ibo(mf.mol, mf.mo_coeff, iaos=a)
def pm2(mol, mo_coeff): return ibo.ibo(mol, mo_coeff, locmethod='PM', exponent=4)