예제 #1
0
 def _test_property(self, key):
     for file in single_job_out_names:
         self.assertEqual(QCOutput(os.path.join(test_dir, file)).data.get(key), single_job_dict[file].get(key))
     for file in multi_job_out_names:
         outputs = QCOutput.multiple_outputs_from_file(QCOutput, os.path.join(test_dir, file), keep_sub_files=False)
         for i, sub_output in enumerate(outputs):
             self.assertEqual(sub_output.data.get(key), multi_job_dict[file][i].get(key))
예제 #2
0
파일: drones.py 프로젝트: bo-li/atomate
 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
예제 #3
0
 def generate_multi_job_dict():
     """
     Used to generate test dictionary for multiple jobs
     """
     multi_job_dict = {}
     for file in multi_job_out_names:
         outputs = QCOutput.multiple_outputs_from_file(QCOutput, os.path.join(test_dir, file), keep_sub_files=False)
         data = []
         for sub_output in outputs:
             data.append(sub_output.data)
         multi_job_dict[file] = data
     dumpfn(multi_job_dict, "multi_job.json")