Beispiel #1
0
 def from_dict(cls, d):
     h = QChemErrorHandler(input_file=d["input_file"],
                           output_file=d["output_file"],
                           ex_backup_list=d["ex_backup_list"],
                           rca_gdm_thresh=d["rca_gdm_thresh"],
                           scf_max_cycles=d["scf_max_cycles"],
                           geom_max_cycles=d["geom_max_cycles"])
     h.outdata = d["outdata"]
     h.qcinp = QcInput.from_dict(d["qcinp"]) if d["qcinp"] else None
     h.error_step_id = d["error_step_id"]
     h.errors = d["errors"]
     h.fix_step = QcTask.from_dict(d["fix_step"]) if d["fix_step"] else None
     return h
Beispiel #2
0
 def test_to_and_from_dict(self):
     qctask1 = QcTask(mol, title="Test Methane Opt", exchange="B3LYP",
                      jobtype="Opt", basis_set="6-31+G*")
     qctask2 = QcTask(molecule="read", title="Test Methane Frequency",
                      exchange="B3LYP", jobtype="Freq",
                      basis_set="6-31+G*")
     qctask3 = QcTask(title="Test Methane Single Point Energy",
                      exchange="B3LYP", jobtype="SP",
                      basis_set="6-311+G(3df,2p)")
     qcinp1 = QcInput(jobs=[qctask1, qctask2, qctask3])
     d1 = qcinp1.to_dict
     qcinp2 = QcInput.from_dict(d1)
     d2 = qcinp2.to_dict
     self.assertEqual(d1, d2)
Beispiel #3
0
 def check(self):
     # Checks output file for errors.
     self.outdata = QcOutput(self.output_file).data
     self.qcinp = QcInput.from_file(self.input_file)
     self.error_step_id = None
     self.errors = None
     self.fix_step = None
     for i, od in enumerate(self.outdata):
         if od["has_error"]:
             self.error_step_id = i
             self.fix_step = self.qcinp.jobs[i]
             self.errors = sorted(list(set(od["errors"])))
             return True
     return False
Beispiel #4
0
 def _set_qchem_memory(self, qcinp=None):
     if not qcinp:
         qcinp = QcInput.from_file(self.input_file)
     if "PBS_JOBID" in os.environ:
         if "hopque" in os.environ["PBS_JOBID"]:
             # on Hopper
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1100, static=300)
                     else:
                         j.set_memory(total=1100, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=2200, static=500)
                     else:
                         j.set_memory(total=2200, static=100)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=28000, static=10000)
                     else:
                         j.set_memory(total=28000, static=3000)
         elif "edique" in os.environ["PBS_JOBID"]:
             # on Edison
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=2500, static=500)
                     else:
                         j.set_memory(total=2500, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=5000, static=1000)
                     else:
                         j.set_memory(total=5000, static=200)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=60000, static=20000)
                     else:
                         j.set_memory(total=60000, static=5000)
     qcinp.write_file(self.input_file)
Beispiel #5
0
    def test_str_and_from_string(self):
        ans = '''$comments
 Test Methane Opt
$end


$molecule
 0  1
 C           0.00000000        0.00000000        0.00000000
 H           0.00000000        0.00000000        1.08900000
 H           1.02671900        0.00000000       -0.36300000
 H          -0.51336000       -0.88916500       -0.36300000
 Cl         -0.51336000        0.88916500       -0.36300000
$end


$rem
   jobtype = opt
  exchange = b3lyp
     basis = 6-31+g*
$end


@@@


$comments
 Test Methane Frequency
$end


$molecule
 read
$end


$rem
   jobtype = freq
  exchange = b3lyp
     basis = 6-31+g*
$end


@@@


$comments
 Test Methane Single Point Energy
$end


$molecule
 read
$end


$rem
   jobtype = sp
  exchange = b3lyp
     basis = 6-311+g(3df,2p)
$end

'''
        qctask1 = QcTask(mol, title="Test Methane Opt", exchange="B3LYP",
                         jobtype="Opt", basis_set="6-31+G*")
        qctask2 = QcTask(molecule="read", title="Test Methane Frequency",
                         exchange="B3LYP", jobtype="Freq", basis_set="6-31+G*")
        qctask3 = QcTask(title="Test Methane Single Point Energy",
                         exchange="B3LYP", jobtype="SP",
                         basis_set="6-311+G(3df,2p)")
        qcinp1 = QcInput(jobs=[qctask1, qctask2, qctask3])
        self.assertEqual(str(qcinp1), ans)
        qcinp2 = QcInput.from_string(ans)
        self.assertEqual(qcinp1.to_dict, qcinp2.to_dict)