示例#1
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)],
                            [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        k = cell.make_kpts([cls.k, 1, 1])

        # The Gamma-point reference
        cls.model_rks = model_rks = KRKS(super_cell(cell, [cls.k, 1, 1]))
        model_rks.conv_tol = 1e-14
        model_rks.kernel()

        # K-points
        cls.model_krks = model_krks = KRKS(cell, k)
        model_krks.conv_tol = 1e-14
        model_krks.kernel()

        adjust_mf_phase(model_rks, model_krks)

        ke = numpy.concatenate(model_krks.mo_energy)
        ke.sort()

        # Make sure mo energies are the same
        testing.assert_allclose(model_rks.mo_energy[0], ke)

        # TD
        cls.td_model_rks = td_model_rks = tdp.TDProxy(model_rks, "dft")
        td_model_rks.kernel()

        cls.td_model_krks = td_model_krks = ktdp.TDProxy(model_krks, "dft", [cls.k, 1, 1], KRKS)
        td_model_krks.kernel()

        # GW
        cls.gw = gw.GW(td_model_rks, td.TDRHF(model_rks).ao2mo())
        cls.kgw = kgw.GW(td_model_krks, ktd.TDRHF(model_krks).ao2mo())

        cls.order_k, cls.order_p, cls.order = ov_order_supercell(cls.kgw.imds)

        orbs = []
        for k in range(cls.k):
            for o in numpy.arange(2, 6):
                orbs.append(numpy.where(numpy.logical_and(cls.order_k == k, cls.order_p == o))[0][0])
        cls.gw.orbs = numpy.array(orbs)
        cls.kgw.orbs = numpy.arange(2, 6)
示例#2
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        cls.model_krks = model_krks = KRKS(cell)
        model_krks.kernel()

        cls.td_model_krks = td_model_krks = KTDDFT(model_krks)
        td_model_krks.nroots = 5
        td_model_krks.kernel()

        cls.ref_m_krhf = retrieve_m(td_model_krks)
示例#3
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)],
                            [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        k = cell.make_kpts([cls.k, 1, 1])

        cls.model_krks = model_krks = KRKS(cell, k)
        model_krks.kernel()

        cls.td_model_rks_supercell = kproxy_supercell.TDProxy(model_krks, "dft", [cls.k, 1, 1], KRKS)
        cls.td_model_rks_supercell.kernel()
        cls.ref_m_supercell = cls.td_model_rks_supercell.eri.tdhf_full_form()
示例#4
0
def density_fitting_ks(x):
    """
    Constructs density-fitting (Gamma-point) Kohn-Sham objects.
    Args:
        x (Cell): the supercell;

    Returns:
        The DF-KS object.
    """
    return KRKS(x).density_fit()
示例#5
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        k = cell.get_abs_kpts((.1, .2, .3))

        cls.model_krks = model_krks = KRKS(cell, kpts=k).density_fit()
        model_krks.kernel()
示例#6
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        k = cell.make_kpts([cls.k, 1, 1])

        # K-points
        cls.model_krks = model_krks = KRKS(cell, k)
        model_krks.conv_tol = 1e-14
        model_krks.kernel()

        # Supercell reference
        cls.model_rks = model_rks = kproxy_supercell.k2s(
            model_krks, [cls.k, 1, 1], KRKS)

        # Ensure orbitals are real
        testing.assert_allclose(model_rks.mo_coeff[0].imag, 0, atol=1e-8)

        cls.ov_order = ov_order(model_krks)

        # The Gamma-point TD
        cls.td_model_rks = td_model_rks = KTDDFT(model_rks)
        td_model_rks.kernel()
示例#7
0
    def setUpClass(cls):
        cls.cell = cell = Cell()
        # Lift some degeneracies
        cell.atom = '''
        C 0.000000000000   0.000000000000   0.000000000000
        C 1.67   1.68   1.69
        '''
        cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]}
        # cell.basis = 'gth-dzvp'
        cell.pseudo = 'gth-pade'
        cell.a = '''
        0.000000000, 3.370137329, 3.370137329
        3.370137329, 0.000000000, 3.370137329
        3.370137329, 3.370137329, 0.000000000'''
        cell.unit = 'B'
        cell.verbose = 5
        cell.build()

        k = cell.make_kpts([cls.k, 1, 1])

        # K-points
        cls.model_krks = model_krks = KRKS(cell, k)
        model_krks.conv_tol = 1e-14
        model_krks.kernel()

        # TD
        cls.td_model_srks = td_model_srks = stdp.TDProxy(
            model_krks, "dft", [cls.k, 1, 1], KRKS)
        td_model_srks.kernel()

        cls.td_model_krks = td_model_krks = ktdp.TDProxy(
            model_krks, "dft", [cls.k, 1, 1], KRKS)
        td_model_krks.kernel()

        # GW
        cls.gw = sgw.GW(td_model_srks, std.TDRHF(model_krks).ao2mo())
        cls.kgw = kgw.GW(td_model_krks, ktd.TDRHF(model_krks).ao2mo())