コード例 #1
0
    def test_rhf_0d(self):
        from pyscf.df import mdf_jk
        from pyscf.scf import hf
        L = 4
        cell = pbcgto.Cell()
        cell.build(
            unit='B',
            a=numpy.eye(3) * L * 5,
            gs=[10] * 3,
            atom='''He 2 2 2; He 2 2 3''',
            dimension=0,
            verbose=0,
            basis={'He': [[0, (0.8, 1.0)], [0, (1.0, 1.0)], [0, (1.2, 1.0)]]})
        mol = cell.to_mol()
        mf = mdf_jk.density_fit(hf.RHF(mol))
        mf.with_df.gs = [10] * 3
        mf.with_df.auxbasis = {'He': [[0, (1e6, 1)]]}
        mf.with_df.charge_constraint = False
        mf.with_df.metric = 'S'
        eref = mf.kernel()

        mf = pbchf.RHF(cell)
        mf.with_df = pdf.PWDF(cell)
        mf.exxdiv = None
        mf.get_hcore = lambda *args: hf.get_hcore(mol)
        mf.energy_nuc = lambda *args: mol.energy_nuc()
        e1 = mf.kernel()
        self.assertAlmostEqual(e1, eref, 8)
コード例 #2
0
 def test_hf(self):
     mf = scf.sfx2c1e(scf.RHF(cell))
     mf.with_df = df.PWDF(cell)
     dm = mf.get_init_guess()
     h1 = mf.get_hcore()
     self.assertAlmostEqual(numpy.einsum('ij,ji', dm, h1),
                            -0.547189217727 + 0j, 9)
     kpts = cell.make_kpts([3, 1, 1])
     h1 = mf.get_hcore(kpt=kpts[1])
     self.assertAlmostEqual(numpy.einsum('ij,ji', dm, h1),
                            -0.167141476114 + 0j, 9)
コード例 #3
0
 def test_khf(self):
     lib.param.LIGHT_SPEED, c = 2, lib.param.LIGHT_SPEED
     mf = scf.sfx2c1e(scf.KRHF(cell))
     mf.with_df = df.PWDF(cell)
     mf.kpts = cell.make_kpts([3,1,1])
     dm = mf.get_init_guess()
     h1 = mf.get_hcore()
     self.assertAlmostEqual(numpy.einsum('ij,ji', dm[0], h1[0]),-0.547189217727+0j, 9)
     self.assertAlmostEqual(numpy.einsum('ij,ji', dm[1], h1[1]),-0.167141476114+0j, 9)
     self.assertAlmostEqual(numpy.einsum('ij,ji', dm[2], h1[2]),-0.167141476114+0j, 9)
     lib.param.LIGHT_SPEED = c
コード例 #4
0
 def test_rhf_2d(self):
     L = 4
     cell = pbcgto.Cell()
     cell.build(unit = 'B',
                a = [[L,0,0],[0,L,0],[0,0,L*5]],
                gs = [5,5,10],
                atom = '''He 2 0 0; He 3 0 0''',
                dimension = 2,
                verbose = 0,
                basis = { 'He': [[0, (0.8, 1.0)],
                                 #[0, (1.0, 1.0)],
                                 [0, (1.2, 1.0)]
                                ]})
     mf = pbchf.RHF(cell)
     mf.with_df = pdf.PWDF(cell)
     e1 = mf.kernel()
     self.assertAlmostEqual(e1, -3.2683014249123516, 5)
コード例 #5
0
#
# 0D PBC (molecule)
#
##################################################

e = []
cell = pbcgto.Cell()
cell.build(unit='B',
           a=numpy.eye(3) * 20,
           gs=[10] * 3,
           atom='''H 0 0 0; H 0 0 1.8''',
           dimension=0,
           verbose=0,
           basis='sto3g')
mf = pbchf.RHF(cell)
mf.with_df = pdf.PWDF(cell)
e.append(mf.kernel())

mf = pbchf.RHF(cell)
mf.with_df = pdf.DF(cell)
mf.with_df.auxbasis = 'weigend'
e.append(mf.kernel())

mf = pbchf.RHF(cell)
mf.with_df = pdf.MDF(cell)
mf.with_df.auxbasis = 'weigend'
e.append(mf.kernel())

mol = cell.to_mol()
mf = scf.RHF(mol)
e.append(mf.kernel())