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)
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
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
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
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
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
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)
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)
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)
def test_qrinp(): calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN") assert calc.qrinp() == """\
def test_triplet_label_default(): zcalc = RspCalc("ZDIPLEN") assert zcalc.triplet_label() == "#"
def test_dal_under(): assert RspCalc(wf='1/4')._dal_ == '1_4' assert RspCalc(wf='1 4')._dal_ == '1_4'
def test_qrinp_trip(): calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN", triplet=True) assert calc.qrinp() == """\
def test_rspinp_ev(): zcalc = RspCalc("ZDIPLEN") assert zcalc.rspinp() == """\
def test_dalinp_ev(): zcalc = RspCalc("YDIPLEN") assert zcalc.dalinp() == """\
def test_triplet_label_true(): zcalc = RspCalc("ZDIPLEN", triplet=True) assert zcalc.triplet_label() == ".TRPFLG"
def test_evinp(): zcalc = RspCalc("ZDIPLEN") assert zcalc.evinp() == """\
def test_rspinp_none(): calc = RspCalc() assert calc.rspinp() == "###"
def test_set_field_none(): zcalc = RspCalc("ZDIPLEN") assert zcalc.finite_field() == "###"
def test_wavinp_with_field(): zcalc = RspCalc("ZDIPLEN", field="YDIPLEN") assert zcalc.wavinp(0.001) == """\
def test_set_field(): zcalc = RspCalc("ZDIPLEN", field="XDIPLEN") assert zcalc.finite_field(0.0005) == "*HAMILTON\n.FIELD\n0.0005\nXDIPLEN"
def test_rspinp_ev_triplet(): zcalc = RspCalc("ZDIPLEN", triplet=True) assert zcalc.rspinp() == """\
def test_rsp_crinp(): calc = RspCalc("XDIPLEN", "YDIPLEN", "ZDIPLEN", "ZDIPLEN") assert calc.rspinp() == """\
def test_z_exe_without_mol(): zcalc = RspCalc("ZDIPLEN") with pytest.raises(MolError): zcalc.exe()