atomate.common.firetasks package

Submodules

atomate.common.firetasks.glue_tasks module

class atomate.common.firetasks.glue_tasks.CopyFiles(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Task to copy the given list of files from the given directory to the destination directory. To customize override the setup_copy and copy_files methods.

Optional params:

from_dir (str): path to the directory containing the files to be copied. Supports env_chk. to_dir (str): path to the destination directory. Supports env_chk. filesystem (str) files_to_copy (list): list of file names. Defaults to copying everything in from_dir. exclude_files (list): list of file names to be excluded. suffix (str): suffix to append to each filename when copying

(e.g., rename ‘INCAR’ to ‘INCAR.precondition’)

continue_on_missing(bool): Whether to continue copying when a file

in filenames is missing. Defaults to False.

copy_files()

Defines the copy operation. Override this to customize copying.

optional_params = ['from_dir', 'to_dir', 'filesystem', 'files_to_copy', 'exclude_files', 'suffix', 'continue_on_missing']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

setup_copy(from_dir, to_dir=None, filesystem=None, files_to_copy=None, exclude_files=None, from_path_dict=None, suffix=None, fw_spec=None, continue_on_missing=False)

setup the copy i.e setup the from directory, filesystem, destination directory etc.

Args:

from_dir (str) to_dir (str) filesystem (str) files_to_copy (list): if None all the files in the from_dir will be copied exclude_files (list): list of file names to be excluded. suffix (str): suffix to append to each filename when copying

(e.g., rename ‘INCAR’ to ‘INCAR.precondition’)

continue_on_missing(bool): Whether to continue copying when a file

in filenames is missing. Defaults to False.

from_path_dict (dict): dict specification of the path. If specified must contain at

least the key “path” that specifies the path to the from_dir.

class atomate.common.firetasks.glue_tasks.CopyFilesFromCalcLoc(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Based on CopyVaspOutputs but for general file copying. Note “calc_locs” must be set in the fw_spec. Files are copied to the current folder.

Required params:

calc_loc: name of target fw to get location for within the calc_locs.

Optional params:
filenames (list(str)): filenames to copy. Special behavior for:

None: if filenames not set, all files in calc_loc will be copied ‘$ALL_NO_SUBDIRS’ in filenames: similar to filenames is None ‘$ALL’ in filenames: all files and subfolders copied, name_prepend

and name_append cannot be set in this case.

Accepts glob patterns.

name_prepend (str): string to prepend filenames, e.g. can be a

directory.

name_append (str): string to append to destination filenames. exclude_files (list): list of file names to be excluded. Accepts glob

patterns.

optional_params = ['filenames', 'name_prepend', 'name_append', 'exclude_files']
required_params = ['calc_loc']
run_task(fw_spec=None)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.CreateFolder(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

FireTask to create new folder with the option of changing directory to the new folder.

Required params:

folder_name (str): folder name.

Optional params:
change_dir(bool): change working dir to new folder after creation.

Defaults to False.

relative_path (bool): whether folder name is relative or absolute.

Defaults to True.

optional_params = ['change_dir', 'relative_path']
required_params = ['folder_name']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.DeleteFiles(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Delete files Uses glob to search for files so any pattern it can accept can be used

Required params:

files: list of files to remove

required_params = ['files']
run_task(fw_spec=None)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.DeleteFilesPrevFolder(*args, **kwargs)

Bases: atomate.common.firetasks.glue_tasks.DeleteFiles

Can delete files, also from a previous folder in the wf if one of the optional parameters are given Required params:

files: list of files to remove

Optional params:

calc_dir: directory to delete the files from calc_loc (str OR bool): if True will set most recent calc_loc. If str

search for the most recent calc_loc with the matching name

optional_params = ['calc_dir', 'calc_loc']
required_params = ['files']
run_task(fw_spec=None)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.GzipDir(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Task to gzip the current directory.

optional_params = []
required_params = []
run_task(fw_spec=None)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.PassCalcLocs(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Passes information about where the current calculation is located for the next FireWork. This is achieved by passing a key to the fw_spec called “calc_locs” with this information.

Required params:

name (str): descriptive name for this calculation file/dir

Optional params:
filesystem (str or custom user format): name of filesystem. Supports env_chk.

defaults to None

path (str): The path to the directory containing the calculation. defaults to

current working directory.

optional_params = ['filesystem', 'path']
required_params = ['name']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.glue_tasks.PassResult(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Passes properties and corresponding user-specified data resulting from a run from parent to child fireworks. Uses a string syntax similar to Mongo-style queries to designate values of output file dictionaries to retrieve. For example, one could specify a task to pass the stress from the current calculation using:

PassResult(pass_dict={‘stress’: “>>ionic_steps.-1.stress”})

Required params:
pass_dict (dict): dictionary designating keys and values to pass

to child fireworks. If value is a string beginning with ‘>>’, the firework will search the parsed VASP output dictionary for the designated property by following the sequence of keys separated with periods, e. g. “>>ionic_steps.-1.stress” is used to designate the stress from the last ionic_step. If the value is not a string or does not begin with “>>”, it is passed as is.

parse_class (str): string representation of complete path to a class

with which to parse the output, e. g. pymatgen.io.vasp.Vasprun or pymatgen.io.feff.LDos.from_file, class must be MSONable

parse_kwargs (str): dict of kwargs for the parse class,

e. g. {“filename”: “vasprun.xml”, “parse_dos”: False, “parse_eigen”: False}

Optional params:
calc_dir (str): path to dir that contains VASP output files, defaults

to ‘.’, e. g. current directory

mod_spec_cmd (str): command to issue for mod_spec, e. g. “_set” or “_push”,

defaults to “_set”

mod_spec_key (str): key to pass to mod_spec _set dictmod command, defaults

to “prev_calc_result”

optional_params = ['calc_dir', 'mod_spec_cmd', 'mod_spec_key']
required_params = ['pass_dict', 'parse_class', 'parse_kwargs']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

atomate.common.firetasks.glue_tasks.get_calc_loc(target_name, calc_locs)

This is a helper method that helps you pick out a certain calculation from an array of calc_locs.

There are three modes:
  • If you set target_name to a String, search for most recent calc_loc

    with matching nameget_

  • Otherwise, return most recent calc_loc overall

Args:
target_name: (bool or str) If str, will search for calc_loc with

matching name, else use most recent calc_loc

calc_locs: (dict) The dictionary of all calc_locs

Returns:

(dict) dict with subkeys path, filesystem, and name

atomate.common.firetasks.parse_outputs module

class atomate.common.firetasks.parse_outputs.ToDbTask(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

General task to parse output data via a Drone and either (i) write to JSON file or (ii) insert into a database.

Required params:

drone (AbstractDrone): Drone to convert the data to dict

Optional params:
db_file (str): path to file containing the database credentials. Supports env_chk.

Default is None, which will write data to JSON file.

mmdb (MMDb) (str): If db_file, sets the type of MMDb, e.g. “atomate.vasp.database.MMVaspDb” calc_dir (str): path to dir (on current filesystem) that contains calculation output files.

Default: use current working directory.

calc_loc (str OR bool): if True will set most recent calc_loc. If str search for the most

recent calc_loc with the matching name

options (dict): dict of options to pass into the Drone additional_fields (dict): dict of additional fields to add

optional_params = ['mmdb', 'db_file', 'calc_dir', 'calc_loc', 'additional_fields', 'options']
required_params = ['drone']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

atomate.common.firetasks.run_calc module

class atomate.common.firetasks.run_calc.RunCommand(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Execute a command directly (no custodian).

Required params:

cmd (str): the name of the full executable to run. Supports env_chk.

Optional params:

expand_vars (str): Set to true to expand variable names in the cmd.

optional_params = ['expand_vars']
required_params = ['cmd']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

class atomate.common.firetasks.run_calc.RunCustodianFromObjects(*args, **kwargs)

Bases: fireworks.core.firework.FiretaskBase

Run VASP using custodian in a generic manner using built-in custodian objects

Required params:

jobs: ([Job]) - a list of custodian jobs to run handlers: ([ErrorHandler]) - a list of error handlers

Optional params:

validators: ([Validator]) - a list of Validators custodian_params ({}) - dict of all other custodian parameters

optional_params = ['validators', 'custodian_params']
required_params = ['jobs', 'handlers']
run_task(fw_spec)

This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

Args:
fw_spec (dict): A Firework spec. This comes from the master spec.

In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

Returns:

(FWAction)

Module contents