def test_smd_write(self): test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", scf_algorithm="diis", dft_rung=5, smd_solvent="water", max_scf_cycles=35, ) dict_set.write("mol.qin") test_dict = QCInput.from_file("mol.qin").as_dict() rem = { "job_type": "opt", "basis": "6-31G*", "max_scf_cycles": "35", "method": "wb97mv", "geom_opt_max_cycles": "200", "gen_scfman": "true", "scf_algorithm": "diis", "xc_grid": "3", "solvent_method": "smd", "ideriv": "1", "symmetry": "false", "sym_ignore": "true", "resp_charges": "true", } qc_input = QCInput(molecule=test_molecule, rem=rem, smx={"solvent": "water"}) for k, v in qc_input.as_dict().items(): self.assertEqual(v, test_dict[k]) os.remove("mol.qin")
def test_init(self): test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule test_DictSet = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31G*", scf_algorithm="diis", ) self.assertEqual( test_DictSet.rem, { "job_type": "opt", "gen_scfman": "true", "basis": "6-31g*", "max_scf_cycles": "200", "method": "wb97xv", "scf_algorithm": "diis", "xc_grid": "3", "geom_opt_max_cycles": "200", "symmetry": "false", "sym_ignore": "true", "resp_charges": "true", }, ) self.assertEqual(test_DictSet.pcm, {}) self.assertEqual(test_DictSet.solvent, {}) self.assertEqual(test_DictSet.smx, {}) self.assertEqual(test_DictSet.molecule, test_molecule)
def test_pcm_write(self): test_molecule = QCInput.from_file( os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", scf_algorithm="diis", dft_rung=5, pcm_dielectric=10.0, max_scf_cycles=35, ) dict_set.write("mol.qin") test_dict = QCInput.from_file("mol.qin").as_dict() rem = { "job_type": "opt", "basis": "6-31G*", "max_scf_cycles": "35", "method": "wb97mv", "geom_opt_max_cycles": "200", "gen_scfman": "true", "scf_algorithm": "diis", "xc_grid": "3", "thresh": "14", "s2thresh": "16", "solvent_method": "pcm", "symmetry": "false", "sym_ignore": "true", "resp_charges": "true", } pcm = { "heavypoints": "194", "hpoints": "194", "radii": "uff", "theory": "cpcm", "vdwscale": "1.1", } qc_input = QCInput(molecule=test_molecule, rem=rem, pcm=pcm, solvent={"dielectric": "10.0"}) for k, v in qc_input.as_dict().items(): self.assertEqual(v, test_dict[k]) os.remove("mol.qin")
def test_double_solvation(self): test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule raised_error = False dict_set = None try: dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", scf_algorithm="diis", dft_rung=1, pcm_dielectric=10.0, smd_solvent="water", max_scf_cycles=35, ) except ValueError: raised_error = True self.assertTrue(raised_error) self.assertEqual(dict_set, None)
def test_full_init(self): test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule test_DictSet = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", scf_algorithm="diis", dft_rung=1, pcm_dielectric=10.0, max_scf_cycles=35, ) self.assertEqual( test_DictSet.rem, { "job_type": "opt", "gen_scfman": "true", "basis": "6-31g*", "max_scf_cycles": "35", "method": "b3lyp", "geom_opt_max_cycles": "200", "scf_algorithm": "diis", "xc_grid": "3", "solvent_method": "pcm", "symmetry": "false", "sym_ignore": "true", "resp_charges": "true", }, ) self.assertEqual( test_DictSet.pcm, { "heavypoints": "194", "hpoints": "194", "radii": "uff", "theory": "cpcm", "vdwscale": "1.1", }, ) self.assertEqual(test_DictSet.solvent, {"dielectric": 10.0}) self.assertEqual(test_DictSet.molecule, test_molecule) test_DictSet = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", scf_algorithm="diis", dft_rung=1, smd_solvent="water", max_scf_cycles=35, ) self.assertEqual( test_DictSet.rem, { "job_type": "opt", "gen_scfman": "true", "basis": "6-31g*", "max_scf_cycles": "35", "method": "b3lyp", "geom_opt_max_cycles": "200", "scf_algorithm": "diis", "xc_grid": "3", "solvent_method": "smd", "ideriv": "1", "symmetry": "false", "sym_ignore": "true", "resp_charges": "true", }, ) self.assertEqual(test_DictSet.smx, {"solvent": "water"})