

def test_exit_code_134_after_scf_fix(self):
    shutil.copyfile(os.path.join(test_dir, 'exit_134_after_scf_fix.qcinp'), os.path.join(scr_dir, 'exit_134_after_scf_fix.qcinp'))
    shutil.copyfile(os.path.join(test_dir, 'exit_134_after_scf_fix.qcout'), os.path.join(scr_dir, 'exit_134_after_scf_fix.qcout'))
    h = QChemErrorHandler(input_file='exit_134_after_scf_fix.qcinp', output_file='exit_134_after_scf_fix.qcout')
    has_error = h.check()
    self.assertTrue(has_error)
    d = h.correct()
    self.assertEqual(d, {
        'errors': ['Bad SCF convergence', 'Exit Code 134', 'Geometry optimization failed', 'Molecular charge is not found'],
        'actions': ['use tight integral threshold'],
    })
    with open(os.path.join(test_dir, 'exit_134_after_scf_fix_tight_thresh.qcinp')) as f:
        ref = [line.strip() for line in f.readlines()]
    with open(os.path.join(scr_dir, 'exit_134_after_scf_fix.qcinp')) as f:
        ans = [line.strip() for line in f.readlines()]
    self.assertEqual(ref, ans)
    shutil.copyfile(os.path.join(test_dir, 'exit_134_after_scf_fix_tight_thresh.qcinp'), os.path.join(scr_dir, 'exit_134_after_scf_fix_tight_thresh.qcinp'))
    shutil.copyfile(os.path.join(test_dir, 'exit_134_after_scf_fix.qcout'), os.path.join(scr_dir, 'exit_134_after_scf_fix.qcout'))
    qchem_job = QchemJob(qchem_cmd='qchem -np 24', input_file='exit_134_after_scf_fix_tight_thresh.qcinp', output_file='exit_134_after_scf_fix.qcout', alt_cmd={
        'half_cpus': 'qchem -np 12',
        'openmp': 'qchem -nt 24',
    })
    h = QChemErrorHandler(input_file='exit_134_after_scf_fix_tight_thresh.qcinp', output_file='exit_134_after_scf_fix.qcout', qchem_job=qchem_job)
    has_error = h.check()
    self.assertTrue(has_error)
    d = h.correct()
    self.assertEqual(d, {
        'errors': ['Bad SCF convergence', 'Exit Code 134', 'Geometry optimization failed', 'Molecular charge is not found'],
        'actions': ['openmp'],
    })

dataset/ETHPy150Open materialsproject/custodian/custodian/qchem/tests/test_handlers.py QChemErrorHandlerTest.test_exit_code_134_after_scf_fix/original