PyFrag
Public Member Functions | Public Attributes | List of all members
qmworks.plams.core.basejob.SingleJob Class Reference
Inheritance diagram for qmworks.plams.core.basejob.SingleJob:
Inheritance graph
[legend]
Collaboration diagram for qmworks.plams.core.basejob.SingleJob:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, molecule=None, kwargs)
 
def get_input (self)
 
def get_runscript (self)
 
def hash (self)
 
- Public Member Functions inherited from qmworks.plams.core.basejob.Job
def __init__ (self, name='plamsjob', settings=None, depend=None)
 
def __getstate__ (self)
 
def run (self, jobrunner=None, jobmanager=None, kwargs)
 
def pickle (self, filename=None)
 
def check (self)
 
def hash (self)
 
def prerun (self)
 
def postrun (self)
 

Public Attributes

 molecule
 
 status
 
- Public Attributes inherited from qmworks.plams.core.basejob.Job
 status
 
 results
 
 name
 
 path
 
 jobmanager
 
 parent
 
 settings
 
 default_settings
 
 depend
 

Detailed Description

Abstract class representing a job consisting of a single execution of some external binary (or arbitrary shell script in general).

In addition to constructor arguments and attributes defined by |Job|, the constructor of this class accepts the keyword argument ``molecule`` that should be a |Molecule| instance.

Class attribute ``_filenames`` defines default names for input, output, runscript and error files. If you wish to override this attribute it should be a dictionary with string keys ``'inp'``, ``'out'``, ``'run'``, ``'err'``. The value for each key should be a string describing corresponding file's name. Shortcut ``$JN`` can be used for job's name. The default value is defined in the following way::

    >>> _filenames = {'inp':'$JN.in', 'run':'$JN.run', 'out':'$JN.out', 'err': '$JN.err'}

This class defines no new methods that could be directly called in your script. Methods that can and should be overridden are :meth:`~SingleJob.get_input` and :meth:`~SingleJob.get_runscript`.

Member Function Documentation

◆ get_input()

def qmworks.plams.core.basejob.SingleJob.get_input (   self)
Generate the input file. Abstract method.

This method should return a single string with full content of the input file. It should process information stored in ``input`` branch of job's settings and in ``molecule`` attribute.
Here is the caller graph for this function:

◆ get_runscript()

def qmworks.plams.core.basejob.SingleJob.get_runscript (   self)
Generate runscript. Abstract method.

This method should return a single string with runscript contents. It can process information stored in ``runscript`` branch of job's settings. In general the full runscript has the following form::

    [first line defined by job.settings.runscript.shebang]

    [contents of job.settings.runscript.pre, if any]

    [value returned by get_runscript()]

    [contents of job.settings.runscript.post, if any]

When overridden, this method should pay attention to ``.runscript.stdout_redirect`` key in job's ``settings``.
Here is the caller graph for this function:

◆ hash()

def qmworks.plams.core.basejob.SingleJob.hash (   self)
Calculate unique hash of this instance.

The behavior of this method is adjusted by the value of ``hashing`` key in |JobManager| settings. If no |JobManager| is yet associated with this job, default setting from ``config.jobmanager.hashing`` is used.

Currently supported values for ``hashing`` are:
    *   ``False`` or ``None`` -- returns ``None`` and disables |RPM|.
    *   ``input`` -- returns SHA256 hash of the input file.
    *   ``runscript`` -- returns SHA256 hash of the runscript.
    *   ``input+runscript`` -- returns SHA256 hash of the concatenation of input and runscript.
Here is the call graph for this function:

The documentation for this class was generated from the following file: