def test_engine_terachem_geometric(tmpdir): """ Testing EngineTerachem by geomeTRIC """ tmpdir.chdir() with open('run.in', 'w') as outfile: outfile.write(""" coordinates start.xyz run gradient basis 6-31g* method rb3lyp charge 0 spinmult 1 dispersion yes scf diis+a maxit 50 """) with open('start.xyz', 'w') as outfile: outfile.write("""4\n 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 """) engine = EngineTerachem(input_file='run.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(-151.5334, 0.0001) == m.qm_energies[0] except subprocess.CalledProcessError: pass
def test_engine_terachem_native(): """ Testing EngineTerachem """ os.mkdir('test.tmp') os.chdir('test.tmp') with open('run.in', 'w') as outfile: outfile.write(""" coordinates start.xyz run minimize basis 6-31g* method rb3lyp charge 0 spinmult 1 dispersion yes scf diis+a maxit 50 """) with open('start.xyz', 'w') as outfile: outfile.write("""4\n 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 """) engine = EngineTerachem(input_file='run.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(-151.5334, 0.0001) == m.qm_energies[0] except subprocess.CalledProcessError: pass os.chdir('..') shutil.rmtree('test.tmp')