コード例 #1
0
def main():
    parser = argparse.ArgumentParser(
        description="Assign mixed basis set by list of ranges")
    parser.add_argument("-i",
                        "--input",
                        dest="input",
                        type=str,
                        required=True,
                        help="the QChem input filename")
    parser.add_argument(
        "-b",
        "--basis",
        dest="basis",
        type=str,
        required=True,
        help=
        "The file contain the list of basis sets by four columns: 1) start atom index (1 based);"
        "2) end  atom index; 3) basis set; 4) comments")
    parser.add_argument(
        "-o",
        "--output",
        dest="output",
        type=str,
        required=True,
        help="the QChem input filename with the mixed basis set")
    options = parser.parse_args()

    qcinp_no_basis = QcInput.from_file(options.input)
    mol_with_basis = assign_basis_set_by_range(qcinp=qcinp_no_basis,
                                               basis_def_file=options.basis)
    mol_with_basis.write_file(options.output)
コード例 #2
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "Replace the atom coordinates of the first job in QChem input file with the coordinates from"
        "an XYZ file")
    parser.add_argument("-i",
                        "--input",
                        dest="input",
                        type=str,
                        required=True,
                        help="the QChem input filename")
    parser.add_argument("-c",
                        "--coords",
                        dest="coords",
                        type=str,
                        required=True,
                        help="The XYZ file contains the new coords")
    parser.add_argument("-v",
                        "--velocity",
                        dest="velocity",
                        type=str,
                        default=None,
                        help="The AIMD velocity file")
    parser.add_argument(
        "-o",
        "--output",
        dest="output",
        type=str,
        required=True,
        help="the QChem input filename with the coordinates from the XYZ file")
    options = parser.parse_args()
    qcinp = QcInput.from_file(options.input)
    charge, spin = qcinp.jobs[0].charge, qcinp.jobs[0].spin_multiplicity
    if options.velocity is None:
        new_mol = Molecule.from_file(options.coords)
    else:
        mxyz = XYZ.from_file(options.coords)
        new_mol = mxyz.all_molecules[-1]
        qcinp.jobs[0].params["rem"].pop("aimd_init_veloc", None)
        qcnv = QcNucVeloc(options.velocity)
        assert len(mxyz.molecules) == len(qcnv.velocities)
        qcinp.jobs[0].set_velocities(qcnv.velocities[-1])
    if charge is not None:
        new_mol.set_charge_and_spin(charge, spin)
    qcinp.jobs[0].mol = new_mol
    qcinp.write_file(options.output)
    print(
        "created new QChem input file {new_file} using {old_inp} as an template and filled with coordinates " \
        "from {coord_file}".format(old_inp=options.input,
                                   coord_file=options.coords,
                                   new_file=options.output))
コード例 #3
0
ファイル: handlers.py プロジェクト: zbwang/custodian
 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
コード例 #4
0
ファイル: handlers.py プロジェクト: ProjectFrank/custodian
 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
コード例 #5
0
def call_qchem_task(filename,
                    solvent=None,
                    mixed_basis=None,
                    mixed_aux_basis=None):
    base_filename = os.path.splitext(filename)[0]
    output_filename = base_filename + ".qcout"
    qcinp = QcInput.from_file(filename)
    solvent_token = set_solvent_data(qcinp, solvent)
    QChemTask.run_qchem(qcinp,
                        solvent_token,
                        mixed_aux_basis,
                        mixed_basis,
                        input_file=filename,
                        output_file=output_filename,
                        gzipped=False)
コード例 #6
0
ファイル: jobs.py プロジェクト: czhengsci/custodian
    def _set_qchem_memory(self, qcinp=None):
        instance_ratio = 1.0
        if "QCSCRATCH" in os.environ and \
            ("/tmp" in os.environ["QCSCRATCH"] or
             "/dev/shm" in os.environ["QCSCRATCH"]):
            instance_ratio = 0.5

        nprocs = 1
        if "-np" in self.current_command:
            nprocs = int(self.current_command[self.current_command.index("-np") + 1])
        mem_per_proc = self.total_physical_memory * 1000 // nprocs

        if self.large_static_mem:
            static_ratio = 0.4
        else:
            static_ratio = 0.1
        total_mem = int(mem_per_proc * instance_ratio)
        static_mem = int(total_mem * static_ratio)
        if not qcinp:
            qcinp = QcInput.from_file(self.input_file)
        for j in qcinp.jobs:
            j.set_memory(total=total_mem, static=static_mem)
        qcinp.write_file(self.input_file)
コード例 #7
0
    def _set_qchem_memory(self, qcinp=None):
        instance_ratio = 1.0
        if "QCSCRATCH" in os.environ and \
            ("/tmp" in os.environ["QCSCRATCH"] or
             "/dev/shm" in os.environ["QCSCRATCH"]):
            instance_ratio = 0.5

        nprocs = 1
        if "-np" in self.current_command:
            nprocs = int(self.current_command[self.current_command.index("-np") + 1])
        mem_per_proc = self.total_physical_memory * 1000 // nprocs

        if self.large_static_mem:
            static_ratio = 0.4
        else:
            static_ratio = 0.1
        total_mem = int(mem_per_proc * instance_ratio)
        static_mem = int(total_mem * static_ratio)
        if not qcinp:
            qcinp = QcInput.from_file(self.input_file)
        for j in qcinp.jobs:
            j.set_memory(total=total_mem, static=static_mem)
        qcinp.write_file(self.input_file)
コード例 #8
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "Replace the atom coordinates of the first job in QChem input file with the coordinates from"
        "an XYZ file")
    parser.add_argument("-i",
                        "--input",
                        dest="input",
                        type=str,
                        required=True,
                        help="the QChem input filename")
    parser.add_argument("-c",
                        "--coords",
                        dest="coords",
                        type=str,
                        required=True,
                        help="The XYZ file contains the new coords")
    parser.add_argument(
        "-o",
        "--output",
        dest="output",
        type=str,
        required=True,
        help="the QChem input filename with the coordinates from the XYZ file")
    options = parser.parse_args()
    qcinp = QcInput.from_file(options.input)
    charge, spin = qcinp.jobs[0].charge, qcinp.jobs[0].spin_multiplicity
    new_mol = Molecule.from_file(options.coords)
    if charge is not None:
        new_mol.set_charge_and_spin(charge, spin)
    qcinp.jobs[0].mol = new_mol
    qcinp.write_file(options.output)
    print(
        "created new QChem input file {new_file} using {old_inp} as an template and filled with coordinates " \
        "from {coord_file}".format(old_inp=options.input,
                                   coord_file=options.coords,
                                   new_file=options.output))
コード例 #9
0
ファイル: jobs.py プロジェクト: czhengsci/custodian
 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
コード例 #10
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
コード例 #11
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 "NERSC_HOST" in os.environ and os.environ["NERSC_HOST"] == "cori":
         if "QCSCRATCH" in os.environ and "eg_qchem" in os.environ[
                 "QCSCRATCH"]:
             # in memory scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1400, static=200)
                     else:
                         j.set_memory(total=1500, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=3000, static=500)
                     else:
                         j.set_memory(total=3200, static=300)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=50000, static=12000)
                     else:
                         j.set_memory(total=60000, static=2000)
         else:
             # disk scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=2700, static=500)
                     else:
                         j.set_memory(total=3000, static=200)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=6000, static=1000)
                     else:
                         j.set_memory(total=6500, static=500)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=100000, static=25000)
                     else:
                         j.set_memory(total=120000, static=8000)
     elif "NERSC_HOST" in os.environ and os.environ[
             "NERSC_HOST"] == "edison":
         if "QCSCRATCH" in os.environ and "/tmp/eg_qchem" in os.environ[
                 "QCSCRATCH"]:
             # in memory scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1200, static=300)
                     else:
                         j.set_memory(total=1200, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=2400, static=400)
                     else:
                         j.set_memory(total=2400, static=200)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=25000, static=1000)
                     else:
                         j.set_memory(total=25000, static=500)
         else:
             # disk scratch
             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)
     elif "NERSC_HOST" in os.environ and os.environ[
             "NERSC_HOST"] == "matgen":
         if "QCSCRATCH" in os.environ and "eg_qchem" in os.environ[
                 "QCSCRATCH"]:
             # in memory scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1500, static=200)
                     else:
                         j.set_memory(total=1600, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=3000, static=600)
                     else:
                         j.set_memory(total=3200, static=400)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=15000, static=5500)
                     else:
                         j.set_memory(total=29000, static=2000)
         else:
             # disk scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=2800, static=500)
                     else:
                         j.set_memory(total=3100, static=200)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=6000, static=1100)
                     else:
                         j.set_memory(total=6500, static=600)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=50000, static=10000)
                     else:
                         j.set_memory(total=59000, static=3000)
     elif 'vesta' in socket.gethostname():
         for j in qcinp.jobs:
             j.set_memory(total=13500, static=800)
     qcinp.write_file(self.input_file)
コード例 #12
0
ファイル: jobs.py プロジェクト: montoyjh/custodian
 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
             if "QCSCRATCH" in os.environ and "/tmp/eg_qchem" in os.environ["QCSCRATCH"]:
                 # in memory scratch
                 for j in qcinp.jobs:
                     if self.current_command_name == "general":
                         if self.large_static_mem:
                             j.set_memory(total=1200, static=300)
                         else:
                             j.set_memory(total=1200, static=100)
                     elif self.current_command_name == "half_cpus":
                         if self.large_static_mem:
                             j.set_memory(total=2400, static=400)
                         else:
                             j.set_memory(total=2400, static=200)
                     elif self.current_command_name == "openmp":
                         if self.large_static_mem:
                             j.set_memory(total=25000, static=1000)
                         else:
                             j.set_memory(total=25000, static=500)
             else:
                 # disk scratch
                 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)
     elif "NERSC_HOST" in os.environ and os.environ["NERSC_HOST"] == "cori":
         if "QCSCRATCH" in os.environ and "eg_qchem" in os.environ["QCSCRATCH"]:
             # in memory scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1400, static=200)
                     else:
                         j.set_memory(total=1500, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=3000, static=500)
                     else:
                         j.set_memory(total=3200, static=300)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=50000, static=12000)
                     else:
                         j.set_memory(total=60000, static=2000)
         else:
             # disk scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=2700, static=500)
                     else:
                         j.set_memory(total=3000, static=200)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=6000, static=1000)
                     else:
                         j.set_memory(total=6500, static=500)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=100000, static=25000)
                     else:
                         j.set_memory(total=120000, static=8000)
     elif "NERSC_HOST" in os.environ and os.environ["NERSC_HOST"] == "matgen":
         if "QCSCRATCH" in os.environ and "eg_qchem" in os.environ["QCSCRATCH"]:
             # in memory scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=1500, static=200)
                     else:
                         j.set_memory(total=1600, static=100)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=3000, static=600)
                     else:
                         j.set_memory(total=3200, static=400)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=15000, static=5500)
                     else:
                         j.set_memory(total=29000, static=2000)
         else:
             # disk scratch
             for j in qcinp.jobs:
                 if self.current_command_name == "general":
                     if self.large_static_mem:
                         j.set_memory(total=2800, static=500)
                     else:
                         j.set_memory(total=3100, static=200)
                 elif self.current_command_name == "half_cpus":
                     if self.large_static_mem:
                         j.set_memory(total=6000, static=1100)
                     else:
                         j.set_memory(total=6500, static=600)
                 elif self.current_command_name == "openmp":
                     if self.large_static_mem:
                         j.set_memory(total=50000, static=10000)
                     else:
                         j.set_memory(total=59000, static=3000)
     elif 'vesta' in socket.gethostname():
         for j in qcinp.jobs:
             j.set_memory(total=13500, static=800)
     qcinp.write_file(self.input_file)
コード例 #13
0
 def test_assign_basis_set_by_range(self):
     qcinp_file_name = os.path.join(test_dir,
                                    "MgTFSI_31_acetonitrile.qcinp")
     basis_def_file_name = os.path.join(test_dir, "MgTFSI_31_AN_basis.txt")
     qcinp_no_basis = QcInput.from_file(qcinp_file_name)
     qcinp_with_basis = assign_basis_set_by_range(
         qcinp=qcinp_no_basis, basis_def_file=basis_def_file_name)
     self.assertEqual(qcinp_with_basis.jobs[0].params["rem"]["basis"],
                      "mixed")
     ans = [('Mg', '3-21g*'), ('N', '3-21+g*'), ('S', '3-21+g*'),
            ('O', '3-21+g*'), ('O', '3-21+g*'), ('C', '3-21+g*'),
            ('F', '3-21+g*'), ('F', '3-21+g*'), ('F', '3-21+g*'),
            ('S', '3-21+g*'), ('O', '3-21+g*'), ('O', '3-21+g*'),
            ('C', '3-21+g*'), ('F', '3-21+g*'), ('F', '3-21+g*'),
            ('F', '3-21+g*'), ('C', '3-21g*'), ('C', '3-21g*'),
            ('N', '3-21+g*'), ('H', '3-21g*'), ('H', '3-21g*'),
            ('H', '3-21g*'), ('C', '3-21g*'), ('C', '3-21g*'),
            ('N', '3-21+g*'), ('H', '3-21g*'), ('H', '3-21g*'),
            ('H', '3-21g*'), ('C', '3-21g*'), ('C', '3-21g*'),
            ('N', '3-21+g*'), ('H', '3-21g*'), ('H', '3-21g*'),
            ('H', '3-21g*'), ('C', '3-21g*'), ('C', '3-21g*'),
            ('N', '3-21+g*'), ('H', '3-21g*'), ('H', '3-21g*'),
            ('H', '3-21g*'), ('C', '3-21g*'), ('C', '3-21g*'),
            ('N', '3-21+g*'), ('H', '3-21g*'), ('H', '3-21g*'),
            ('H', '3-21g*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*'), ('C', '3-21*'), ('C', '3-21*'), ('N', '3-21*'),
            ('H', '3-21*'), ('H', '3-21*'), ('H', '3-21*'), ('C', '3-21*'),
            ('C', '3-21*'), ('N', '3-21*'), ('H', '3-21*'), ('H', '3-21*'),
            ('H', '3-21*')]
     self.assertEqual(qcinp_with_basis.jobs[0].params["basis"], ans)