示例#1
0
def test_2a():
    system1()
    lbl = "[2a] SCF/cc-pVDZ, Psi4, dertype=1"

    scf_dz, jrec = qcdb.hessian("SCF/cc-pVDZ", return_wfn=True, hess_dertype=1)
    print("HESS OUT")
    print(scf_dz)
    assert compare_arrays(ref_hess_scf_dz, scf_dz, 6, lbl)
    assert compare_arrays(ref_hess_scf_dz, qcdb.variable("CURRENT HESSIAN"), 6,
                          lbl)
    assert compare_arrays(ref_hess_scf_dz,
                          jrec["qcvars"]["CURRENT HESSIAN"].data, 6, lbl)
    assert compare_arrays(ref_scf_dz, jrec["qcvars"]["CURRENT GRADIENT"].data,
                          6, lbl)
    assert compare_arrays(ref_scf_dz, qcdb.variable("CURRENT GRADIENT"), 6,
                          lbl)
    assert compare_values(ref_e_scf_dz, jrec["qcvars"]["CURRENT ENERGY"].data,
                          6, lbl)
    assert compare_values(ref_e_scf_dz, qcdb.variable("CURRENT ENERGY"), 6,
                          lbl)
    #    assert compare_arrays(ref_hess_scf_dz, jrec['qcvars']['HF TOTAL HESSIAN'].data, 6, lbl)
    #    assert compare_arrays(ref_scf_dz, jrec['qcvars']['HF TOTAL GRADIENT'].data, 6, lbl)
    assert compare_values(ref_e_scf_dz, jrec["qcvars"]["HF TOTAL ENERGY"].data,
                          6, lbl)
    # assert compare_arrays(ref_hess_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL HESSIAN'].data, 6, lbl)
    # assert compare_arrays(ref_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL GRADIENT'].data, 6, lbl)
    # assert compare_values(ref_e_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL ENERGY'].data, 6, lbl)
    # TODO provenance kill list
    assert "Psi4" == jrec["provenance"]["creator"], "[1a] prov"
    print(jrec["provenance"])
示例#2
0
def test_sp_rhf_mp2(h2o):
    """cfour/sp-rhf-mp2/input.dat
    #! single-point MP2/qz2p on water

    """
    h2o = qcdb.set_molecule(h2o)
    qcdb.set_options({"cfour_BASIS": "qz2p", "d_convergence": 12})

    e, jrec = qcdb.energy("c4-mp2", return_wfn=True, molecule=h2o)

    scftot = -76.0627484601
    mp2corl = -0.270191667216
    mp2tot = -76.332940127333
    assert compare_values(scftot, qcdb.variable("scf total energy"), 6,
                          tnm() + " SCF")
    assert compare_values(mp2corl, qcdb.variable("mp2 correlation energy"), 6,
                          tnm() + " MP2 corl")
    assert compare_values(mp2tot, qcdb.variable("mp2 total energy"), 6,
                          tnm() + " MP2")
    assert compare_values(scftot, jrec["qcvars"]["HF TOTAL ENERGY"].data, 6,
                          tnm())
    assert compare_values(mp2corl,
                          jrec["qcvars"]["MP2 CORRELATION ENERGY"].data, 6,
                          tnm())
    assert compare_values(mp2tot, jrec["qcvars"]["CURRENT ENERGY"].data, 6,
                          tnm())
示例#3
0
def test_sp_rohf_mp2_sc(nh2):

    nh2 = qcdb.set_molecule(nh2)
    qcdb.set_options({
        # cfour_CALC_level=MP2
        "cfour_BASIS": "qz2p",
        "cfour_REFerence": "ROHF",
        "cfour_OCCUPATION": [[3, 1, 1, 0], [3, 0, 1, 0]],
        "cfour_SCF_CONV": 12,
        "cfour_CC_CONV": 12,
    })

    qcdb.energy("c4-mp2", molecule=nh2)

    scftot = -55.5847372601
    scorl = -0.002983751786
    oscorl = -0.155770420921
    sscorl = -0.041785354569
    mp2corl = -0.200539527276
    mp2tot = -55.785276787341
    assert compare_values(scftot, qcdb.variable("scf total energy"), 6,
                          tnm() + " SCF")
    assert compare_values(scorl, qcdb.variable("mp2 singles energy"), 6,
                          tnm() + " MP2 singles")
    # non printed assert compare_values(oscorl, qcdb.variable('mp2 opposite-spin correlation energy'), 6, tnm() + ' MP2 OS corl')
    # not printed assert compare_values(sscorl, qcdb.variable('mp2 same-spin correlation energy'), 6, tnm() + ' MP2 SS corl')
    assert compare_values(mp2corl, qcdb.variable("mp2 correlation energy"), 6,
                          tnm() + " MP2 corl")
    assert compare_values(mp2corl - scorl, qcdb.variable("mp2 doubles energy"),
                          6,
                          tnm() + " MP2 corl")
    assert compare_values(mp2tot, qcdb.variable("mp2 total energy"), 6,
                          tnm() + " MP2")
示例#4
0
def check_hf(return_value):
    ref = -55.562683879400
    nre = 7.680543797856

    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "hf total")
    assert compare_values(nre, qcdb.variable("NUCLEAR REPULSION ENERGY"), 5,
                          "nre")
示例#5
0
def test_grad():
    h2o = qcdb.set_molecule(
        """
        O      0.00000000    0.00000000    0.00000000
        H      0.00000000    1.93042809   -1.10715266
        H      0.00000000   -1.93042809   -1.10715266
        units au"""
    )

    qcdb.set_options(
        {
            "basis": "sto-3g",
            "scf__e_convergence": 1e-6,
            #'nwchem_driver__tight': True
        }
    )
    val = qcdb.gradient("nwc-scf")

    scf = -74.888142460799
    grads = np.array(
        [[0.000000, 0.000000, 0.058550], [0.000000, 0.140065, -0.029275], [0.000000, -0.140065, -0.029275]]
    )

    assert compare_values(scf, qcdb.variable("HF TOTAL ENERGY"), 5, "scf")
    assert compare_arrays(grads, qcdb.variable("CURRENT GRADIENT"), 5, "scf grad")
示例#6
0
def check_uhf_hf(return_value):
    ref = -55.566057523877
    nre = 7.580905897627

    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "scf")
    assert compare_values(nre, qcdb.variable("NUCLEAR REPULSION ENERGY"), 5,
                          "nre")
示例#7
0
def test_sp_uhf_scf(nh2):
    """cfour/sp-uhf-scf/input.dat
    UHF-SCF energy calculation
    #global testing

    """
    nh2 = qcdb.set_molecule(nh2)

    qcdb.set_options({
        #'cfour_CALC_level': 'HF',
        "cfour_BASIS": "qz2p",
        "cfour_REFerence": "UHF",
        "cfour_occupation": [[3, 1, 1, 0], [3, 0, 1, 0]],
        "cfour_SCF_CONV": 12,
    })

    qcdb.energy("c4-hf")

    ans = -55.5893469688
    assert compare_values(ans, qcdb.variable("scf total energy"), 6,
                          tnm() + "SCF")  # TEST
    assert compare_values(ans, qcdb.variable("current energy"), 6,
                          tnm() + "Current")  # TEST
    assert compare_values(ans, qcdb.variable("current reference energy"), 6,
                          tnm() + "Current ref")  # TEST
示例#8
0
def test_2b():
    system1()
    lbl = "[2b] SCF/cc-pVDZ, Cfour, dertype=1"

    scf_dz, jrec = qcdb.hessian("c4-SCF/cc-pVDZ",
                                return_wfn=True,
                                hess_dertype=1)
    assert compare_arrays(ref_hess_scf_dz, scf_dz, 6, lbl)
    assert compare_arrays(ref_hess_scf_dz, qcdb.variable("CURRENT HESSIAN"), 6,
                          lbl)
    assert compare_arrays(ref_hess_scf_dz,
                          jrec["qcvars"]["CURRENT HESSIAN"].data, 6, lbl)
    assert compare_arrays(ref_scf_dz, jrec["qcvars"]["CURRENT GRADIENT"].data,
                          6, lbl)
    assert compare_arrays(ref_scf_dz, qcdb.variable("CURRENT GRADIENT"), 6,
                          lbl)
    #    assert compare_values(ref_e_scf_dz, jrec['qcvars']['CURRENT ENERGY'].data, 6, lbl)
    #    assert compare_values(ref_e_scf_dz, qcdb.variable('CURRENT ENERGY'), 6, lbl)
    #    assert compare_arrays(ref_hess_scf_dz, jrec['qcvars']['HF TOTAL HESSIAN'].data, 6, lbl)
    #    assert compare_arrays(ref_scf_dz, jrec['qcvars']['HF TOTAL GRADIENT'].data, 6, lbl)
    assert compare_values(ref_e_scf_dz, jrec["qcvars"]["HF TOTAL ENERGY"].data,
                          6, lbl)
    # assert compare_arrays(ref_hess_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL HESSIAN'].data, 6, lbl)
    # assert compare_arrays(ref_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL GRADIENT'].data, 6, lbl)
    # assert compare_values(ref_e_scf_dz, jrec['qcvars']['HF/CC-PVDZ TOTAL ENERGY'].data, 6, lbl)
    assert "CFOUR" == jrec["provenance"]["creator"], "[1b] prov"
示例#9
0
def test_sp_rhf_ccsd_ao(h2o):
    """cfour/sp-rhf-ccsd-ao/input.dat
    #! single point CCSD/qz2p on water

    """
    h2o = qcdb.set_molecule(h2o)
    qcdb.set_options({
        #'cfour_CALC_level': 'CCSD',
        "cfour_BASIS": "qz2p",
        "cfour_abcdtype": "aobasis",
        "cfour_SCF_CONV": 12,
        "cfour_CC_CONV": 12,
    })

    e, jrec = qcdb.energy("c4-ccsd", return_wfn=True, molecule=h2o)

    scftot = -76.062748460117
    mp2tot = -76.332940127333
    ccsdcorl = -0.275705491773
    ccsdtot = -76.338453951890
    assert compare_values(scftot, qcdb.variable("scf total energy"), 6,
                          tnm() + "SCF")
    assert compare_values(mp2tot, qcdb.variable("mp2 total energy"), 6,
                          tnm() + "MP2")
    assert compare_values(ccsdcorl, qcdb.variable("ccsd correlation energy"),
                          6,
                          tnm() + "CCSD corl")
    assert compare_values(ccsdtot, qcdb.variable("ccsd total energy"), 6,
                          tnm() + "CCSD")
示例#10
0
def test_sp_uhf_ccsd(nh2):
    """cfour/sp-uhf-ccsd/input.dat
    #! single-point CCSD/qz2p on NH2

    """
    nh2 = qcdb.set_molecule(nh2)
    qcdb.set_options({
        #'cfour_CALC_level': 'CCSD',
        "cfour_BASIS": "qz2p",
        "cfour_REFerence": "UHF",
        "cfour_occupation": [[3, 1, 1, 0], [3, 0, 1, 0]],
        "cfour_SCF_CONV": 12,
        "cfour_CC_CONV": 12,
    })

    qcdb.energy("c4-ccsd", molecule=nh2)

    scftot = -55.5893469688
    mp2tot = -55.784877360093
    ccsdcorl = -0.213298055172
    assert compare_values(scftot, qcdb.variable("scf total energy"), 6,
                          tnm() + "SCF")
    assert compare_values(mp2tot, qcdb.variable("mp2 total energy"), 6,
                          tnm() + "MP2")
    assert compare_values(ccsdcorl, qcdb.variable("ccsd correlation energy"),
                          6,
                          tnm() + "CCSD")
示例#11
0
def test_1_ccsd():
    h2o = qcdb.set_molecule("""
        O     0.000000000000    0.000000000000   0.22138519
        H     0.000000000000   -1.43013023      -0.88554075
        H     0.000000000000    1.43013023      -0.88554075
        """)
    qcdb.set_options({
        "basis": "cc-pvdz",
        "nwchem_scf__rhf": True,
        "nwchem_scf__thresh": 1.0e-12,
        "nwchem_tce__ccsd": True,
        "qc_module": "tce",
        "nwchem_tce__dipole": True,
        "nwchem_tce__thresh": 1.0e-12,
    })
    print("     Testing ccsd...")
    val = qcdb.energy("nwc-ccsd")

    ref = -75.645078266314
    ccsd_corl = -0.313405482575930
    ccsd_tot = -75.958483748890202
    #   ccsd_dip_z   =   2.1073264  # ATL
    ccsd_dip = np.array([0.0000000, 0.000000, 1.1104046])

    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(ccsd_corl, qcdb.variable("CCSD CORRELATION ENERGY"),
                          5, "ccsd corl")
    assert compare_values(ccsd_tot, qcdb.variable("CCSD TOTAL ENERGY"), 5,
                          "ccsd total")
    assert compare_values(ccsd_dip, qcdb.variable("CCSD DIPOLE"), 5,
                          "ccsd dipole")
示例#12
0
def test_tu2_rohf():
    """tu2-ch2-energy/input.dat
    #! Sample ROHF/6-31G** CH2 computation

    """

    ch2 = qcdb.set_molecule("""
  0 3
  C
  H 1 R
  H 1 R 2 A

  R = 2.05
  A = 133.93
units au
""")

    qcdb.set_options({
        'basis': '6-31G**',
        'reference': ' rohf',
        'puream': 'cart',
        #'psi_scf_type': 'pk'})
        'scf_type': 'pk'
    })

    E, jrec = qcdb.energy('nwc-hf', return_wfn=True)
    print(qcdb.print_variables())

    assert compare_values(_ref_ch2_pk_rohf, qcdb.variable('hf total energy'),
                          6, tnm())
    assert compare_values(_ref_ch2_pk_rohf, qcdb.variable('current energy'), 6,
                          tnm())
    assert compare_values(_ref_ch2_pk_rohf, E, 6, tnm())
示例#13
0
def check_lccd(return_value):
    hf = -74.962663062066
    lccd_tot = -75.013238394202133
    lccd_corl = -0.050575332136568

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(lccd_tot, qcdb.variable("LCCD TOTAL ENERGY"), 5, "lccd tot")
    assert compare_values(lccd_corl, qcdb.variable("LCCD CORRELATION ENERGY"), 5, "lccd corl")
示例#14
0
def check_tce_mp2(return_value):
    hf = -75.645085110552
    mp2_tot = -75.934995820774219
    mp2_corl = -0.289910710222209

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(mp2_tot, qcdb.variable("MP2 TOTAL ENERGY"), 5, "mbpt(2) tot")
    assert compare_values(mp2_corl, qcdb.variable("MP2 CORRELATION ENERGY"), 5, "mbpt(2) corl")
示例#15
0
def check_lccsd(return_value):
    hf = -74.962663062066
    lccsd_tot = -75.01355462478978
    lccsd_corl = -0.050891562718417

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(lccsd_tot, qcdb.variable("LCCSD TOTAL ENERGY"), 5, "lccd tot")
    assert compare_values(lccsd_corl, qcdb.variable("LCCSD CORRELATION ENERGY"), 5, "lccd corl")
示例#16
0
def check_ccsd(return_value):
    ref = -76.026760733967
    ccsd_corl = -0.213341251859034
    ccsd_tot = -76.240101985825859

    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(ccsd_corl, qcdb.variable("CCSD CORRELATION ENERGY"),
                          5, "ccsd corl")
    assert compare_values(ccsd_tot, qcdb.variable("CCSD TOTAL ENERGY"), 5,
                          "ccsd total")
示例#17
0
def check_ccsdtq(return_value):
    ref = -76.010496307079
    nre = 9.187334240165
    ccsdtq = -76.210368641377713
    ccsdtq_corl = -0.199872334299139

    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 6, "hf ref")  # TEST
    assert compare_values(nre, qcdb.variable("NUCLEAR REPULSION ENERGY"), 5, "nre")
    assert compare_values(ccsdtq, qcdb.variable("CCSDTQ TOTAL ENERGY"), 6, "CCSDTQ")  # TEST
    assert compare_values(ccsdtq_corl, qcdb.variable("CCSDTQ CORRELATION ENERGY"), 6, "CCSDTQ corl")  # TEST
示例#18
0
def check_dipole(return_value):

    dip_x = -0.0000000000
    dip_y = -0.0000000000
    dip_z = -2.2247923027
    dip_grad = np.array([-0.0000000, -0.000000, -2.2247923027])

    assert compare_values(dip_x, qcdb.variable("CURRENT DIPOLE X"), 5, "dip x")
    assert compare_values(dip_y, qcdb.variable("CURRENT DIPOLE Y"), 5, "dip y")
    assert compare_values(dip_z, qcdb.variable("CURRENT DIPOLE Z"), 5, "dip z")
    assert compare_values(dip_grad, qcdb.variable("CURRENT DIPOLE GRADIENT"), 5, "dip array")
示例#19
0
def check_qcisd(return_value):
    hf = -74.962663062066
    qcisd_tot = -75.012808319270690
    qcisd_corl = -0.050145257149164

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(qcisd_tot, qcdb.variable("QCISD TOTAL ENERGY"), 5,
                          "qcisd tot")
    assert compare_values(qcisd_corl,
                          qcdb.variable("QCISD CORRELATION ENERGY"), 5,
                          "qcisd corl")
示例#20
0
def tce_uccsd(return_value):

    hf = -74.656470840577
    ccsd_tot = -74.695659393231864
    ccsd_corl = -0.039188552654924

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(ccsd_tot, qcdb.variable("CCSD TOTAL ENERGY"), 5,
                          "ccsd tot")
    assert compare_values(ccsd_corl, qcdb.variable("CCSD CORRELATION ENERGY"),
                          5, "ccsd corl")
示例#21
0
def check_tce_mp3(return_value):
    hf = -75.645085110552
    mp2_tot = -75.934995820774219
    mp2_corl = -0.289910710222209
    mp3_tot = -75.924895885924158
    mp3_corr = 0.010099934850061

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(mp2_tot, qcdb.variable("MP2 TOTAL ENERGY"), 5, "mbpt(2) tot")
    assert compare_values(mp2_corl, qcdb.variable("MP2 CORRELATION ENERGY"), 5, "mbpt(2) corl")
    assert compare_values(mp3_tot, qcdb.variable("MP3 TOTAL ENERGY"), 5, "mp3 tot")
    assert compare_values(mp3_corr, qcdb.variable("MP3 CORRECTION ENERGY"), 5, "mp3 corr")
示例#22
0
def test_1a(system1):
    h2 = system1
    refene = test1_ene
    lbl = tnm() + " [1] SCF/cc-pVDZ Optimized R"
    assert compare_values(0.529177208590000 * a2a, h2.nuclear_repulsion_energy(), 9, "Nuclear repulsion energy")

    ene, jrec = qcdb.optking("SCF/cc-pVDZ", return_wfn=True, molecule=h2)
    assert compare_values(refene, ene, 6, lbl)
    assert compare_values(refene, jrec["qcvars"]["CURRENT ENERGY"].data, 4, lbl)
    assert compare_values(refene, qcdb.variable("CURRENT ENERGY"), 4, lbl)
    assert compare_values(0.0, np.sqrt(np.mean(np.square(jrec["qcvars"]["CURRENT GRADIENT"].data))), 4, lbl)
    assert compare_values(0.0, np.sqrt(np.mean(np.square(qcdb.variable("CURRENT GRADIENT")))), 4, lbl)
    assert compare_values(test1_R, h2.R, 4, lbl)
示例#23
0
def check_ccsd_t_(return_value, is5050):
    hf = -108.929838333552
    nre = 25.929685200985
    mp2_tot = -109.213451339803015
    mp2_corl = -0.283613006250685
    ccsd_corr = -0.292081644010763
    ccsd_tot = -109.221919977563090
    scs_ccsd_corl = -0.361897318565201
    scs_ccsd_tot = -109.291735652117524
    os = -0.227464720235995 * 1.27
    ss = -0.064616923774767 * 1.13
    #    a5050_corl  =   0.5*(ss + os)
    #    a5050_tot   =   a5050_corl + scs_ccsd_tot
    t_corr = -0.009217759273267
    ccsd_t_corl = ccsd_corr + t_corr
    ccsd_t_tot = -109.231137736836359

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(nre, qcdb.variable("NUCLEAR REPULSION ENERGY"), 5,
                          "nre")
    assert compare_values(mp2_tot, qcdb.variable("MP2 TOTAL ENERGY"), 5,
                          "mp2 tot")
    assert compare_values(mp2_corl, qcdb.variable("MP2 CORRELATION ENERGY"), 5,
                          "mp2 corl")
    assert compare_values(ccsd_tot, qcdb.variable("CCSD TOTAL ENERGY"), 5,
                          "ccsd tot")
    assert compare_values(t_corr, qcdb.variable("(T) CORRECTION ENERGY"), 5,
                          "t corr")
    assert compare_values(ccsd_t_tot, qcdb.variable("CCSD(T) TOTAL ENERGY"), 5,
                          "ccsd(t) tot")
    assert compare_values(ccsd_t_corl,
                          qcdb.variable("CCSD(T) CORRELATION ENERGY"), 5,
                          "ccsd(t) corl")
示例#24
0
def check_mp2(return_value, is5050):
    ref = -76.026760737428
    nre = 9.187334240165
    mp2_tot = -76.230777733733
    scs_mp2_tot = -76.226922314540
    scs_corl = -0.200161577112
    os = -0.152487590397 * (6 / 5)
    ss = -0.051529405908 * (1 / 3)
    a5050corl = 0.5 * (os + ss)
    a5050tot = a5050corl + ref
    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5,
                          "scf total")
    assert compare_values(mp2_tot, qcdb.variable("MP2 TOTAL ENERGY"), 5,
                          "mp2 energy")
示例#25
0
def tce_ccd(return_value):

    hf = -74.962663062074
    ccd_tot = -75.012515193677402
    ccd_corl = -0.049852131603433
    # x       = 0.0000000
    # y       = 0.0000000
    # z       = -1.6930528

    assert compare_values(hf, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(ccd_tot, qcdb.variable("CCD TOTAL ENERGY"), 5,
                          "ccsd tot")
    assert compare_values(ccd_corl, qcdb.variable("CCD CORRELATION ENERGY"), 5,
                          "ccsd corl")
示例#26
0
def test_6b():
    system1()
    lbl = "[6b] MP2/cc-pV[DT]Z, Cfour"

    mp2_dtz, jrec = qcdb.hessian("c4-MP2/cc-pV[DT]Z", return_wfn=True)
    assert compare_arrays(ref_hess_mp2_dtz, mp2_dtz, 6, lbl)
    assert compare_arrays(ref_hess_mp2_dtz, qcdb.variable("CURRENT HESSIAN"),
                          6, lbl)
    assert compare_arrays(ref_hess_mp2_dtz,
                          jrec["qcvars"]["CURRENT HESSIAN"].data, 6, lbl)
    assert compare_arrays(ref_grad_mp2_dtz,
                          jrec["qcvars"]["CURRENT GRADIENT"].data, 6, lbl)
    assert compare_arrays(ref_grad_mp2_dtz, qcdb.variable("CURRENT GRADIENT"),
                          6, lbl)
示例#27
0
def check_hf(return_value):
    ref = -76.026760737428
    nre = 9.187334240165
    grads = np.array([[0.000000, -0.000000, -0.015191],
                      [-0.000000, -0.010677, 0.007595],
                      [0.000000, 0.010677, 0.007595]])
    assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "hf ref")
    assert compare_values(nre, qcdb.variable("NUCLEAR REPULSION ENERGY"), 5,
                          "nre")
    pprint.pprint(grads)
    pprint.pprint(qcdb.variable("CURRENT GRADIENT"))

    assert compare_arrays(grads, qcdb.variable("CURRENT GRADIENT"), 5,
                          "hf grad")
def test_sp_ccsd_uhf_fc(method, keywords, nh2):
    """cfour/sp-uhf-ccsd/input.dat
    #! single-point CCSD/qz2p on NH2

    """
    nh2 = qcdb.set_molecule(nh2)
    qcdb.set_options(keywords)

    e = qcdb.energy(method, molecule=nh2)

    scf_tot = -55.5893469688
    mp2_tot = -55.760531091893
    ccsd_tot = -55.777664191533

    mp2_corl = mp2_tot - scf_tot
    ccsd_corl = ccsd_tot - scf_tot

    atol = 1.e-6

    # cc terms
    assert compare_values(ccsd_tot, e, tnm() + ' Returned', atol=atol)
    assert compare_values(ccsd_tot, qcdb.variable('current energy'), tnm() + ' Current', atol=atol)
    assert compare_values(ccsd_tot, qcdb.variable('ccsd total energy'), tnm() + ' CCSD', atol=atol)
    assert compare_values(ccsd_corl, qcdb.variable('current correlation energy'), tnm() + ' CCSD', atol=atol)
    assert compare_values(ccsd_corl, qcdb.variable('ccsd correlation energy'), tnm() + ' CCSD', atol=atol)

    # mp2 terms (not printed for nwc tce)
    if not (method.startswith('nwc') and keywords.get('qc_module', 'nein').lower() == 'tce'):
        assert compare_values(mp2_tot, qcdb.variable('mp2 total energy'), tnm() + ' MP2', atol=atol)
        assert compare_values(mp2_corl, qcdb.variable('mp2 correlation energy'), tnm() + ' MP2', atol=atol)

    # hf terms
    assert compare_values(scf_tot, qcdb.variable('hf total energy'), tnm() + ' SCF', atol=atol)
    assert compare_values(scf_tot, qcdb.variable('scf total energy'), tnm() + ' SCF', atol=atol)
示例#29
0
def check_dft(return_value, is_dft):
    if is_dft:
        ref = -75.312572965120
        ccsdt_tot = -75.362578004794031
        ccsdt_corl = -0.050005039673792
        assert compare_values(ref, qcdb.variable("DFT TOTAL ENERGY"), 5, "dft ref")
    else:  # change values for non-dft
        ref = -74.963048525888
        ccsdt_tot = -75.012605624645104
        ccsdt_corl = -0.049557089026546
        nre = 9.187333574703
        assert compare_values(ref, qcdb.variable("HF TOTAL ENERGY"), 5, "dft ref")
    assert compare_values(ccsdt_tot, qcdb.variable("CCSDT TOTAL ENERGY"), 5, "ccsdt total")
    assert compare_values(ccsdt_corl, qcdb.variable("CCSDT CORRELATION ENERGY"), 5, "ccsdt corl")
示例#30
0
def check_ccsd_t_pr_br(return_value):
    ccsd_tot = -76.240077811301250
    ccsd_corl = -0.213269954065481
    t_br_corr = -0.003139909173705
    t_br_corl = -0.216409863239186
    ccsd_t_br = -76.243217720474960
    t_pr_corr = -0.003054718622142
    t_pr_corl = -0.216324672687623
    ccsd_t_pr = -76.243132529923390

    assert compare_values(ccsd_tot, qcdb.variable("CCSD TOTAL ENERGY"), 5,
                          "ccsd total")
    assert compare_values(ccsd_corl, qcdb.variable("CCSD CORRELATION ENERGY"),
                          5, "ccsd corl")
    assert compare_values(t_br_corr,
                          qcdb.variable("T(CCSD) CORRECTION ENERGY"), 5,
                          "[t] corr")
    assert compare_values(t_br_corl,
                          qcdb.variable("CCSD+T(CCSD) CORRELATION ENERGY"), 5,
                          "ccsd[t] corl")
    assert compare_values(ccsd_t_br,
                          qcdb.variable("CCSD+T(CCSD) TOTAL ENERGY"), 5,
                          "ccsd[t] total")
    assert compare_values(t_pr_corr, qcdb.variable("(T) CORRECTION ENERGY"), 5,
                          "(t) corr")
    assert compare_values(t_pr_corl,
                          qcdb.variable("CCSD(T) CORRELATION ENERGY"), 5,
                          "ccsd(t) corl")
    assert compare_values(ccsd_t_pr, qcdb.variable("CCSD(T) TOTAL ENERGY"), 5,
                          "ccsd(t) tot")