def process_qchem_multirun(dir_name, input_files, output_files): """ Process a QChem run which is known to include multiple calculations in a single input/output pair. """ if len(input_files) != 1: raise ValueError( "ERROR: The drone can only process a directory containing a single input/output pair when each include multiple calculations." ) else: for key in input_files: to_return = [] qchem_input_file = os.path.join(dir_name, input_files.get(key)) qchem_output_file = os.path.join(dir_name, output_files.get(key)) multi_out = QCOutput.multiple_outputs_from_file( QCOutput, qchem_output_file, keep_sub_files=False) multi_in = QCInput.from_multi_jobs_file(qchem_input_file) for ii, out in enumerate(multi_out): d = out.data d["input"] = {} d["input"]["molecule"] = multi_in[ii].molecule d["input"]["rem"] = multi_in[ii].rem d["input"]["opt"] = multi_in[ii].opt d["input"]["pcm"] = multi_in[ii].pcm d["input"]["solvent"] = multi_in[ii].solvent d["task"] = {"type": key, "name": "calc" + str(ii)} to_return.append(d) return to_return
def test_from_multi_jobs_file(self): job_list_test = QCInput.from_multi_jobs_file( os.path.join(test_dir, "pt_n2_wb97mv_0.0.in")) species = [ "S", "C", "H", "C", "H", "C", "H", "C", "C", "C", "H", "C", "H", "C", "H", "S" ] coords = [[-0.00250959, -0.05817469, -0.02921636], [1.70755408, -0.03033788, -0.01382912], [2.24317221, -0.05215019, 0.92026728], [2.21976393, 0.01718014, -1.27293235], [3.27786220, 0.04082146, -1.48539646], [1.20867399, 0.04478540, -2.27007793], [1.40292257, 0.10591684, -3.33110912], [-0.05341046, 0.01577217, -1.74839343], [-1.32843436, 0.03545064, -2.45531187], [-1.55195156, 0.08743920, -3.80184635], [-0.75245172, 0.10267657, -4.52817967], [-2.93293778, 0.08408786, -4.13352169], [-3.31125108, 0.11340328, -5.14405819], [-3.73173288, 0.02741365, -3.03412864], [-4.80776535, 0.00535688, -2.99564645], [-2.81590978, -0.00516172, -1.58990580]] molecule_1_actual = Molecule(species, coords) rem_1_actual = { "job_type": "opt", "method": "wb97m-v", "basis": "def2-tzvppd", "gen_scfman": "true", "geom_opt_max_cycles": "75", "max_scf_cycles": "300", "scf_algorithm": "diis", "scf_guess": "sad", "sym_ignore": "true", "symmetry": "false", "thresh": "14" } opt_1_actual = {"CONSTRAINT": ["tors 6 8 9 10 0.0"]} self.assertEqual(molecule_1_actual, job_list_test[0].molecule) self.assertEqual(rem_1_actual, job_list_test[0].rem) self.assertEqual(opt_1_actual, job_list_test[0].opt) molecule_2_actual = "read" rem_2_actual = { "job_type": "sp", "method": "wb97m-v", "basis": "def2-tzvppd", "gen_scfman": "true", "geom_opt_max_cycles": "75", "max_scf_cycles": "300", "scf_algorithm": "diis", "scf_guess": "read", "sym_ignore": "true", "symmetry": "false", "thresh": "14" } self.assertEqual(molecule_2_actual, job_list_test[1].molecule) self.assertEqual(rem_2_actual, job_list_test[1].rem)
def test_from_multi_jobs_file(self): job_list_test = QCInput.from_multi_jobs_file( os.path.join(test_dir, "pt_n2_wb97mv_0.0.in")) species = ["S", "C", "H", "C", "H", "C", "H", "C", "C", "C", "H", "C", "H", "C", "H", "S"] coords = [[-0.00250959, -0.05817469, -0.02921636], [1.70755408, -0.03033788, -0.01382912], [2.24317221, -0.05215019, 0.92026728], [2.21976393, 0.01718014, -1.27293235], [3.27786220, 0.04082146, -1.48539646], [1.20867399, 0.04478540, -2.27007793], [1.40292257, 0.10591684, -3.33110912], [-0.05341046, 0.01577217, -1.74839343], [-1.32843436, 0.03545064, -2.45531187], [-1.55195156, 0.08743920, -3.80184635], [-0.75245172, 0.10267657, -4.52817967], [-2.93293778, 0.08408786, -4.13352169], [-3.31125108, 0.11340328, -5.14405819], [-3.73173288, 0.02741365, -3.03412864], [-4.80776535, 0.00535688, -2.99564645], [-2.81590978, -0.00516172, -1.58990580]] molecule_1_actual = Molecule(species, coords) rem_1_actual = { "job_type": "opt", "method": "wb97m-v", "basis": "def2-tzvppd", "gen_scfman": "true", "geom_opt_max_cycles": "75", "max_scf_cycles": "300", "scf_algorithm": "diis", "scf_guess": "sad", "sym_ignore": "true", "symmetry": "false", "thresh": "14" } opt_1_actual = {"CONSTRAINT": ["tors 6 8 9 10 0.0"]} self.assertEqual(molecule_1_actual, job_list_test[0].molecule) self.assertEqual(rem_1_actual, job_list_test[0].rem) self.assertEqual(opt_1_actual, job_list_test[0].opt) molecule_2_actual = "read" rem_2_actual = { "job_type": "sp", "method": "wb97m-v", "basis": "def2-tzvppd", "gen_scfman": "true", "geom_opt_max_cycles": "75", "max_scf_cycles": "300", "scf_algorithm": "diis", "scf_guess": "read", "sym_ignore": "true", "symmetry": "false", "thresh": "14" } self.assertEqual(molecule_2_actual, job_list_test[1].molecule) self.assertEqual(rem_2_actual, job_list_test[1].rem)