def test_run_response(functional, suppdir):
    wf = dft(functional)
    dal = functional
    escf = FinDif(
        RspCalc(wf=wf, dal=dal, mol=inp["h2o"], field="YDIPLEN",
                delta=0.001)).first()
    ev = RspCalc("YDIPLEN", wf=wf, dal=dal, mol=inp["h2o"]).exe()
    assert_(escf, ev)
def test_run_response(functional, suppdir):
    wf = dft(functional)
    dal = functional
    ev = FinDif(
        RspCalc("XXQUADRU",
                wf=wf,
                dal=dal,
                mol=inp["h2o+"],
                field="YDIPLEN",
                delta=0.001000)).first()
    lr = RspCalc("XXQUADRU", "YDIPLEN", wf=wf, dal=dal, mol=inp["h2o+"]).exe()
    assert_(ev, lr)
Exemple #3
0
def test_read_z(mock_open):

    output_line = "YDIPLEN  total        :    -1.03702475"
    mock_open.return_value = mock_loop(output_line)

    calc = RspCalc('YDIPLEN')
    assert calc.get_output() == -1.03702475
Exemple #4
0
def test_read_yz(mock_open):

    output_line = "@ -<< XXQUADRU ; YDIPLEN  >> =  4.395689062431D-01"
    mock_open.return_value = mock_loop(output_line)

    calc = RspCalc('XXQUADRU', 'YDIPLEN')
    assert calc.get_output() == -4.395689062431e-01
Exemple #5
0
def test_read_xyz(mock_open):

    output_line = "@ omega B, omega C, QR value :     0.00000000     0.00000000 3.68627919"
    mock_open.return_value = mock_loop(output_line)

    calc = RspCalc('XDIPLEN', 'YDIPLEN', 'ZDIPLEN')
    assert calc.get_output() == 3.68627919
Exemple #6
0
def test_read_energy(mock_open):

    output_line = "Final energy: 3.14"
    mock_open.return_value = mock_loop(output_line)

    calc = RspCalc()
    assert calc.get_output() == 3.14
Exemple #7
0
def test_read_xyz(mock_open):

    output_line = "@ << A; B, C, D >>  =         -30.99202444"
    mock_open.return_value = mock_loop(output_line)

    calc = RspCalc('XDIPLEN', 'YDIPLEN', 'ZDIPLEN', 'WDIPLEN')
    assert calc.get_output() == -30.99202444
Exemple #8
0
def test_z_setup():
    zcalc = RspCalc("ZDIPLEN")
    assert zcalc.parallel
    assert zcalc.wf == 'HF'
    assert zcalc.delta == 0
    assert zcalc.ops == ("ZDIPLEN", )
    assert not zcalc.triplet
    assert zcalc.aux == "#"
    assert zcalc.dal == zcalc.wf
    assert zcalc.mol == None
def test_run_response(functional, suppdir):
    wf = dft(functional)
    dal = functional
    qr = FinDif(
        RspCalc('XXQUADRU',
                'YYQUADRU',
                'ZZQUADRU',
                wf=wf,
                dal=dal,
                mol=inp["h2o"],
                field='YDIPLEN',
                delta=0.001000)).first()
    cr = RspCalc('XXQUADRU',
                 'YYQUADRU',
                 'ZZQUADRU',
                 'YDIPLEN',
                 wf=wf,
                 dal=dal,
                 mol=inp["h2o"]).exe()
    assert_(qr, cr)
Exemple #10
0
def test_run_response(functional, suppdir):
    wf = dft(functional)
    dal = functional
    lr = FinDif(
        RspCalc(
            "XXQUADRU",
            "YYQUADRU",
            wf=wf,
            dal=dal,
            mol=inp["h2o+"],
            field="YDIPLEN",
            delta=0.001000,
        )).first()
    qr = RspCalc(
        "XXQUADRU",
        "YYQUADRU",
        "YDIPLEN",
        wf=wf,
        dal=dal,
        mol=inp["h2o+"],
        parallel=False,
    ).exe()
    assert_(lr, qr)
Exemple #11
0
def test_call(mock_call, mock_open, mock_cpu_count):
    calc = RspCalc(wf='yo', mol='yo')

    mock_cpu_count.return_value = 8
    mock_call.return_value = 0
    mock_file = mock.MagicMock()
    mock_open().__enter__.return_value = mock_file

    calc.run()

    mock_call.assert_called_once_with('dalton -N 8 -d -t /tmp/ExpVal_yo yo',
                                      stdout=mock_file,
                                      stderr=mock_file,
                                      shell=True)
Exemple #12
0
def test_qrinp():
    calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN")
    assert calc.qrinp() == """\
Exemple #13
0
def test_triplet_label_default():
    zcalc = RspCalc("ZDIPLEN")
    assert zcalc.triplet_label() == "#"
Exemple #14
0
def test_dal_under():
    assert RspCalc(wf='1/4')._dal_ == '1_4'
    assert RspCalc(wf='1 4')._dal_ == '1_4'
Exemple #15
0
def test_qrinp_trip():
    calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN", triplet=True)
    assert calc.qrinp() == """\
Exemple #16
0
def test_rspinp_ev():
    zcalc = RspCalc("ZDIPLEN")
    assert zcalc.rspinp() == """\
Exemple #17
0
def test_dalinp_ev():
    zcalc = RspCalc("YDIPLEN")
    assert zcalc.dalinp() == """\
Exemple #18
0
def test_triplet_label_true():
    zcalc = RspCalc("ZDIPLEN", triplet=True)
    assert zcalc.triplet_label() == ".TRPFLG"
Exemple #19
0
def test_evinp():
    zcalc = RspCalc("ZDIPLEN")
    assert zcalc.evinp() == """\
Exemple #20
0
def test_rspinp_none():
    calc = RspCalc()
    assert calc.rspinp() == "###"
Exemple #21
0
def test_set_field_none():
    zcalc = RspCalc("ZDIPLEN")
    assert zcalc.finite_field() == "###"
Exemple #22
0
def test_wavinp_with_field():
    zcalc = RspCalc("ZDIPLEN", field="YDIPLEN")
    assert zcalc.wavinp(0.001) == """\
Exemple #23
0
def test_set_field():
    zcalc = RspCalc("ZDIPLEN", field="XDIPLEN")
    assert zcalc.finite_field(0.0005) == "*HAMILTON\n.FIELD\n0.0005\nXDIPLEN"
Exemple #24
0
def test_rspinp_ev_triplet():
    zcalc = RspCalc("ZDIPLEN", triplet=True)
    assert zcalc.rspinp() == """\
Exemple #25
0
def test_rsp_crinp():
    calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN", "ZDIPLEN")
    assert calc.rspinp() == """\
Exemple #26
0
def test_z_exe_without_mol():
    zcalc = RspCalc("ZDIPLEN")
    with pytest.raises(MolError):
        zcalc.exe()