def test_engine_qchem_geometric(tmpdir): """ Testing EngineQChem by geomeTRIC """ tmpdir.chdir() with open('qc.in', 'w') as outfile: outfile.write(""" $molecule 0 1 H -3.20093 1.59945 -0.91132 O -2.89333 1.61677 -0.01202 O -1.41314 1.60154 0.01202 H -1.10554 1.61886 0.91132 $end $rem jobtype force exchange hf basis 3-21g geom_opt_max_cycles 150 $end """) engine = EngineQChem(input_file='qc.in') assert hasattr(engine, 'M') engine.set_dihedral_constraints([[0, 1, 2, 3, 90]]) try: engine.optimize_geomeTRIC() m = engine.load_geomeTRIC_output() assert pytest.approx(-149.9420, 0.0001) == m.qm_energies[0] except subprocess.CalledProcessError: pass
def test_engine_qchem_native(): """ Testing EngineQChem """ os.mkdir('test.tmp') os.chdir('test.tmp') with open('qc.in', 'w') as outfile: outfile.write(""" $molecule 0 1 H -3.20093 1.59945 -0.91132 O -2.89333 1.61677 -0.01202 O -1.41314 1.60154 0.01202 H -1.10554 1.61886 0.91132 $end $rem jobtype opt exchange hf basis 3-21g geom_opt_max_cycles 150 $end """) engine = EngineQChem(input_file='qc.in', native_opt=True) assert hasattr(engine, 'M') engine.set_dihedral_constraints([[0, 1, 2, 3, 90]]) try: engine.optimize_native() m = engine.load_native_output() assert pytest.approx(-149.9420, 0.0001) == m.qm_energies[0] except subprocess.CalledProcessError: pass os.chdir('..') shutil.rmtree('test.tmp')