def test_opt_gamess(): """ Test Optimization in Gamess using methanol in water. """ methanol = Molecule('test/test_files/ion_methanol.xyz') methanol.properties['symmetry'] = 'Cs' s = Settings() s.specific.gamess.contrl.nzvar = 12 s.specific.gamess.system.timlim = 2 s.specific.gamess.system.mwords = 2 s.specific.gamess.pcm.solvnt = 'water' s.specific.gamess.basis.gbasis = 'sto' s.specific.gamess.basis.ngauss = 3 s.specific.gamess.guess.guess = 'huckel' s.specific.gamess.stapt.optol = '1d-5' s.specific.gamess.zmat["izmat(1)"] = "1,1,2, 1,2,3, 1,3,4, 1,3,5, 1,3,6, \n"\ "2,1,2,3, 2,2,3,4, 2,2,3,5, 2,2,3,6, \n"\ "3,1,2,3,4, 3,1,2,3,5, 3,1,2,3,6" inp = templates.geometry.overlay(s) methanol_geometry = gamess(inp, methanol, work_dir='/tmp') mol_opt = run(methanol_geometry.molecule) coords = concat([a.coords for a in mol_opt.atoms]) expected_coords = [ -0.9956983464, 0.9204754677, -0.0002616586, -0.72585581, -0.0802380791, 2.18166e-05, 0.741292161, 0.0371204735, -1.69738e-05, 1.1448441964, 0.5632291664, -0.9026112278, 1.1448447102, 0.562978981, 0.9027182521, 1.1454516521, -0.9993402516, 1.04943e-05 ] assert abs(sum(zipWith(operator.sub)(coords)(expected_coords))) < 1e-7
def test_opt_orca(): """ Test Orca input generation and run functions. """ h2o = Molecule('test/test_files/h2o.xyz', 'xyz', charge=0, multiplicity=1) h2o_geometry = dftb(templates.geometry, h2o) s = Settings() # generic keyword "basis" must be present in the generic dictionary s.basis = "sto_dzp" # "specific" allows the user to apply specific keywords for a # package that are not in a generic dictionary # s.specific.adf.basis.core = "large" r = templates.singlepoint.overlay(s) h2o_singlepoint = orca(r, h2o_geometry.molecule) dipole = h2o_singlepoint.dipole final_result = run(dipole, n_processes=1) expected_dipole = [0.82409, 0.1933, -0.08316] diff = sqrt(sum((x - y) ** 2 for x, y in zip(final_result, expected_dipole))) print("Expected dipole computed with Orca 3.0.3 is:", expected_dipole) print("Actual dipole is:", final_result) assert diff < 1e-2
def test_opt_orca(): """Test Orca input generation and run functions.""" h2o = Molecule(PATH_MOLECULES / "h2o.xyz", 'xyz', charge=0, multiplicity=1) h2o_geometry = dftb(templates.geometry, h2o) s = Settings() # generic keyword "basis" must be present in the generic dictionary s.basis = "sto_dzp" # s.specific.adf.basis.core = "large" r = templates.singlepoint.overlay(s) h2o_singlepoint = orca(r, h2o_geometry.molecule) dipole = h2o_singlepoint.dipole final_result = run(dipole, n_processes=1) expected_dipole = [0.82409, 0.1933, -0.08316] diff = sqrt(sum((x - y)**2 for x, y in zip(final_result, expected_dipole))) logger.info( f"Expected dipole computed with Orca 3.0.3 is: {expected_dipole}") logger.info(f"Actual dipole is: {final_result}") assertion.lt(diff, 1e-2)
def test_opt_orca(): """ Test Orca input generation and run functions. """ h2o = Molecule('test/test_files/h2o.xyz', 'xyz', charge=0, multiplicity=1) h2o_geometry = dftb(templates.geometry, h2o) s = Settings() # generic keyword "basis" must be present in the generic dictionary s.basis = "sto_dzp" # "specific" allows the user to apply specific keywords for a # package that are not in a generic dictionary # s.specific.adf.basis.core = "large" r = templates.singlepoint.overlay(s) h2o_singlepoint = orca(r, h2o_geometry.molecule) dipole = h2o_singlepoint.dipole final_result = run(dipole, n_processes=1) expected_dipole = [0.82409, 0.1933, -0.08316] diff = sqrt(sum((x - y)**2 for x, y in zip(final_result, expected_dipole))) print("Expected dipole computed with Orca 3.0.3 is:", expected_dipole) print("Actual dipole is:", final_result) assert diff < 1e-2
def test_opt_gamess(): """ Test Optimization in Gamess using methanol in water. """ methanol = Molecule('test/test_files/ion_methanol.xyz') methanol.properties['symmetry'] = 'Cs' s = Settings() s.specific.gamess.contrl.nzvar = 12 s.specific.gamess.system.timlim = 2 s.specific.gamess.system.mwords = 2 s.specific.gamess.pcm.solvnt = 'water' s.specific.gamess.basis.gbasis = 'sto' s.specific.gamess.basis.ngauss = 3 s.specific.gamess.guess.guess = 'huckel' s.specific.gamess.stapt.optol = '1d-5' s.specific.gamess.zmat["izmat(1)"] = "1,1,2, 1,2,3, 1,3,4, 1,3,5, 1,3,6, \n"\ "2,1,2,3, 2,2,3,4, 2,2,3,5, 2,2,3,6, \n"\ "3,1,2,3,4, 3,1,2,3,5, 3,1,2,3,6" inp = templates.geometry.overlay(s) methanol_geometry = gamess(inp, methanol, work_dir='/tmp') mol_opt = run(methanol_geometry.molecule) coords = concat([a.coords for a in mol_opt.atoms]) expected_coords = [-0.9956983464, 0.9204754677, -0.0002616586, -0.72585581, -0.0802380791, 2.18166e-05, 0.741292161, 0.0371204735, -1.69738e-05, 1.1448441964, 0.5632291664, -0.9026112278, 1.1448447102, 0.562978981, 0.9027182521, 1.1454516521, -0.9993402516, 1.04943e-05] assert abs(sum(zipWith(operator.sub)(coords)(expected_coords))) < 1e-7
def test_methanol_opt_orca(): """Run a methanol optimization and retrieve the optimized geom.""" methanol = Molecule(PATH_MOLECULES / "methanol.xyz") s = Settings() s.specific.orca.main = "RKS B3LYP SVP Opt NumFreq TightSCF SmallPrint" s.specific.orca.scf = " print[p_mos] 1" opt = orca(s, methanol) # extract coordinates mol_opt = run(opt.molecule) coords = collapse([a.coords for a in mol_opt.atoms]) logger.info(coords)
def test_hessian_transfer(): """Test DFTB -> Orca hessian transfer.""" h2o = molkit.from_smiles('O') h2o.properties.symmetry = 'C1' h2o_freq = dftb(templates.freq, h2o, job_name="freq").hessian s = Settings() s.inithess = h2o_freq h2o_opt = orca(templates.geometry.overlay(s), h2o, job_name="opt") energy = h2o_opt.energy dipole = h2o_opt.dipole wf = gather(energy, dipole) logger.info(run(wf))
def test_hessian_transfer(): """ Test DFTB -> Orca hessian transfer """ h2o = molkit.from_smiles('O') h2o.properties.symmetry = 'C1' h2o_freq = dftb(templates.freq, h2o, job_name="freq").hessian s = Settings() s.inithess = h2o_freq h2o_opt = orca(templates.geometry.overlay(s), h2o, job_name="opt") energy = h2o_opt.energy dipole = h2o_opt.dipole wf = gather(energy, dipole) print(run(wf))
def test_methanol_opt_orca(): """ Run a methanol optimization and retrieve the optimized geom. """ methanol = Molecule('test/test_files/methanol.xyz') s = Settings() s.specific.orca.main = "RKS B3LYP SVP Opt TightSCF SmallPrint" opt = orca(s, methanol) mol_opt = run(opt.molecule) expected_coords = [-1.311116, -0.051535, -0.000062, 0.097548, 0.033890, -0.000077, -1.683393, -1.092152, -0.000066, -1.734877, 0.448868, 0.891460, -1.734894, 0.448881, -0.891567, 0.460481, -0.857621, -0.000038] coords = concat([a.coords for a in mol_opt.atoms]) assert abs(sum(zipWith(operator.sub)(coords)(expected_coords))) < 1e-7
def test_methanol_opt_orca(): """ Run a methanol optimization and retrieve the optimized geom. """ methanol = Molecule('test/test_files/methanol.xyz') s = Settings() s.specific.orca.main = "RKS B3LYP SVP Opt TightSCF SmallPrint" opt = orca(s, methanol) mol_opt = run(opt.molecule) expected_coords = [ -1.311116, -0.051535, -0.000062, 0.097548, 0.033890, -0.000077, -1.683393, -1.092152, -0.000066, -1.734877, 0.448868, 0.891460, -1.734894, 0.448881, -0.891567, 0.460481, -0.857621, -0.000038 ] coords = concat([a.coords for a in mol_opt.atoms]) assert abs(sum(zipWith(operator.sub)(coords)(expected_coords))) < 1e-7