def run_job(settings, mol, job_name="gamess_job", work_dir=None): """ Call the Cp2K binary using plams interface. :param settings: Job Settings. :type settings: :class:`~qmworks.Settings` :param mol: molecular Geometry :type mol: plams Molecule :param input_file_name: Optional name for the input. :type input_file_name: String :param out_file_name: Optional name for the output. :type out_file_name: String :return: Package.Result """ gamess_settings = Settings() gamess_settings.input = settings.specific.gamess job = plams.GamessJob(molecule=mol, name=job_name, settings=gamess_settings) r = job.run() result = Gamess_Result( gamess_settings, mol, r.job.name, plams_dir=r.job.path, work_dir=work_dir, status=job.status, ) return result
def run_job(self, settings, mol, job_name='DFTBjob'): """ Execute an DFTB job with the *ADF* quantum package. :param settings: user input settings. :type settings: |Settings| :param mol: Molecule to run the simulation :type mol: Plams Molecule :parameter input_file_name: The user can provide a name for the job input. :type input_file_name: String :parameter out_file_name: The user can provide a name for the job output. :type out_file_name: String :returns: :class:`~qmworks.packages.SCM.DFTB_Result` """ dftb_settings = Settings() dftb_settings.input = settings.specific.dftb result = plams.DFTBJob(name=job_name, molecule=mol, settings=dftb_settings).run() return DFTB_Result(dftb_settings, mol, result.job.name, plams_dir=result.job.path)
def run_job(settings, mol, job_name="ADFjob"): """ Execute ADF job. :param settings: user input settings. :type settings: |Settings| :param mol: Molecule to run the simulation :type mol: Plams Molecule :parameter input_file_name: The user can provide a name for the job input. :type input_file_name: String :parameter out_file_name: The user can provide a name for the job output. :type out_file_name: String :returns: :class:`~qmworks.packages.SCM.ADF_Result` """ adf_settings = Settings() adf_settings.input = settings.specific.adf job = plams.ADFJob(name=job_name, molecule=mol, settings=adf_settings) result = job.run() path_t21 = result._kf.path adf_result = ADF_Result( adf_settings, mol, result.job.name, path_t21, plams_dir=result.job.path, status=job.status, ) return adf_result
def run_job(settings, mol, job_name="DFTBjob"): """ Execute an DFTB job with the *ADF* quantum package. :param settings: user input settings. :type settings: |Settings| :param mol: Molecule to run the simulation :type mol: Plams Molecule :parameter input_file_name: The user can provide a name for the job input. :type input_file_name: String :parameter out_file_name: The user can provide a name for the job output. :type out_file_name: String :returns: :class:`~qmworks.packages.SCM.DFTB_Result` """ dftb_settings = Settings() dftb_settings.input = settings.specific.dftb job = plams.DFTBJob(name=job_name, molecule=mol, settings=dftb_settings) result = job.run() if job.status in ["failed", "crashed"]: builtins.config.jm.remove_job(job) return DFTB_Result(dftb_settings, mol, result.job.name, plams_dir=result.job.path)
def run_job(settings, mol, job_name='cp2k_job', work_dir=None, **kwargs): """ Call the Cp2K binary using plams interface. :param settings: Job Settings. :type settings: :class:`~qmworks.Settings` :param mol: molecular Geometry :type mol: plams Molecule :param hdf5_file: Path to the HDF5 file that contains the numerical results. :type hdf5_file: String :param input_file_name: Optional name for the input. :type input_file_name: String :param out_file_name: Optional name for the output. :type out_file_name: String :param store_in_hdf5: wether to store the output arrays in HDF5 format. :type store_in_hdf5: Bool """ # Yet another work directory # Input modifications cp2k_settings = Settings() cp2k_settings.input = settings.specific.cp2k job = plams.Cp2kJob(name=job_name, settings=cp2k_settings, molecule=mol) r = job.run() work_dir = work_dir if work_dir is not None else job.path result = CP2K_Result(cp2k_settings, mol, job_name, r.job.path, work_dir, status=job.status) return result
def run_job(self, settings, mol, input_file_name=None, out_file_name=None): dirac_settings = Settings() dirac_settings.input = settings.specific.dirac check_dirac_input(dirac_settings) result = plams.DiracJob(settings=dirac_settings, molecule=mol).run() return DIRAC_Result(dirac_settings, mol, result)
def run_job(self, settings, mol, work_dir=None, project_name=None, hdf5_file="quantum.hdf5", input_file_name=None, out_file_name=None, store_in_hdf5=True, nHOMOS=None, nLUMOS=None, job_name='cp2k_job'): """ Call the Cp2K binary using plams interface. :param settings: Job Settings. :type settings: :class:`~qmworks.Settings` :param mol: molecular Geometry :type mol: plams Molecule :param hdf5_file: Path to the HDF5 file that contains the numerical results. :type hdf5_file: String :param input_file_name: Optional name for the input. :type input_file_name: String :param out_file_name: Optional name for the output. :type out_file_name: String :param store_in_hdf5: wether to store the output arrays in HDF5 format. :type store_in_hdf5: Bool """ cp2k_settings = Settings() cp2k_settings.input = settings.specific.cp2k job = plams.Cp2kJob(name=job_name, settings=cp2k_settings, molecule=mol) runner = plams.JobRunner(parallel=True) r = job.run(runner) r.wait() work_dir = work_dir if work_dir is not None else job.path output_file = join(job.path, job._filename('out')) if store_in_hdf5: dump_to_hdf5(hdf5_file, settings, work_dir, output_file, nHOMOS, nLUMOS, project_name=project_name) return CP2K_Result(cp2k_settings, mol, job_name, r.job.path, work_dir, path_hdf5=hdf5_file, project_name=project_name)
def run_job(self, settings, mol, job_name="ORCAjob"): orca_settings = Settings() orca_settings.input = settings.specific.orca result = plams.ORCAJob(molecule=mol, settings=orca_settings, name=job_name).run() return ORCA_Result(orca_settings, mol, result.job.name, result.job.path)
def get_constraint_settings(self, step): s = Settings() if isinstance(self.constraints, list): for c in range(len(self.constraints)): s.constraint.update( self.constraints[c].get_settings(self.start[c] + self.stepsize[c] * step)) else: s.constraint = self.constraints.get_settings(self.start + self.stepsize * step) return s
def run_job(settings, mol, job_name="ORCAjob"): orca_settings = Settings() orca_settings.input = settings.specific.orca job = plams.ORCAJob(molecule=mol, settings=orca_settings, name=job_name) result = job.run() return ORCA_Result( orca_settings, mol, result.job.name, plams_dir=result.job.path, status=job.status, )
def run_job(settings, mol, job_name="dirac_job"): dirac_settings = Settings() dirac_settings.input = settings.specific.dirac dirac_settings.ignore_molecule job = plams.DiracJob(name=job_name, settings=dirac_settings, molecule=mol) result = job.run() return DIRAC_Result( dirac_settings, mol, result.job.name, plams_dir=result.job.path, status=job.status, )
def get_settings(self, value=None, mol=None): s = Settings() if value is None: if mol is None: raise RunTimeError( 'Angle constraint settings requires a value or molecule') else: value = self.get_current_value(mol) s["angle " + str(self.atom1 + 1) + " " + str(self.atom2 + 1) + " " + str(self.atom3 + 1)] = value return s
def run_job(self, settings, mol, work_dir=None, project_name=None, hdf5_file="quantum.hdf5", store_in_hdf5=True, job_name='gamess_job'): """ Call the Cp2K binary using plams interface. :param settings: Job Settings. :type settings: :class:`~qmworks.Settings` :param mol: molecular Geometry :type mol: plams Molecule :param hdf5_file: Path to the HDF5 file that contains the numerical results. :type hdf5_file: String :param input_file_name: Optional name for the input. :type input_file_name: String :param out_file_name: Optional name for the output. :type out_file_name: String :param store_in_hdf5: wether to store the output arrays in HDF5 format. :type store_in_hdf5: Bool """ gamess_settings = Settings() gamess_settings.input = settings.specific.gamess job = plams.GamessJob(molecule=mol, name=job_name, settings=gamess_settings) runner = plams.JobRunner(parallel=True) r = job.run(runner) r.wait() return Gamess_Result(gamess_settings, mol, r.job.name, plams_dir=r.job.path, work_dir=work_dir, path_hdf5=hdf5_file, project_name=project_name)
def generic2specific(self, settings, mol=None): """ Traverse all the key, value pairs of the ``settings``, translating the generic keys into package specific keys as defined in the specific dictionary. If one key is not in the specific dictionary an error is raised. These new specific settings take preference over existing specific settings. :parameter settings: Settings provided by the user. :type settings: Settings :parameter mol: Molecule to run the calculation. :type mol: plams Molecule """ generic_dict = self.get_generic_dict() specific_from_generic_settings = Settings() for k, v in settings.items(): if k != "specific": key = generic_dict.get(k) if key: if isinstance(key, list): if isinstance(key[1], dict): value = key[1][v] else: value = key[1] if value: v = value key = key[0] if v: if isinstance(v, dict): v = Settings(v) specific_from_generic_settings \ .specific[self.pkg_name][key] = v else: specific_from_generic_settings \ .specific[self.pkg_name][key] else: self.handle_special_keywords( specific_from_generic_settings, k, v, mol) return settings.overlay(specific_from_generic_settings)
def dict2Setting(d): """ Transform recursively a dict into a Settings object. """ r = Settings() for k, v in d.items(): if isinstance(v, dict): r[k] = dict2Setting(v) else: r[k] = v return r
def run_job(self, settings, settings_2=None, inputArgues=None, others=None, job_name='', **kwargs): """ Execute ADF job. :param settings: user input settings. :type settings: |Settings| :param mol: Molecule to run the simulation :type mol: Plams Molecule :parameter input_file_name: The user can provide a name for the job input. :type input_file_name: String :parameter out_file_name: The user can provide a name for the job output. :type out_file_name: String :returns: :class:`~qmworks.packages.SCM.ADF_Result` """ fragmentset = Settings() complexset = Settings() fragmentset.input = settings.specific.fragment complexset.input = settings_2.specific.complex job = PyFragJob(fragmentset, complexset, inputArgues, others) result = job.run() return result
def extract_properties_rkf(path_rkf, key=None): """ """ kf = plams.kftools.KFFile(path_rkf).read props = Settings() for i in range(kf('Properties', 'nEntries')): typ = kf('Properties', 'Type(' + str(i + 1) + ')').strip() subtype = kf('Properties', 'Subtype(' + str(i + 1) + ')').strip() value = kf('Properties', 'Value(' + str(i + 1) + ')') props[typ][subtype] = value return props[key]
def extract_properties_rkf(path_rkf, key=None): """ Read result from a DFTB computation using the job_name.rkf file. """ kf = plams.tools.kftools.KFFile(path_rkf).read props = Settings() for i in range(kf('Properties', 'nEntries')): typ = kf('Properties', 'Type(' + str(i + 1) + ')').strip() subtype = kf('Properties', 'Subtype(' + str(i + 1) + ')').strip() value = kf('Properties', 'Value(' + str(i + 1) + ')') props[typ][subtype] = value ret = props[key] if isinstance(ret, list): ret = np.array(ret) return ret
def build_dirac_input(s): """ Transform the Setting provided by the user together with the defaults into a Dirac input. :param easySett: Settings containing the user provided input :type easySett: Settings """ inp = Settings() inp.input.DIRAC["WAVE FUNCTION"] if s.input.GEOMOPT: inp.input.DIRAC["WAVE FUNCTION"]["OPTIMIZE"] funs = [ build_hamiltonian_opts, build_method_opts, build_basis_opts, build_transf_opts, build_integral_opts, build_properties_opts, build_exportlevel_opts ] for f in funs: inp, s = f(*(inp, s)) return inp
def decode(self, cls, data): return Settings(data)