Пример #1
0
def run_kcell(cell, ngs, nk):
    #############################################
    # Do a k-point calculation                  #
    #############################################
    abs_kpts = cell.make_kpts(nk, wrap_around=True)

    #############################################
    # Running HF                                #
    #############################################
    #    print ""
    #    print "*********************************"
    #    print "STARTING HF                      "
    #    print "*********************************"
    #    print ""
    kmf = pbchf.KRHF(cell, abs_kpts, exxdiv=None)
    kmf.conv_tol = 1e-14
    #kmf.verbose = 7
    ekpt = kmf.scf()
    #    print "scf energy (per unit cell) = %.17g" % ekpt

    #############################################
    # Running CCSD                              #
    #############################################
    #    print ""
    #    print "*********************************"
    #    print "STARTING CCSD                    "
    #    print "*********************************"
    #    print ""

    cc = pyscf.pbc.cc.kccsd_rhf.RCCSD(kmf)
    cc.conv_tol = 1e-8
    cc.verbose = 7
    ecc, t1, t2 = cc.kernel()
    #    print "cc energy (per unit cell) = %.17g" % ecc
    return ekpt, ecc
Пример #2
0
def run_kcell(cell, n, nk):
    abs_kpts = cell.make_kpts(nk, wrap_around=True)

    # RHF calculation
    kmf = pbchf.KRHF(cell, abs_kpts, exxdiv=None)
    kmf.conv_tol = 1e-14
    ekpt = kmf.scf()

    # RCCSD calculation
    cc = pyscf.pbc.cc.kccsd.CCSD(pbchf.addons.convert_to_ghf(kmf))
    cc.conv_tol = 1e-8
    ecc, t1, t2 = cc.kernel()
    return ekpt, ecc
Пример #3
0
def test_cell(cell, ngs, nk):
    #############################################
    # Do a supercell Gamma-pt calculation       #
    #############################################
    supcell = pyscf.pbc.tools.super_cell(cell, nk)
    supcell.gs = np.array([
        nk[0] * ngs + 1 * (nk[0] - 1) // 2, nk[1] * ngs + 1 * (nk[1] - 1) // 2,
        nk[2] * ngs + 1 * (nk[2] - 1) // 2
    ])
    print "supcell gs =", supcell.gs
    supcell.build()

    scaled_gamma = ase.dft.kpoints.monkhorst_pack((1, 1, 1))
    gamma = supcell.get_abs_kpts(scaled_gamma)

    #############################################
    # Running HF                                #
    #############################################
    print ""
    print "*********************************"
    print "STARTING HF                      "
    print "*********************************"
    print ""

    mf = pbchf.RHF(supcell, exxdiv=None)
    mf.conv_tol = 1e-15
    #mf.verbose = 7
    escf = mf.scf()
    escf_per_cell = escf / np.prod(nk)
    print "scf energy (per unit cell) = %.17g" % escf_per_cell

    #############################################
    # Running CCSD                              #
    #############################################
    print ""
    print "*********************************"
    print "STARTING CCSD                    "
    print "*********************************"
    print ""
    cc = pyscf.pbc.cc.CCSD(mf)
    cc.conv_tol = 1e-15
    #cc.verbose = 7
    ecc, t1, it2 = cc.kernel()
    ecc_per_cell = ecc / np.prod(nk)
    print "cc energy (per unit cell) = %.17g" % ecc_per_cell
    return escf_per_cell, ecc_per_cell
Пример #4
0
def test_cell(cell, ngs, nk):
    #############################################
    # Do a supercell Gamma-pt calculation       #
    #############################################
    supcell = pyscf.pbc.tools.super_cell(cell, nk)
    supcell.gs = np.array([nk[0]*ngs + 1*(nk[0]-1)//2,
                           nk[1]*ngs + 1*(nk[1]-1)//2,
                           nk[2]*ngs + 1*(nk[2]-1)//2])
    print "supcell gs =", supcell.gs
    supcell.build()


    scaled_gamma = ase.dft.kpoints.monkhorst_pack((1,1,1))
    gamma = supcell.get_abs_kpts(scaled_gamma)

    #############################################
    # Running HF                                #
    #############################################
    print ""
    print "*********************************"
    print "STARTING HF                      "
    print "*********************************"
    print ""

    mf = pbchf.RHF(supcell, exxdiv=None)
    mf.conv_tol = 1e-15
    #mf.verbose = 7
    escf = mf.scf()
    escf_per_cell = escf/np.prod(nk)
    print "scf energy (per unit cell) = %.17g" % escf_per_cell

    #############################################
    # Running CCSD                              #
    #############################################
    print ""
    print "*********************************"
    print "STARTING CCSD                    "
    print "*********************************"
    print ""
    cc = pyscf.pbc.cc.CCSD(mf)
    cc.conv_tol=1e-15
    #cc.verbose = 7
    ecc, t1, it2 = cc.kernel()
    ecc_per_cell = ecc/np.prod(nk)
    print "cc energy (per unit cell) = %.17g" % ecc_per_cell
    return escf_per_cell, ecc_per_cell
Пример #5
0
def run_cell(cell, n, nk):
    #############################################
    # Do a supercell Gamma-pt calculation       #
    #############################################
    supcell = pyscf.pbc.tools.super_cell(cell, nk)
    supcell.build()
    gamma = [0, 0, 0]

    mf = pbchf.RHF(supcell, exxdiv=None)
    mf.conv_tol = 1e-14
    #mf.verbose = 7
    escf = mf.scf()
    escf_per_cell = escf / np.prod(nk)

    cc = pyscf.pbc.cc.CCSD(mf)
    cc.conv_tol = 1e-8
    ecc, t1, it2 = cc.kernel()
    ecc_per_cell = ecc / np.prod(nk)
    return escf_per_cell, ecc_per_cell
Пример #6
0
def run_cell(cell, n, nk):
    #############################################
    # Do a supercell Gamma-pt calculation       #
    #############################################
    supcell = pyscf.pbc.tools.super_cell(cell, nk)
    supcell.build()


    gamma = [0,0,0]

    #############################################
    # Running HF                                #
    #############################################
#    print ""
#    print "*********************************"
#    print "STARTING HF                      "
#    print "*********************************"
#    print ""

    mf = pbchf.RHF(supcell, exxdiv=None)
    mf.conv_tol = 1e-14
    #mf.verbose = 7
    escf = mf.scf()
    escf_per_cell = escf/np.prod(nk)
#    print "scf energy (per unit cell) = %.17g" % escf_per_cell

    #############################################
    # Running CCSD                              #
    #############################################
#    print ""
#    print "*********************************"
#    print "STARTING CCSD                    "
#    print "*********************************"
#    print ""
    cc = pyscf.pbc.cc.CCSD(mf)
    cc.conv_tol=1e-8
    #cc.verbose = 7
    ecc, t1, it2 = cc.kernel()
    ecc_per_cell = ecc/np.prod(nk)
#    print "cc energy (per unit cell) = %.17g" % ecc_per_cell
    return escf_per_cell, ecc_per_cell
Пример #7
0
    def test_frozen_n3_high_cost(self):
        mesh = 5
        cell = make_test_cell.test_cell_n3([mesh] * 3)
        nk = (1, 1, 3)
        ehf_bench = -9.15349763559837
        ecc_bench = -0.06713556649654

        abs_kpts = cell.make_kpts(nk, with_gamma_point=True)

        # RHF calculation
        kmf = pbchf.KRHF(cell, abs_kpts, exxdiv=None)
        kmf.conv_tol = 1e-9
        ehf = kmf.scf()

        # KGCCSD calculation, equivalent to running supercell
        # calculation with frozen=[0,1,2] (if done with larger mesh)
        cc = pyscf.pbc.cc.kccsd.CCSD(kmf, frozen=[[0, 1], [], [0]])
        cc.diis_start_cycle = 1
        ecc, t1, t2 = cc.kernel()
        self.assertAlmostEqual(ehf, ehf_bench, 9)
        self.assertAlmostEqual(ecc, ecc_bench, 9)
Пример #8
0
def test_kcell(cell, ngs, nk):
    #############################################
    # Do a k-point calculation                  #
    #############################################
    scaled_kpts = ase.dft.kpoints.monkhorst_pack(nk)
    print "scaled kpts"
    print scaled_kpts
    abs_kpts = cell.get_abs_kpts(scaled_kpts)
    print "abs kpts"
    print abs_kpts

    #############################################
    # Running HF                                #
    #############################################
    print ""
    print "*********************************"
    print "STARTING HF                      "
    print "*********************************"
    print ""
    kmf = pbchf.KRHF(cell, abs_kpts, exxdiv=None)
    kmf.conv_tol = 1e-15
    #kmf.verbose = 7
    ekpt = kmf.scf()
    print "scf energy (per unit cell) = %.17g" % ekpt

    #############################################
    # Running CCSD                              #
    #############################################
    print ""
    print "*********************************"
    print "STARTING CCSD                    "
    print "*********************************"
    print ""

    cc = pyscf.pbc.cc.kccsd.CCSD(kmf,abs_kpts)
    cc.conv_tol=1e-15
    #cc.verbose = 7
    ecc, t1, t2 = cc.kernel()
    print "cc energy (per unit cell) = %.17g" % ecc
    return ekpt, ecc
Пример #9
0
def run_cell(cell, n, nk):
    #############################################
    # Do a supercell Gamma-pt calculation       #
    #############################################
    supcell = pyscf.pbc.tools.super_cell(cell, nk)
    supcell.build()

    gamma = [0, 0, 0]

    #############################################
    # Running HF                                #
    #############################################
    #    print ""
    #    print "*********************************"
    #    print "STARTING HF                      "
    #    print "*********************************"
    #    print ""

    mf = pbchf.RHF(supcell, exxdiv=None)
    mf.conv_tol = 1e-14
    #mf.verbose = 7
    escf = mf.scf()
    escf_per_cell = escf / np.prod(nk)
    #    print "scf energy (per unit cell) = %.17g" % escf_per_cell

    #############################################
    # Running CCSD                              #
    #############################################
    #    print ""
    #    print "*********************************"
    #    print "STARTING CCSD                    "
    #    print "*********************************"
    #    print ""
    cc = pyscf.pbc.cc.CCSD(mf)
    cc.conv_tol = 1e-8
    #cc.verbose = 7
    ecc, t1, it2 = cc.kernel()
    ecc_per_cell = ecc / np.prod(nk)
    #    print "cc energy (per unit cell) = %.17g" % ecc_per_cell
    return escf_per_cell, ecc_per_cell