Exemple #1
0
 def freq_fw(self,
             charge,
             spin_multiplicity,
             fw_id_cal,
             fw_id_db,
             priority=None,
             method=None):
     if not method:
         if self.large:
             method = "PBE-D3/6-31+G*"
         else:
             method = "B3lYP/6-31+G*"
     task_type = "vibrational frequency"
     state_name = self.get_state_name(charge, spin_multiplicity)
     title = self.molname + " " + state_name + " " + method + " " + task_type
     exchange, correlation, basis_set, aux_basis, rem_params, method_token, ecp = self. \
         get_exchange_correlation_basis_auxbasis_remparams(method, self.mol)
     if exchange.lower() in ["xygjos"]:
         rem_params["IDERIV"] = 1
     qctask = QcTask(self.mol,
                     charge=charge,
                     spin_multiplicity=spin_multiplicity,
                     jobtype="freq",
                     title=title,
                     exchange=exchange,
                     correlation=correlation,
                     basis_set=basis_set,
                     aux_basis_set=aux_basis,
                     ecp=ecp,
                     rem_params=rem_params)
     if self.large:
         qctask.set_scf_algorithm_and_iterations(iterations=100)
     qcinp = QcInput([qctask])
     spec = self.base_spec()
     spec["qcinp"] = qcinp.as_dict()
     spec['task_type'] = task_type
     spec['charge'] = charge
     spec['spin_multiplicity'] = spin_multiplicity
     spec['run_tags']['methods'] = method_token
     spec["qm_method"] = method
     if priority:
         spec['_priority'] = priority
     task_name = self.molname + ' ' + state_name + ' ' + task_type
     from rubicon.firetasks.qchem.multistep_qchem_task \
         import QChemFrequencyDBInsertionTask
     fw_freq_cal = Firework([QChemTask()],
                            spec=spec,
                            name=task_name,
                            fw_id=fw_id_cal)
     spec_db = copy.deepcopy(spec)
     del spec_db['_dupefinder']
     spec_db['_allow_fizzled_parents'] = True
     spec_db['task_type'] = task_type + ' DB Insertion'
     del spec_db["_trackers"][:2]
     task_name_db = task_name + " DB Insertion"
     fw_freq_db = Firework([QChemFrequencyDBInsertionTask()],
                           spec=spec_db,
                           name=task_name_db,
                           fw_id=fw_id_db)
     return fw_freq_cal, fw_freq_db
Exemple #2
0
 def _run_qchem_on_alcf(self, log_file_object=None):
     parent_qcinp = QcInput.from_file(self.input_file)
     njobs = len(parent_qcinp.jobs)
     return_codes = []
     alcf_cmds = []
     qc_jobids = []
     for i, j in enumerate(parent_qcinp.jobs):
         qsub_cmd = copy.deepcopy(self.current_command)
         sub_input_filename = "alcf_{}_{}".format(i + 1, self.input_file)
         sub_output_filename = "alcf_{}_{}".format(i + 1, self.output_file)
         sub_log_filename = "alcf_{}_{}".format(i + 1, self.qclog_file)
         qsub_cmd[-2] = sub_input_filename
         sub_qcinp = QcInput([copy.deepcopy(j)])
         if "scf_guess" in sub_qcinp.jobs[0].params["rem"] and \
                 sub_qcinp.jobs[0].params["rem"]["scf_guess"] == "read":
             sub_qcinp.jobs[0].params["rem"].pop("scf_guess")
         if i > 0:
             if isinstance(j.mol, str) and j.mol == "read":
                 prev_qcout_filename = "alcf_{}_{}".format(
                     i + 1 - 1, self.output_file)
                 prev_qcout = QcOutput(prev_qcout_filename)
                 prev_final_mol = prev_qcout.data[0]["molecules"][-1]
                 j.mol = prev_final_mol
         sub_qcinp.write_file(sub_input_filename)
         logging.info("The command to run QChem is {}".format(
             ' '.join(qsub_cmd)))
         alcf_cmds.append(qsub_cmd)
         p = subprocess.Popen(qsub_cmd,
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)
         out, err = p.communicate()
         qc_jobid = int(out.strip())
         qc_jobids.append(qc_jobid)
         cqwait_cmd = shlex.split("cqwait {}".format(qc_jobid))
         subprocess.call(cqwait_cmd)
         output_file_name = "{}.output".format(qc_jobid)
         cobaltlog_file_name = "{}.cobaltlog".format(qc_jobid)
         with open(cobaltlog_file_name) as f:
             cobaltlog_last_line = f.readlines()[-1]
             exit_code_pattern = re.compile(
                 "an exit code of (?P<code>\d+);")
             m = exit_code_pattern.search(cobaltlog_last_line)
             if m:
                 rc = float(m.group("code"))
             else:
                 rc = -99999
             return_codes.append(rc)
         for name_change_trial in range(10):
             if not os.path.exists(output_file_name):
                 message = "{} is not found in {}, {}th wait " \
                           "for 5 mins\n".format(
                                 output_file_name,
                                 os.getcwd(), name_change_trial)
                 logging.info(message)
                 if log_file_object:
                     log_file_object.writelines([message])
                 time.sleep(60 * 5)
                 pass
             else:
                 message = "Found qchem output file {} in {}, change file " \
                           "name\n".format(output_file_name,
                                           os.getcwd(),
                                           name_change_trial)
                 logging.info(message)
                 if log_file_object:
                     log_file_object.writelines([message])
                 break
         log_file_object.flush()
         os.fsync(log_file_object.fileno())
         shutil.move(output_file_name, sub_output_filename)
         shutil.move(cobaltlog_file_name, sub_log_filename)
     overall_return_code = min(return_codes)
     with open(self.output_file, "w") as out_file_object:
         for i, job_cmd, rc, qc_jobid in zip(range(njobs), alcf_cmds,
                                             return_codes, qc_jobids):
             sub_output_filename = "alcf_{}_{}".format(
                 i + 1, self.output_file)
             sub_log_filename = "alcf_{}_{}".format(i + 1, self.qclog_file)
             with open(sub_output_filename) as sub_out_file_object:
                 header_lines = [
                     "Running Job {} of {} {}\n".format(
                         i + 1, njobs, self.input_file),
                     " ".join(job_cmd) + "\n"
                 ]
                 if i > 0:
                     header_lines = ['', ''] + header_lines
                 sub_out = sub_out_file_object.readlines()
                 out_file_object.writelines(header_lines)
                 out_file_object.writelines(sub_out)
                 if rc < 0 and rc != -99999:
                     out_file_object.writelines([
                         "Application {} exit codes: {}\n".format(
                             qc_jobid, rc), '\n', '\n'
                     ])
             if log_file_object:
                 with open(sub_log_filename) as sub_log_file_object:
                     sub_log = sub_log_file_object.readlines()
                     log_file_object.writelines(sub_log)
     return overall_return_code
Exemple #3
0
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description="Run A QChem Job for a QChem Input File")
    parser.add_argument("-i",
                        "--input",
                        dest="input",
                        type=str,
                        required=True,
                        help="the QChem output file with imaginary frequency")
    parser.add_argument("-o",
                        "--output",
                        dest="output",
                        type=str,
                        required=True,
                        help="the QChem input file with perturbed geometry")
    parser.add_argument("-s",
                        "--scale",
                        dest="scale",
                        type=float,
                        default=0.3,
                        help="the scale factor to perturb molecule")
    parser.add_argument("-r",
                        "--reverse",
                        dest="reverse",
                        action="store_true",
                        help="use reversed direction to perturb molecule")
    parser.add_argument("-v",
                        "--verbose",
                        dest="verbose",
                        action="store_true",
                        help="print parameters")
    options = parser.parse_args()
    qcout = QcOutput(options.input)
    charge = None
    spin_multiplicity = None
    for d in qcout.data:
        j = d["input"]
        if j.charge is not None:
            charge = j.charge
        if j.spin_multiplicity is not None:
            spin_multiplicity = j.spin_multiplicity
    if qcout.data[-1]['frequencies'][0]["frequency"] < -0.00:
        old_mol = qcout.data[-1]["molecules"][-1]
        vib_mode = qcout.data[-1]['frequencies'][0]["vib_mode"]
        if options.verbose:
            if options.reverse:
                direction_text = "User forward direction"
            else:
                direction_text = "User reversed direction"
            print("{} with scale factor {}".format(direction_text,
                                                   options.scale))
        new_mol = perturb_molecule(old_mol,
                                   vib_mode,
                                   reversed_direction=options.reverse,
                                   perturb_scale=options.scale)
        qctask_freq = qcout.data[-1]["input"]
        qctask_freq.mol = "read"
        qctask_freq.charge = charge
        qctask_freq.spin_multiplicity = spin_multiplicity
        qctask_opt = copy.deepcopy(qctask_freq)
        qctask_opt.params["rem"]["jobtype"] = "opt"
        qctask_opt.params["rem"].pop("scf_guess", None)
        qctask_opt.mol = new_mol
        qcinp = QcInput([qctask_opt, qctask_freq])
        qcinp.write_file(options.output)
    else:
        raise ValueError(
            "Must have an imaginary frequency to perturb the molecule")
Exemple #4
0
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description="Run A QChem Job for a QChem Input File")
    parser.add_argument("-f",
                        "--filename",
                        dest="filename",
                        type=str,
                        required=True,
                        help="the QChem input filename")
    parser.add_argument("-e",
                        "--eliminate",
                        dest="eli_img",
                        action="store_true",
                        help="whether to eliminate imaginary frequency")
    parser.add_argument("-b",
                        "--mixed_basis",
                        dest="mixed_basis",
                        type=json.loads,
                        required=False,
                        help="The mixed basis as a dict")
    parser.add_argument("-a",
                        "--mixed_aux_basis",
                        dest="mixed_aux_basis",
                        type=json.loads,
                        required=False,
                        help="The mixed auxiliary basis as a dict")
    parser.add_argument("-s",
                        "--solvent",
                        dest="solvent",
                        type=str,
                        required=False,
                        help="the implicit solvent")
    parser.add_argument("-n",
                        "--run_name",
                        dest="run_name",
                        type=str,
                        default=None,
                        help="the implicit solvent")
    options = parser.parse_args()
    call_qchem_task(options.filename,
                    options.solvent,
                    options.mixed_basis,
                    options.mixed_aux_basis,
                    run_name=options.run_name)
    if options.eli_img:
        base_filename = os.path.splitext(options.filename)[0]
        output_filename = base_filename + ".qcout"
        qcout = QcOutput(output_filename)
        charge = None
        spin_multiplicity = None
        for d in qcout.data:
            j = d["input"]
            if j.charge is not None:
                charge = j.charge
            if j.spin_multiplicity is not None:
                spin_multiplicity = j.spin_multiplicity
        if qcout.data[-1]['frequencies'][0]["frequency"] < -0.00:
            os.system("tar czvf img_freq_1.tar.gz *")
            old_mol = qcout.data[-1]["molecules"][-1]
            vib_mode = qcout.data[-1]['frequencies'][0]["vib_mode"]
            new_mol = perturb_molecule(old_mol, vib_mode)
            qctask_freq = qcout.data[-1]["input"]
            qctask_freq.mol = "read"
            qctask_freq.charge = charge
            qctask_freq.spin_multiplicity = spin_multiplicity
            qctask_opt = copy.deepcopy(qctask_freq)
            qctask_opt.params["rem"]["jobtype"] = "opt"
            qctask_opt.params["rem"].pop("scf_guess", None)
            qctask_opt.mol = new_mol
            qcinp = QcInput([qctask_opt, qctask_freq])
            eli_file_1 = base_filename + "_eli_img_1.qcinp"
            qcinp.write_file(eli_file_1)
            call_qchem_task(eli_file_1,
                            options.solvent,
                            options.mixed_basis,
                            options.mixed_aux_basis,
                            run_name=options.run_name)

            output_filename = base_filename + "_eli_img_1.qcout"
            qcout = QcOutput(output_filename)
            if qcout.data[-1]['frequencies'][0]["frequency"] < -0.00:
                os.system("tar czvf img_freq_2.tar.gz *")
                old_mol = qcout.data[-1]["molecules"][-1]
                vib_mode = qcout.data[-1]['frequencies'][0]["vib_mode"]
                new_mol = perturb_molecule(old_mol, vib_mode)
                qctask_freq = qcout.data[-1]["input"]
                qctask_freq.mol = "read"
                qctask_freq.charge = charge
                qctask_freq.spin_multiplicity = spin_multiplicity
                qctask_opt = copy.deepcopy(qctask_freq)
                qctask_opt.params["rem"]["jobtype"] = "opt"
                qctask_opt.params["rem"].pop("scf_guess", None)
                qctask_opt.mol = new_mol
                qcinp = QcInput([qctask_opt, qctask_freq])
                for j in qcinp.jobs:
                    j.set_dft_grid(128, 302)
                    j.set_integral_threshold(12)
                    if j.params["rem"]["jobtype"] == "opt":
                        j.scale_geom_opt_threshold(0.1, 0.1, 0.1)
                        j.set_geom_max_iterations(100)
                eli_file_2 = base_filename + "_eli_img_2.qcinp"
                qcinp.write_file(eli_file_2)
                call_qchem_task(eli_file_2,
                                options.solvent,
                                options.mixed_basis,
                                options.mixed_aux_basis,
                                run_name=options.run_name)

                output_filename = base_filename + "_eli_img_2.qcout"
                qcout = QcOutput(output_filename)
                if qcout.data[-1]['frequencies'][0]["frequency"] < -0.00:
                    os.system("tar czvf img_freq_3.tar.gz *")
                    old_mol = qcout.data[-1]["molecules"][-1]
                    vib_mode = qcout.data[-1]['frequencies'][0]["vib_mode"]
                    new_mol = perturb_molecule(old_mol, vib_mode)
                    qctask_freq = qcout.data[-1]["input"]
                    qctask_freq.mol = "read"
                    qctask_freq.charge = charge
                    qctask_freq.spin_multiplicity = spin_multiplicity
                    qctask_opt = copy.deepcopy(qctask_freq)
                    qctask_opt.params["rem"]["jobtype"] = "opt"
                    qctask_opt.params["rem"].pop("scf_guess", None)
                    qctask_opt.mol = new_mol
                    qcinp = QcInput([qctask_opt, qctask_freq])
                    for j in qcinp.jobs:
                        j.set_dft_grid(90, 590)
                        j.set_integral_threshold(12)
                        if j.params["rem"]["jobtype"] == "opt":
                            j.scale_geom_opt_threshold(0.1, 0.1, 0.1)
                            j.set_geom_max_iterations(100)
                    eli_file_3 = base_filename + "_eli_img_3.qcinp"
                    qcinp.write_file(eli_file_3)
                    call_qchem_task(eli_file_3,
                                    options.solvent,
                                    options.mixed_basis,
                                    options.mixed_aux_basis,
                                    run_name=options.run_name)
Exemple #5
0
    def aimd_fw(self,
                charge,
                spin_multiplicity,
                fw_id_cal,
                fw_id_db,
                num_steps,
                time_step,
                temperature,
                priority=None,
                qm_method=None):
        if not qm_method:
            qm_method = "B3LYP/6-31+G*"
        spec = self.base_spec()
        if priority:
            spec['_priority'] = priority
        task_type = "ab initio molecule dynamics"
        state_name = self.get_state_name(charge, spin_multiplicity)
        title = self.molname + " " + state_name + " " + qm_method + " " + task_type
        exchange, correlation, basis_set, aux_basis, rem_params, method_token, ecp = self. \
            get_exchange_correlation_basis_auxbasis_remparams(qm_method,
                                                              self.mol)
        if rem_params is None:
            rem_params = dict()
        rem_params["aimd_method"] = "bomd"
        rem_params["time_step"] = time_step
        rem_params["aimd_steps"] = num_steps
        rem_params["aimd_init_veloc"] = "thermal"
        rem_params["aimd_temp"] = temperature
        rem_params["fock_extrap_order"] = 6
        rem_params["fock_extrap_points"] = 12
        qctask_vac = QcTask(self.mol,
                            charge=charge,
                            spin_multiplicity=spin_multiplicity,
                            jobtype="aimd",
                            title=title,
                            exchange=exchange,
                            correlation=correlation,
                            basis_set=basis_set,
                            aux_basis_set=aux_basis,
                            ecp=ecp,
                            rem_params=rem_params)
        qctask_vac.set_scf_algorithm_and_iterations(iterations=100)

        qcinp = QcInput([qctask_vac])
        spec["qcinp"] = qcinp.as_dict()
        spec['task_type'] = task_type
        spec['charge'] = charge
        spec['spin_multiplicity'] = spin_multiplicity
        spec['run_tags']['methods'] = method_token
        spec['run_tags']['rem_params'] = rem_params
        spec["qm_method"] = qm_method
        task_name = self.molname + ' ' + state_name + ' ' + task_type
        from rubicon.firetasks.qchem.multistep_qchem_task \
            import QChemAIMDDBInsertionTask
        fw_sp_cal = Firework([QChemTask()],
                             spec=spec,
                             name=task_name,
                             fw_id=fw_id_cal)
        spec_db = copy.deepcopy(spec)
        del spec_db['_dupefinder']
        spec_db['_allow_fizzled_parents'] = True
        spec_db['task_type'] = task_type + ' DB Insertion'
        del spec_db["_trackers"][:2]
        task_name_db = task_name + " DB Insertion"
        fw_sp_db = Firework([QChemAIMDDBInsertionTask()],
                            spec=spec_db,
                            name=task_name_db,
                            fw_id=fw_id_db)
        return fw_sp_cal, fw_sp_db
Exemple #6
0
    def vacuum_only_sp_fw(self,
                          charge,
                          spin_multiplicity,
                          fw_id_cal,
                          fw_id_db,
                          priority=None,
                          qm_method=None,
                          population_method=None,
                          mixed_basis_generator=None,
                          mixed_aux_basis_generator=None,
                          super_mol_snlgroup_id=None,
                          super_mol_egsnl=None,
                          super_mol_inchi_root=None,
                          ghost_atoms=None,
                          bs_overlap=False):
        if not qm_method:
            qm_method = "B3LYP/6-31+G*"
        spec = self.base_spec()
        if priority:
            spec['_priority'] = priority
        if super_mol_snlgroup_id:
            from rubicon.workflows.qchem.bsse_wf import BSSEFragment
            task_type = "bsse {} fragment".format(
                BSSEFragment.OVERLAPPED if bs_overlap else BSSEFragment.
                ISOLATED)
        else:
            task_type = "vacuum only single point energy"
        if mixed_basis_generator or mixed_aux_basis_generator:
            population_method = population_method if population_method else "nbo"
            task_type = "atomic charge"
        state_name = self.get_state_name(charge, spin_multiplicity)
        title = self.molname + " " + state_name + " " + qm_method + " " + task_type
        title += "\n Gas Phase"
        exchange, correlation, basis_set, aux_basis, rem_params, method_token, ecp = self. \
            get_exchange_correlation_basis_auxbasis_remparams(qm_method,
                                                              self.mol)
        if population_method:
            if not rem_params:
                rem_params = dict()
            if population_method.lower() == "nbo":
                rem_params["nbo"] = 1
            elif population_method.lower() == "chelpg":
                rem_params["chelpg"] = True
            elif population_method.lower() == "hirshfeld":
                rem_params["hirshfeld"] = True
        ga = ghost_atoms if bs_overlap else None
        qctask_vac = QcTask(self.mol,
                            charge=charge,
                            spin_multiplicity=spin_multiplicity,
                            jobtype="sp",
                            title=title,
                            exchange=exchange,
                            correlation=correlation,
                            basis_set=basis_set,
                            aux_basis_set=aux_basis,
                            ecp=ecp,
                            rem_params=rem_params,
                            ghost_atoms=ga)
        if (not self.large) and (mixed_basis_generator is None
                                 and mixed_aux_basis_generator is None):
            qctask_vac.set_dft_grid(128, 302)
            qctask_vac.set_integral_threshold(12)
            qctask_vac.set_scf_convergence_threshold(8)
        else:
            qctask_vac.set_scf_algorithm_and_iterations(iterations=100)

        qcinp = QcInput([qctask_vac])
        spec["qcinp"] = qcinp.as_dict()
        spec['task_type'] = task_type
        spec['charge'] = charge
        spec['spin_multiplicity'] = spin_multiplicity
        spec['run_tags']['methods'] = method_token
        spec["qm_method"] = qm_method
        if super_mol_snlgroup_id:
            spec["run_tags"]["super_mol_snlgroup_id"] = super_mol_snlgroup_id
            spec["snlgroup_id"] = super_mol_snlgroup_id
            spec["egsnl"] = super_mol_egsnl
            spec["inchi_root"] = super_mol_inchi_root
        if ghost_atoms:
            spec["run_tags"]["ghost_atoms"] = sorted(set(ghost_atoms))
            from rubicon.workflows.qchem.bsse_wf import BSSEFragment
            spec["run_tags"][
                "bsse_fragment_type"] = BSSEFragment.OVERLAPPED if bs_overlap else BSSEFragment.ISOLATED
        if mixed_basis_generator:
            spec["_mixed_basis_set_generator"] = mixed_basis_generator
        if mixed_aux_basis_generator:
            spec["_mixed_aux_basis_set_generator"] = mixed_aux_basis_generator
        task_name = self.molname + ' ' + state_name + ' ' + task_type
        from rubicon.firetasks.qchem.multistep_qchem_task \
            import QChemSinglePointEnergyDBInsertionTask
        fw_sp_cal = Firework([QChemTask()],
                             spec=spec,
                             name=task_name,
                             fw_id=fw_id_cal)
        spec_db = copy.deepcopy(spec)
        del spec_db['_dupefinder']
        spec_db['_allow_fizzled_parents'] = True
        spec_db['task_type'] = task_type + ' DB Insertion'
        del spec_db["_trackers"][:2]
        task_name_db = task_name + " DB Insertion"
        fw_sp_db = Firework([QChemSinglePointEnergyDBInsertionTask()],
                            spec=spec_db,
                            name=task_name_db,
                            fw_id=fw_id_db)
        return fw_sp_cal, fw_sp_db
Exemple #7
0
    def sp_fw(self,
              charge,
              spin_multiplicity,
              fw_id_cal,
              fw_id_db,
              solvent_method="ief-pcm",
              use_vdw_surface=False,
              solvent="water",
              priority=None,
              qm_method=None,
              population_method=None,
              task_type_name=None):
        if not qm_method:
            qm_method = "B3LYP/6-31+G*"
        spec = self.base_spec()
        if priority:
            spec['_priority'] = priority
        task_type = task_type_name if task_type_name else "single point energy"
        state_name = self.get_state_name(charge, spin_multiplicity)
        title = self.molname + " " + state_name + " " + qm_method + " " + task_type
        title += "\n Gas Phase"
        exchange, correlation, basis_set, aux_basis, rem_params, method_token, ecp = self. \
            get_exchange_correlation_basis_auxbasis_remparams(qm_method,
                                                              self.mol)
        if population_method:
            if not rem_params:
                rem_params = dict()
            if population_method.lower() == "nbo":
                rem_params["nbo"] = 1
            elif population_method.lower() == "chelpg":
                rem_params["chelpg"] = True
        qctask_vac = QcTask(self.mol,
                            charge=charge,
                            spin_multiplicity=spin_multiplicity,
                            jobtype="sp",
                            title=title,
                            exchange=exchange,
                            correlation=correlation,
                            basis_set=basis_set,
                            aux_basis_set=aux_basis,
                            ecp=ecp,
                            rem_params=rem_params)
        if not self.large:
            qctask_vac.set_dft_grid(128, 302)
            qctask_vac.set_integral_threshold(12)
            qctask_vac.set_scf_convergence_threshold(8)
        else:
            qctask_vac.set_scf_algorithm_and_iterations(iterations=100)

        title = " Solution Phase, {}".format(solvent)
        qctask_sol = QcTask(self.mol,
                            charge=charge,
                            spin_multiplicity=spin_multiplicity,
                            jobtype="sp",
                            title=title,
                            exchange=exchange,
                            correlation=correlation,
                            basis_set=basis_set,
                            aux_basis_set=aux_basis,
                            ecp=ecp,
                            rem_params=rem_params)
        qctask_sol.set_scf_initial_guess(guess="read")
        implicit_solvent = self.set_solvent_method(qctask_sol, solvent,
                                                   solvent_method,
                                                   use_vdw_surface)

        qcinp = QcInput([qctask_vac, qctask_sol])
        spec["qcinp"] = qcinp.as_dict()
        spec['task_type'] = task_type
        spec['charge'] = charge
        spec['spin_multiplicity'] = spin_multiplicity
        spec['run_tags']['methods'] = method_token
        spec["qm_method"] = qm_method
        spec['implicit_solvent'] = implicit_solvent
        task_name = self.molname + ' ' + state_name + ' ' + task_type
        from rubicon.firetasks.qchem.multistep_qchem_task \
            import QChemSinglePointEnergyDBInsertionTask
        fw_sp_cal = Firework([QChemTask()],
                             spec=spec,
                             name=task_name,
                             fw_id=fw_id_cal)
        spec_db = copy.deepcopy(spec)
        del spec_db['_dupefinder']
        spec_db['_allow_fizzled_parents'] = True
        spec_db['task_type'] = task_type + ' DB Insertion'
        del spec_db["_trackers"][:2]
        task_name_db = task_name + " DB Insertion"
        fw_sp_db = Firework([QChemSinglePointEnergyDBInsertionTask()],
                            spec=spec_db,
                            name=task_name_db,
                            fw_id=fw_id_db)
        return fw_sp_cal, fw_sp_db
Exemple #8
0
    def geom_fw(self,
                charge,
                spin_multiplicity,
                fw_id_cal,
                fw_id_db,
                priority=None,
                method=None,
                task_type_prefix=None):
        task_type = "geometry optimization"
        if task_type_prefix:
            task_type = task_type_prefix + " " + task_type
        state_name = self.get_state_name(charge, spin_multiplicity)
        if not method:
            if self.large:
                method = "PBE-D3/6-31+G*"
            else:
                method = "B3lYP/6-31+G*"
        title = self.molname + " " + state_name + " " + method + " " + task_type
        exchange, correlation, basis_set, aux_basis, rem_params, method_token, ecp = self. \
            get_exchange_correlation_basis_auxbasis_remparams(method, self.mol)
        qctask = QcTask(self.mol,
                        charge=charge,
                        spin_multiplicity=spin_multiplicity,
                        jobtype="opt",
                        title=title,
                        exchange=exchange,
                        correlation=correlation,
                        basis_set=basis_set,
                        aux_basis_set=aux_basis,
                        ecp=ecp,
                        rem_params=rem_params)
        if self.large:
            qctask.set_geom_max_iterations(200)
            qctask.set_scf_algorithm_and_iterations(iterations=100)
            qctask.scale_geom_opt_threshold(gradient=1.0,
                                            displacement=10.0,
                                            energy=10.0)
        qcinp = QcInput([qctask])
        spec = self.base_spec()
        spec["qcinp"] = qcinp.as_dict()
        spec['task_type'] = task_type
        spec['charge'] = charge
        spec['spin_multiplicity'] = spin_multiplicity
        spec['run_tags']['methods'] = method_token
        spec["qm_method"] = method
        if priority:
            spec['_priority'] = priority
        task_name = self.molname + ' ' + state_name + ' ' + task_type
        from rubicon.firetasks.qchem.multistep_qchem_task \
            import QChemGeomOptDBInsertionTask
        fw_geom_cal = Firework([QChemTask()],
                               spec=spec,
                               name=task_name,
                               fw_id=fw_id_cal)
        spec_db = copy.deepcopy(spec)
        del spec_db['_dupefinder']
        spec_db['_allow_fizzled_parents'] = True
        spec_db['task_type'] = task_type + ' DB Insertion'
        del spec_db["_trackers"][:2]
        task_name_db = task_name + " DB Insertion"
        fw_geom_db = Firework([QChemGeomOptDBInsertionTask()],
                              spec=spec_db,
                              name=task_name_db,
                              fw_id=fw_id_db)

        return fw_geom_cal, fw_geom_db