Ejemplo n.º 1
0
    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:`~qmflows.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.interfaces.gamess.GamessJob(molecule=mol,
                                                name=job_name,
                                                settings=gamess_settings)
        r = job.run()

        # Relative job path
        relative_plams_path = '/'.join(r.job.path.split('/')[-2:])

        result = Gamess_Result(gamess_settings,
                               mol,
                               r.job.name,
                               plams_dir=relative_plams_path,
                               work_dir=work_dir,
                               status=job.status)

        return result
Ejemplo n.º 2
0
    def run_job(settings, mol, job_name="dirac_job"):

        dirac_settings = Settings()
        dirac_settings.input = settings.specific.dirac
        dirac_settings.ignore_molecule
        job = plams.interfaces.thirdparty.dirac.DiracJob(
            name=job_name, settings=dirac_settings, molecule=mol)
        result = job.run()

        # Relative job path
        relative_plams_path = '/'.join(result.job.path.split('/')[-2:])

        return DIRAC_Result(dirac_settings, mol, result.job.name,
                            plams_dir=relative_plams_path, status=job.status)
Ejemplo n.º 3
0
    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:`~qmflows.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

        # Add molecular coordinates
        m = format_coord_xyz(mol) + '{:>8}'.format('&END')
        cp2k_settings.input.force_eval.subsys['&COORD'] = m

        # Create a Plams job
        job = plams.interfaces.thirdparty.cp2k.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

        warnings = parse_output_warnings(job_name, r.job.path,
                                         parse_cp2k_warnings, cp2k_warnings)

        result = CP2K_Result(cp2k_settings,
                             mol,
                             job_name,
                             r.job.path,
                             work_dir,
                             status=job.status,
                             warnings=warnings)

        return result
Ejemplo n.º 4
0
    def run_job(settings, mol, job_name='DFTBjob', nproc=None):
        """
        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:`~qmflows.packages.SCM.DFTB_Result`
        """
        dftb_settings = Settings()
        if nproc:
            dftb_settings.runscript.nproc = nproc
        dftb_settings.input = settings.specific.dftb
        job = plams.DFTBJob(name=job_name,
                            molecule=mol,
                            settings=dftb_settings)

        # Check RKF status
        try:
            result = job.run()
            name = result.job.name
            path = result.job.path
        except struct.error:
            job.status = 'failed'
            name = job_name
            path = None
            msg = "job:{} has failed.\nRKF is corrupted"
            print(msg.format(job_name))

        if job.status in ['failed', 'crashed']:
            builtins.config.jm.remove_job(job)

        return DFTB_Result(dftb_settings,
                           mol,
                           name,
                           plams_dir=path,
                           status=job.status)
Ejemplo n.º 5
0
    def run_job(settings, mol, job_name="ORCAjob", work_dir=None, **kwargs):

        orca_settings = Settings()
        orca_settings.input = settings.specific.orca

        # Running Orca with Plams
        job = plams.interfaces.orca.ORCAJob(molecule=mol,
                                            settings=orca_settings,
                                            name=job_name)
        result = job.run()

        # Relative job path
        relative_plams_path = '/'.join(result.job.path.split('/')[-2:])

        return ORCA_Result(orca_settings,
                           mol,
                           result.job.name,
                           plams_dir=relative_plams_path,
                           status=job.status)
Ejemplo n.º 6
0
    def run_job(settings, mol, job_name='ADFjob', nproc=None):
        """
        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:`~qmflows.packages.SCM.ADF_Result`
        """
        adf_settings = Settings()
        if nproc:
            adf_settings.runscript.nproc = nproc
        adf_settings.input = settings.specific.adf
        job = plams.ADFJob(name=job_name, molecule=mol, settings=adf_settings)
        result = job.run()
        # Path to the tape 21 file
        path_t21 = result._kf.path

        # Relative path to the CWD
        relative_path_t21 = '/'.join(path_t21.split('/')[-3:])

        # Relative job path
        relative_plams_path = '/'.join(result.job.path.split('/')[-2:])

        adf_result = ADF_Result(adf_settings,
                                mol,
                                result.job.name,
                                relative_path_t21,
                                plams_dir=relative_plams_path,
                                status=job.status)

        return adf_result