• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python scf.density_fit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyscf.scf.density_fit函数的典型用法代码示例。如果您正苦于以下问题:Python density_fit函数的具体用法?Python density_fit怎么用?Python density_fit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了density_fit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_rohf

 def test_rohf(self):
     pmol = mol.copy()
     pmol.charge = 1
     pmol.spin = 1
     pmol.build(False, False)
     mf = scf.density_fit(scf.ROHF(pmol))
     self.assertAlmostEqual(mf.scf(), -75.626515724371814, 9)
开发者ID:diradical,项目名称:pyscf,代码行数:7,代码来源:test_dfhf.py


示例2: test_uhf_veff

 def test_uhf_veff(self):
     mf = scf.density_fit(scf.UHF(mol), auxbasis='weigend')
     nao = mol.nao_nr()
     numpy.random.seed(1)
     dm = numpy.random.random((2,4,nao,nao))
     vhf = mf.get_veff(mol, dm, hermi=0)
     self.assertAlmostEqual(numpy.linalg.norm(vhf), 413.82341595365853, 9)
开发者ID:chrinide,项目名称:pyscf,代码行数:7,代码来源:test_df_jk.py


示例3: test_uhf_veff

 def test_uhf_veff(self):
     mf = scf.density_fit(scf.UHF(mol))
     nao = mol.nao_nr()
     numpy.random.seed(1)
     dm = numpy.random.random((4,nao,nao))
     vhf = mf.get_veff(mol, dm, hermi=0)
     self.assertAlmostEqual(numpy.linalg.norm(vhf), 188.34081056589872, 9)
开发者ID:diradical,项目名称:pyscf,代码行数:7,代码来源:test_dfhf.py


示例4: test_rohf_symm

 def test_rohf_symm(self):
     pmol = mol.copy()
     pmol.charge = 1
     pmol.spin = 1
     pmol.symmetry = 1
     pmol.build(False, False)
     mf = scf.density_fit(scf.ROHF(pmol), auxbasis='weigend')
     self.assertAlmostEqual(mf.scf(), -75.626515724371814, 9)
开发者ID:chrinide,项目名称:pyscf,代码行数:8,代码来源:test_df_jk.py


示例5: test_assign_cderi

    def test_assign_cderi(self):
        nao = mol.nao_nr()
        w, u = scipy.linalg.eigh(mol.intor('int2e_sph', aosym='s4'))
        idx = w > 1e-9

        mf = scf.density_fit(scf.UHF(mol), auxbasis='weigend')
        mf._cderi = (u[:,idx] * numpy.sqrt(w[idx])).T.copy()
        self.assertAlmostEqual(mf.kernel(), -76.026765673110447, 9)
开发者ID:chrinide,项目名称:pyscf,代码行数:8,代码来源:test_df_jk.py


示例6: test_gto2sv_df

 def test_gto2sv_df(self):
   from pyscf import scf
   """ Test import of density-fitting Gaussian functions ... hm """
   mf = scf.density_fit(scf.RHF(mol))
   self.assertAlmostEqual(mf.scf(), -76.025936299702536, 2)
   sv = nao(gto=mol)
   prod_log = prod_log_c().init_prod_log_df(mf.with_df.auxmol, sv)
   self.assertEqual(prod_log.rr[0], sv.ao_log.rr[0])
   self.assertEqual(prod_log.pp[0], sv.ao_log.pp[0])
   self.assertEqual(prod_log.nspecies, sv.ao_log.nspecies)
   self.assertEqual(prod_log.sp2charge, sv.ao_log.sp2charge)
开发者ID:chrinide,项目名称:pyscf,代码行数:11,代码来源:test_0002_prod_basis_nao.py


示例7: test_assign_cderi

    def test_assign_cderi(self):
        nao = molsym.nao_nr()
        w, u = scipy.linalg.eigh(mol.intor('cint2e_sph', aosym='s4'))
        idx = w > 1e-9

        mf = scf.density_fit(scf.RHF(molsym))
        mf._cderi = (u[:,idx] * numpy.sqrt(w[idx])).T.copy()
        mf.kernel()

        mc = mcscf.DFCASSCF(mf, 6, 6)
        mc.kernel()
        self.assertAlmostEqual(mc.e_tot, -108.98010545803884, 7)
开发者ID:berquist,项目名称:pyscf,代码行数:12,代码来源:test_n2_df.py


示例8: test_df_ao2mo

 def test_df_ao2mo(self):
     mf = scf.density_fit(msym)
     mf.max_memory = 100
     mf.kernel()
     mc = mcscf.DFCASSCF(mf, 4, 4)
     eri0 = numpy.dot(mf._cderi.T, mf._cderi)
     nmo = mc.mo_coeff.shape[1]
     ncore = mc.ncore
     nocc = ncore + mc.ncas
     eri0 = ao2mo.restore(1, ao2mo.kernel(eri0, mc.mo_coeff), nmo)
     eris = mc.ao2mo(mc.mo_coeff)
     self.assertTrue(numpy.allclose(eri0[:,:,ncore:nocc,ncore:nocc], eris.ppaa))
     self.assertTrue(numpy.allclose(eri0[:,ncore:nocc,:,ncore:nocc], eris.papa))
开发者ID:v1j4y,项目名称:pyscf,代码行数:13,代码来源:test_n2_df.py


示例9: test_nr_df_rohf

 def test_nr_df_rohf(self):
     mol = gto.Mole()
     mol.build(
         verbose = 0,
         atom = [
         ["O" , (0. , 0.     , 0.)],
         [1   , (0. , -0.757 , 0.587)],
         [1   , (0. , 0.757  , 0.587)] ],
         basis = 'cc-pvdz',
         charge = 1,
         spin = 1,
     )
     mf = scf.density_fit(scf.ROHF(mol))
     mf.conv_tol = 1e-11
     self.assertAlmostEqual(mf.scf(), -75.626515724371899, 9)
开发者ID:raybrad,项目名称:pyscf,代码行数:15,代码来源:test_h2o_vdz.py


示例10: test_nr_df_rohf

 def test_nr_df_rohf(self):
     mol = gto.Mole()
     mol.build(
         verbose = 0,
         atom = [
         ["O" , (0. , 0.     , 0.)],
         [1   , (0. , -0.757 , 0.587)],
         [1   , (0. , 0.757  , 0.587)] ],
         basis = {"H": '6-31g',
                  "O": '6-31g',},
         charge = 1,
         spin = 1,
     )
     mf = scf.density_fit(scf.ROHF(mol))
     mf.conv_tol = 1e-11
     self.assertAlmostEqual(mf.scf(), -75.5775921401438, 9)
开发者ID:raybrad,项目名称:pyscf,代码行数:16,代码来源:test_h2o.py


示例11: test_rhf_veff

 def test_rhf_veff(self):
     nao = mol.nao_nr()
     numpy.random.seed(1)
     dm = numpy.random.random((2,nao,nao))
     mf = scf.density_fit(scf.RHF(mol))
     vhf1 = mf.get_veff(mol, dm, hermi=0)
     naux = mf._cderi.shape[0]
     cderi = numpy.empty((naux,nao,nao))
     for i in range(naux):
         cderi[i] = lib.unpack_tril(mf._cderi[i])
     vj0 = []
     vk0 = []
     for dmi in dm:
         v1 = numpy.einsum('kij,ij->k', cderi, dmi)
         vj0.append(numpy.einsum('kij,k->ij', cderi, v1))
         v1 = numpy.einsum('pij,jk->pki', cderi, dmi.T)
         vk0.append(numpy.einsum('pki,pkj->ij', cderi, v1))
     vj1, vk1 = scf.dfhf.get_jk_(mf, mol, dm, 0)
     self.assertTrue(numpy.allclose(vj0, vj1))
     self.assertTrue(numpy.allclose(numpy.array(vk0), vk1))
     vhf0 = vj1 - vk1 * .5
     self.assertTrue(numpy.allclose(vhf0, vhf1))
开发者ID:diradical,项目名称:pyscf,代码行数:22,代码来源:test_dfhf.py


示例12: test_dhf

 def test_dhf(self):
     pmol = mol.copy()
     pmol.build(False, False)
     mf = scf.density_fit(scf.DHF(pmol))
     self.assertAlmostEqual(mf.scf(), -76.080738685142961, 9)
开发者ID:diradical,项目名称:pyscf,代码行数:5,代码来源:test_dfhf.py


示例13: test_uhf_symm

 def test_uhf_symm(self):
     mf = scf.density_fit(scf.UHF(symol))
     self.assertAlmostEqual(mf.scf(), -76.025936299702536, 9)
开发者ID:diradical,项目名称:pyscf,代码行数:3,代码来源:test_dfhf.py


示例14: test_rhf

 def test_rhf(self):
     mf = scf.density_fit(scf.RHF(mol))
     self.assertAlmostEqual(mf.scf(), -76.025936299702536, 9)
开发者ID:diradical,项目名称:pyscf,代码行数:3,代码来源:test_dfhf.py


示例15: test_rhf_symm

 def test_rhf_symm(self):
     mf = scf.density_fit(scf.RHF(symol), auxbasis='weigend')
     self.assertAlmostEqual(mf.scf(), -76.025936299702536, 9)
开发者ID:chrinide,项目名称:pyscf,代码行数:3,代码来源:test_df_jk.py


示例16: test_nr_df_rhf

 def test_nr_df_rhf(self):
     rhf = scf.density_fit(scf.RHF(mol))
     rhf.conv_tol = 1e-11
     self.assertAlmostEqual(rhf.scf(), -76.025936299701982, 9)
开发者ID:raybrad,项目名称:pyscf,代码行数:4,代码来源:test_h2o_vdz.py


示例17: print

  the Hessian for the large-basis-density-fitted-scf scheme.
"""

mol = gto.Mole()
mol.build(
    verbose=0,
    atom="""8  0  0.     0
              1  0  -0.757 0.587
              1  0  0.757  0.587""",
    basis="ccpvdz",
)

#
# 1. spin-free X2C-HF with density fitting approximation on 2E integrals
#
mf = scf.density_fit(scf.sfx2c(scf.RHF(mol)))
energy = mf.kernel()
print("E = %.12f, ref = -76.075115837941" % energy)

#
# 2. spin-free X2C correction for density-fitting HF.  Since X2C correction is
# commutable with density fitting operation, it is fully equivalent to case 1.
#
mf = scf.sfx2c(scf.density_fit(scf.RHF(mol)))
energy = mf.kernel()
print("E = %.12f, ref = -76.075115837941" % energy)

#
# 3. Newton method for non-relativistic HF
#
mo_init = mf.eig(mf.get_hcore(), mf.get_ovlp())[1]
开发者ID:berquist,项目名称:pyscf,代码行数:31,代码来源:23-decorate_scf.py


示例18: DFMP2

        [8 , (0. , 0.     , 0.)],
        [1 , (0. , -0.757 , 0.587)],
        [1 , (0. , 0.757  , 0.587)]]

    mol.basis = 'cc-pvdz'
    mol.build()
    mf = scf.RHF(mol).run()
    pt = DFMP2(mf)
    emp2, t2 = pt.kernel()
    print(emp2 - -0.204004830285)

    pt.with_df = df.DF(mol)
    pt.with_df.auxbasis = 'weigend'
    emp2, t2 = pt.kernel()
    print(emp2 - -0.204254500453)

    mf = scf.density_fit(scf.RHF(mol), 'weigend')
    mf.kernel()
    pt = DFMP2(mf)
    emp2, t2 = pt.kernel()
    print(emp2 - -0.203986171133)

    pt.with_df = df.DF(mol)
    pt.with_df.auxbasis = df.make_auxbasis(mol, mp2fit=True)
    emp2, t2 = pt.kernel()
    print(emp2 - -0.203738031827)

    pt.frozen = 2
    emp2, t2 = pt.kernel()
    print(emp2 - -0.14433975122418313)
开发者ID:chrinide,项目名称:pyscf,代码行数:30,代码来源:dfmp2.py


示例19: del

    time0 = log.timer('mp2 ao2mo_ovov pass2', *time0)
    return h5dat

del(WITH_T2)


if __name__ == '__main__':
    from pyscf import scf
    from pyscf import gto
    mol = gto.Mole()
    mol.atom = [
        [8 , (0. , 0.     , 0.)],
        [1 , (0. , -0.757 , 0.587)],
        [1 , (0. , 0.757  , 0.587)]]

    mol.basis = 'cc-pvdz'
    mol.build()
    mf = scf.RHF(mol).run()
    mp = MP2(mf)
    mp.verbose = 5

    pt = MP2(mf)
    emp2, t2 = pt.kernel()
    print(emp2 - -0.204019967288338)
    pt.max_memory = 1
    emp2, t2 = pt.kernel()
    print(emp2 - -0.204019967288338)

    pt = MP2(scf.density_fit(mf, 'weigend'))
    print(pt.kernel()[0] - -0.204254500454)
开发者ID:chrinide,项目名称:pyscf,代码行数:30,代码来源:mp2.py


示例20: test_init

    def test_init(self):
        from pyscf import dft
        from pyscf import x2c
        mol_r = mol
        mol_u = gto.M(atom='Li', spin=1, verbose=0)
        mol_r1 = gto.M(atom='H', spin=1, verbose=0)
        sym_mol_r = molsym
        sym_mol_u = gto.M(atom='Li', spin=1, symmetry=1, verbose=0)
        sym_mol_r1 = gto.M(atom='H', spin=1, symmetry=1, verbose=0)
        self.assertTrue(isinstance(scf.RKS(mol_r), dft.rks.RKS))
        self.assertTrue(isinstance(scf.RKS(mol_u), dft.roks.ROKS))
        self.assertTrue(isinstance(scf.UKS(mol_r), dft.uks.UKS))
        self.assertTrue(isinstance(scf.ROKS(mol_r), dft.roks.ROKS))
        self.assertTrue(isinstance(scf.GKS(mol_r), dft.gks.GKS))
        self.assertTrue(isinstance(scf.KS(mol_r), dft.rks.RKS))
        self.assertTrue(isinstance(scf.KS(mol_u), dft.uks.UKS))

        self.assertTrue(isinstance(scf.RHF(mol_r), scf.hf.RHF))
        self.assertTrue(isinstance(scf.RHF(mol_u), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.RHF(mol_r1), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.UHF(mol_r), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.UHF(mol_u), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.UHF(mol_r1), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.ROHF(mol_r), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.ROHF(mol_u), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.ROHF(mol_r1), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.HF(mol_r), scf.hf.RHF))
        self.assertTrue(isinstance(scf.HF(mol_u), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.HF(mol_r1), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.GHF(mol_r), scf.ghf.GHF))
        self.assertTrue(isinstance(scf.GHF(mol_u), scf.ghf.GHF))
        self.assertTrue(isinstance(scf.GHF(mol_r1), scf.ghf.GHF))
        self.assertTrue(not isinstance(scf.DHF(mol_r), scf.dhf.RHF))
        self.assertTrue(isinstance(scf.DHF(mol_u), scf.dhf.UHF))
        self.assertTrue(isinstance(scf.DHF(mol_r1), scf.dhf.HF1e))

        self.assertTrue(isinstance(scf.RHF(sym_mol_r), scf.hf_symm.RHF))
        self.assertTrue(isinstance(scf.RHF(sym_mol_u), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.RHF(sym_mol_r1), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.UHF(sym_mol_r), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.UHF(sym_mol_u), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.UHF(sym_mol_r1), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.ROHF(sym_mol_r), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.ROHF(sym_mol_u), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.ROHF(sym_mol_r1), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.HF(sym_mol_r), scf.hf_symm.RHF))
        self.assertTrue(isinstance(scf.HF(sym_mol_u), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.HF(sym_mol_r1), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.GHF(sym_mol_r), scf.ghf_symm.GHF))
        self.assertTrue(isinstance(scf.GHF(sym_mol_u), scf.ghf_symm.GHF))
        self.assertTrue(isinstance(scf.GHF(sym_mol_r1), scf.ghf_symm.GHF))

        self.assertTrue(isinstance(scf.X2C(mol_r), x2c.x2c.UHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(mol_r)), scf.rhf.RHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(mol_u)), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(mol_r1)), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(sym_mol_r)), scf.rhf_symm.RHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(sym_mol_u)), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.sfx2c1e(scf.HF(sym_mol_r1)), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(mol_r)), scf.rhf.RHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(mol_u)), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(mol_r1)), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(sym_mol_r)), scf.rhf_symm.RHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(sym_mol_u)), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.density_fit(scf.HF(sym_mol_r1)), scf.hf_symm.ROHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(mol_r)), scf.rhf.RHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(mol_u)), scf.uhf.UHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(mol_r1)), scf.rohf.ROHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(sym_mol_r)), scf.rhf_symm.RHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(sym_mol_u)), scf.uhf_symm.UHF))
        self.assertTrue(isinstance(scf.newton(scf.HF(sym_mol_r1)), scf.hf_symm.ROHF))
开发者ID:chrinide,项目名称:pyscf,代码行数:71,代码来源:test_h2o.py



注:本文中的pyscf.scf.density_fit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python symm.label_orb_symm函数代码示例发布时间:2022-05-27
下一篇:
Python addons.sort_mo函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap