abiflows.fireworks.tasks package

Subpackages

Submodules

abiflows.fireworks.tasks.abinit_common module

abiflows.fireworks.tasks.abinit_common.unprime_nband(nband, number_of_primes=10)[source]

abiflows.fireworks.tasks.abinit_tasks module

Abinit Task classes for Fireworks.

class abiflows.fireworks.tasks.abinit_tasks.BasicAbinitTaskMixin[source]

Bases: object

task_type = ''
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
get_fw_task_manager(fw_spec)[source]

Generates an instance of FWTaskManager. First looks for a ‘ftm_file’ key in the spec, otherwise generates it with FWTaskManager.from_user_config. The configuration is updated with the keywords defined in ‘fw_policy’ in the spec.

run_autoparal(abiinput, autoparal_dir, ftm, clean_up='move')[source]

Runs the autoparal using AbinitInput abiget_autoparal_pconfs method. The information are retrieved from the FWTaskManager that should be present and contain the standard AbiPy pymatgen.io.abinit.tasks.TaskManager, that provides information about the queue adapters. No check is performed on the autoparal_dir. If there is a possibility of overwriting output data due to reuse of the same folder, it should be handled by the caller.

run_fake_autoparal(ftm)[source]

In cases where the autoparal is not supported a fake run autoparal can be used to set the queueadapter. Takes the number of processors suggested by the manager given that the paral hints contain all the number of processors up tu max_cores and they all have the same efficiency.

get_final_mod_spec(fw_spec)[source]

Generates the standard mod_spec dict for the FWAction. Pushes the information of the current task to the list associated with self.task_type. Requires a “current_task_info” method.

set_logger()[source]

Set a logger for pymatgen.io.abinit and abipy

Links the required files from previous runs in the indata folder. It will first try to link the fortran file and then the Netcdf file, if the first is not found.

Parameters
  • ext – extension that should be linked

  • source_dir – path to the source directory

  • strict – if True an exception is raised if the file is missing.

Returns

The path to the generated link. None if strict=False and the file could not be found.

Links the DDK files rom previous runs in the indata folder. Accepts more than one DDK file in the source_dir: multiple perturbations are allowed in a single calculation. Note that the DDK extension is not generated by abinit, but should be created from the appropriate 1WF file.

Links the 1DEN and 1WF files in the indata folder. It will first try to link the fortran file and then the Netcdf file, if the first is not found.

prefix = Prefix(idata='indata/in', odata='outdata/out', tdata='tmpdata/tmp')
class abiflows.fireworks.tasks.abinit_tasks.AbiFireTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.BasicAbinitTaskMixin, fireworks.core.firework.FireTaskBase

CRITICAL_EVENTS = []
set_workdir(workdir)[source]

Sets up the working directory: adds attributes for all the files and directories.

rename_outputs()[source]

If rerunning in the same folder, we rename the outputs according to the abipy convention: Abinit has the very bad habit of changing the file extension by appending the characters in [A,B …, Z] to the output file, and this breaks a lot of code that relies of the use of a unique file extension. Here we fix this issue by renaming run.abo to run.abo_[number] if the output file “run.abo” already exists. This is applied both if the calculation is rerun from scratch or with a restart in the same folder.

property filesfile_string

String with the list of files and prefixes needed to execute ABINIT.

config_run(fw_spec)[source]

Configure the job for the run:

  • set up logging system

  • sets and creates the directories and the input files needed to run the task.

  • sets dependencies and data from previous run (both the case of a restart in the same folder as the previous FW and the case of a creation of a new folder).

run_abinit(fw_spec)[source]

Executes abinit and waits for the end of the process. The mpirun and abinit commands are retrived from the mpirun_cmd and abinit_cmd keys in the fw_policy of the FWTaskManager, that can be overridden by the values in the spec. Note that in case of missing definition of these parameters, the values fall back to the default values of mpirun_cmd and abinit_cmd: ‘mpirun’ and ‘abinit’, assuming that these are properly retrieved from the $PATH.

get_event_report(source='log')[source]

Analyzes the main output file for possible Errors or Warnings. Will check the presence of an MPIABORTFILE if not output file is found.

Parameters

source – “output” or “log”. Determine which file will be parsed.

Returns

EventReport instance or None if none of the output files exist.

task_analysis(fw_spec)[source]

This function checks final status of the calculation, inspecting the output and error files. Sets up the restart in case of convergence not achieved (both from abinit or from the convergence of cofiguration parameters) or in case of errors fixable by a ErrorHandler. If the job is completed calls conclude_task and prepares the FWAction. Raises an AbinitRuntimeError if unfixable errors are encountered or if the number or restarts exceeds the number defined in the policy.

check_parameters_convergence(fw_spec)[source]

Base method related to the iterative convergence of some configuration parameter. Specific task should overwrite this method and implement appropriate checks and updates of the specific parameters.

Parameters

fw_spec – The spec

Returns

tuple containing:

  • unconverged_params(dict): The uncoverged input variables that should be updated as keys and their

    corresponding new values as values.

  • reset (boolean): True if a reset is required in self.prepare_restart.

Return type

(tuple)

prepare_restart(fw_spec, reset=False)[source]

Determines the required information for the restart. It will be called at the end of a task which requires a restart (both for an error or for the convergence of some configuration parameter). Sets self.restart_info with an instance of RestartInfo.

Parameters
  • fw_spec – the spec

  • reset – if True a reset will be set in the restart_info

Returns

tuple containing:

  • local_restart (boolean): True if the restart should be in the same folder

  • new_fw (Firework): The new firework that should be used for detour

  • stored_data (dict): Dict to be saved in the “stored_data”

Return type

(tuple)

fix_abicritical(fw_spec)[source]

method to fix crashes/error caused by abinit

Returns

tuple containing:

retcode (int): 1 if task has been fixed else 0. reset (boolean): True if at least one of the corrections applied requires a reset

Return type

(tuple)

setup_task(fw_spec)[source]
Sets up the requirements for the task:
  • sets several attributes

  • generates the input in case self.abiinput is a factory

  • makes directories

  • handles information in ‘_exception_details’

run_task(fw_spec)[source]

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.

Parameters

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)

restart()[source]

Restart method. Each subclass should implement its own restart. It is called at the beginning of a task that is the restart of a previous one. The base class should be called for common restarting operations.

conclude_task(fw_spec)[source]

Performs operations that should be handled at the end of the tasks in case of successful completion. Subclasses can overwrite to add additional operations, but the returns should be the same and it is suggested to call original method with super.

Parameters

fw_spec – the spec

Returns

tuple containing:

update_spec (dict): dictionary that should be passed to update_spec mod_spec (dict): dictionary that should be passed to mod_spec stored_data (dict): dictionary that should be passed to stored_data

Return type

(tuple)

current_task_info(fw_spec)[source]

A dict containing information that should be passed to subsequent tasks. It should contain at least the current workdir and input. Subclasses can add specific additional information.

autoparal(fw_spec)[source]

Runs the task in autoparal and creates the new Firework with the optimized configuration.

Parameters

fw_spec – the spec

Returns

The FWAction containing the detour Firework.

resolve_deps_per_task_type(previous_tasks, deps_list)[source]

Method to link the required deps for the current FW for a specific task_type. Sets the ird variables corresponding to the linked dependecies.

Parameters
  • previous_tasks – list of previous tasks from which the dependencies should be linked

  • deps_list – list of dependencies that should be linked

resolve_deps(fw_spec)[source]

Method to link the required deps for the current FW. Note that different cases are handled here depending whether the current FW is a restart or not and whether the rerun is performed in the same folder or not. In case of restart the safest choice is to link the deps of the previous FW, so that if they have been updated in the meanwhile we are taking the correct one. TODO: this last case sounds quite unlikely and should be tested

load_previous_fws_data(fw_spec)[source]

Called if a previous_fws key is in spec and the job is not a restart. Allows to load information from previous tasks if needed. Subclasses can overwrite to handle specific cases.

Parameters

fw_spec – The spec

out_to_in(out_file)[source]

links or copies, according to the fw_policy, the output file to the input data directory of this task and rename the file so that ABINIT will read it as an input data file.

Returns

The absolute path of the new file in the indata directory.

in_to_in(in_file)[source]

Copies the input file to the input of a previous task to the data directory of this task

Returns

The absolute path of the new file in the indata directory.

remove_restart_vars(exts)[source]

Removes from the current input the ird values associated with the extension. Useful in case of reset during a restart.

class abiflows.fireworks.tasks.abinit_tasks.GsFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFireTask

Base Task to handle Ground state calculation.

Inheritance Diagram

Inheritance diagram of GsFWTask
property gsr_path

Absolute path of the GSR file. Empty string if file is not present.

open_gsr()[source]

Open the GSR.nc file located in the in self.outdir. Returns abipy.electrons.gsr.GsrFile object, raise a PostProcessError exception if file could not be found or file is not readable.

class abiflows.fireworks.tasks.abinit_tasks.ScfFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.GsFWTask

Task to handle SCF calculations

Inheritance Diagram

Inheritance diagram of ScfFWTask
task_type = 'scf'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.ScfConvergenceWarning'>]
restart()[source]

SCF calculations can be restarted if we have either the WFK file or the DEN file.

class abiflows.fireworks.tasks.abinit_tasks.NscfFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.GsFWTask

Task to handle non SCF calculations

Inheritance Diagram

Inheritance diagram of NscfFWTask
task_type = 'nscf'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.NscfConvergenceWarning'>]
restart()[source]

NSCF calculations can be restarted only if we have the WFK file.

class abiflows.fireworks.tasks.abinit_tasks.NscfWfqFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.NscfFWTask

Task to handle non SCF calculations for the calculations of the WFQ. Differs from NscfFWTask for the different restart requirements.

Inheritance Diagram

Inheritance diagram of NscfWfqFWTask
task_type = 'nscf_wfq'
restart()[source]

NSCF calculations can be restarted only if we have the WFK file. Wfq calculations require a WFK file for restart. The produced out_WFQ needs to be linked as a in_WFK with appropriate irdwfk=1.

out_to_in(out_file)[source]

links or copies, according to the fw_policy, the output file to the input data directory of this task and rename the file so that ABINIT will read it as an input data file. In the case of Wfq calculations out_WFQ needs to be linked as a in_WFK

Returns

The absolute path of the new file in the indata directory.

class abiflows.fireworks.tasks.abinit_tasks.RelaxFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.GsFWTask

Task to handle relax calculations

Inheritance Diagram

Inheritance diagram of RelaxFWTask
task_type = 'relax'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.RelaxConvergenceWarning'>]
get_final_structure()[source]

Read the final structure from the GSR.nc file.

prepare_restart(fw_spec, reset=False)[source]

Sets the final structure in abiinput, so that the relax can continue in the detour and calls the baseclass method.

restart()[source]

Restart the structural relaxation.

See original RelaxTask for more details

current_task_info(fw_spec)[source]

Add the final structure to the basic current_task_info

property hist_nc_path

Absolute path of the HIST.nc file. Empty string if file is not present.

out_to_in_tim(out_file, in_file)[source]

links or copies, according to the fw_policy, the output file to the input data directory of this task and rename the file so that ABINIT will read it as an input data file. for the TIM file the input needs to be specified as depends on the specific iteration.

Returns

The absolute path of the new file in the indata directory.

class abiflows.fireworks.tasks.abinit_tasks.HybridFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.GsFWTask

Task to handle hybrid functional calculations based on GW.

Inheritance Diagram

Inheritance diagram of HybridFWTask
task_type = 'hybrid'
CRITICAL_EVENTS = []
property sigres_path

Absolute path of the SIGRES.nc file. Empty string if file is not present.

open_sigres()[source]

Open the SIGRES.nc file located in the in self.outdir. Returns abipy.electrons.gw.SigresFile object, None if file could not be found or file is not readable.

class abiflows.fireworks.tasks.abinit_tasks.DfptTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFireTask

Base Task to handle DFPT calculations

Inheritance Diagram

Inheritance diagram of DfptTask
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.ScfConvergenceWarning'>]
task_type = 'dfpt'
restart()[source]

Phonon calculations can be restarted only if we have the 1WF file or the 1DEN file. from which we can read the first-order wavefunctions or the first order density. Prefer 1WF over 1DEN since we can reuse the wavefunctions. Try to handle an input with many perturbation calculated at the same time. link/copy all the 1WF or 1DEN files

class abiflows.fireworks.tasks.abinit_tasks.DdkTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle DDK calculations

Inheritance Diagram

Inheritance diagram of DdkTask
task_type = 'ddk'
conclude_task(fw_spec)[source]

Extends the base class method in order to create a _DDK file from the 1WF.

class abiflows.fireworks.tasks.abinit_tasks.DdeTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle DDE calculations

Inheritance Diagram

Inheritance diagram of DdeTask
task_type = 'dde'
class abiflows.fireworks.tasks.abinit_tasks.PhononTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle phonon calculations

Inheritance Diagram

Inheritance diagram of PhononTask
task_type = 'phonon'
class abiflows.fireworks.tasks.abinit_tasks.BecTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle BEC calculations

Inheritance Diagram

Inheritance diagram of BecTask
task_type = 'bec'
class abiflows.fireworks.tasks.abinit_tasks.StrainPertTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle strain calculations

Inheritance Diagram

Inheritance diagram of StrainPertTask
task_type = 'strain_pert'
class abiflows.fireworks.tasks.abinit_tasks.DteTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.DfptTask

Task to handle the third derivatives with respect to the electric field.

Inheritance Diagram

Inheritance diagram of DteTask
CRITICAL_EVENTS = []
task_type = 'dte'
run_autoparal(abiinput, autoparal_dir, ftm, clean_up='move')[source]

Non-linear does not support autoparal, so this will provide a fake run of the autoparal.

class abiflows.fireworks.tasks.abinit_tasks.RelaxDilatmxFWTask(abiinput, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, target_dilatmx=1.01)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.RelaxFWTask

Task to handle relax calculations with iterative convergence of the dilatmx

Inheritance Diagram

Inheritance diagram of DteTask
check_parameters_convergence(fw_spec)[source]

Checks if the target value for the dilatmx has been reached. If not reduces the values for the dilatmx and signals that a restart is needed.

Parameters

fw_spec – the spec of the Firework

class abiflows.fireworks.tasks.abinit_tasks.MergeDdbAbinitTask(ddb_source_task_types=None, delete_source_ddbs=True, num_ddbs=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.BasicAbinitTaskMixin, fireworks.core.firework.FireTaskBase

Task to handle the merge of multiple DDB files with mrgddb

Inheritance Diagram

Inheritance diagram of MergeDdbAbinitTask
task_type = 'mrgddb'
get_ddb_list(previous_fws, task_type)[source]

Given a task_type that can produce DDB files and whole list of previous fireworks available here, gets the list of DDB files that should be merged.

Parameters
  • previous_fws – list of previous fireworks

  • task_type – string describing the task type

Returns

The list of DDB files that should be linked

get_event_report(ofile_name='mrgddb.stdout')[source]

Analyzes the main output file for possible Errors or Warnings.

Parameters

ofile_name – Name of the outpu file.

Returns

EventReport instance or None if the output file does not exist.

set_workdir(workdir)[source]

Sets up the working directory: adds attributes for all the files and directories.

run_task(fw_spec)[source]

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.

Parameters

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)

current_task_info(fw_spec)[source]

A dict containing information that should be passed to subsequent tasks. In this case it contains the current workdir.

property merged_ddb_path

Absolute path of the merged DDB file. Empty string if file is not present.

class abiflows.fireworks.tasks.abinit_tasks.AnaDdbAbinitTask(anaddb_input, restart_info=None, handlers=None, is_autoparal=None, deps=None, history=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.BasicAbinitTaskMixin, fireworks.core.firework.FireTaskBase

Task that handles the run of anaddb based on a custom input

Inheritance Diagram

Inheritance diagram of AnaDdbAbinitTask
task_type = 'anaddb'
property ec_path

Absolute path of the GSR.nc file. Empty string if file is not present.

get_elastic_tensor(tensor_type='relaxed_ion')[source]

Open the EC file located in the in self.workdir. Returns ElasticConstant object, None if file could not be found or file is not readable.

resolve_deps_per_task_type(previous_tasks, deps_list)[source]

Method to link the required deps for the current FW for a specific task_type.

Parameters
  • previous_tasks – list of previous tasks from which the dependencies should be linked

  • deps_list – list of dependencies that should be linked

resolve_deps(fw_spec)[source]

Method to link the required deps for the current FW.

run_anaddb(fw_spec)[source]

executes anaddb and waits for the end of the process. TODO: make it general in the same way as “run_abinit” the mpirun command is retrived from the mpirun_cmd keys in the fw_polity of the FWTaskManager, that can be overridden by the values in the spec. Note that in case of missing definition of this parameter, the values fall back to the default value of mpirun_cmd: ‘mpirun’, assuming that it is properly retrived from the $PATH. By default, anaddb is retrieved from the PATH.

setup_task(fw_spec)[source]
Sets up the requirements for the task:
  • sets several attributes

  • makes directories

  • writes input files

run_task(fw_spec)[source]

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.

Parameters

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)

task_analysis(fw_spec)[source]
set_workdir(workdir)[source]

Set the working directory.

property filesfile_string

String with the list of files and prefixes needed to execute ABINIT.

property phbst_path

Absolute path of the run.abo_PHBST.nc file. Empty string if file is not present.

property phdos_path

Absolute path of the run.abo_PHDOS.nc file. Empty string if file is not present.

property anaddb_nc_path

Absolute path of the anaddb.nc file. Empty string if file is not present.

open_phbst()[source]

Open PHBST file produced by Anaddb and returns abipy.dfpt.phonons.PhbstFile object. Raise a PostProcessError exception if file could not be found or file is not readable.

open_phdos()[source]

Open PHDOS file produced by Anaddb and returns abipy.dfpt.phonons.PhdosFile object. Raise a PostProcessError exception if file could not be found or file is not readable.

open_anaddbnc()[source]

Open anaddb.nc file produced by Anaddb and returns abipy.dfpt.anaddb.AnaddbNcFile object. Raise a PostProcessError exception if file could not be found or file is not readable.

class abiflows.fireworks.tasks.abinit_tasks.AutoparalTask(abiinput, restart_info=None, handlers=None, deps=None, history=None, is_autoparal=True, task_type=None, forward_spec=False, skip_spec_keys=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFireTask

Task to run the autoparal for many tasks of the same type already defined as children

Inheritance Diagram

Inheritance diagram of AutoparalTask
task_type = 'autoparal'
autoparal(fw_spec)[source]

Runs the autoparal, if an input is available. Does not return a detour, updates the children fws instead.

class abiflows.fireworks.tasks.abinit_tasks.GeneratePhononFlowFWAbinitTask(phonon_factory, previous_task_type='scf', handlers=None, with_autoparal=None, ddb_file=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.BasicAbinitTaskMixin, fireworks.core.firework.FireTaskBase

Task that generates all the phonon perturbation based on the input of the previous ground state step

Inheritance Diagram

Inheritance diagram of GeneratePhononFlowFWAbinitTask
get_fws(multi_inp, task_class, deps, new_spec, ftm, nscf_fws=None)[source]

Prepares the fireworks for a specific type of calculation

Parameters
  • multi_inpabipy.abio.inputs.MultiDataset with the inputs that should be run

  • task_class – class of the tasks that should be generated

  • deps – dict with the dependencies already set for this type of task

  • new_spec – spec for the new Fireworks that will be created

  • ftm – a FWTaskManager

  • nscf_fws – list of NSCF fws for the calculation of WFQ files, in case they are present. Will be linked if needed.

Returns

tuple containing:

  • fws (list): The list of new Fireworks.

  • fw_deps (dict): The dependencies related to these fireworks. Should be used when generating

    the workflow.

Return type

(tuple)

run_task(fw_spec)[source]

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.

Parameters

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 abiflows.fireworks.tasks.abinit_tasks.ErrorCode[source]

Bases: object

Error code to classify the errors

ERROR = 'Error'
UNRECOVERABLE = 'Unrecoverable'
UNCLASSIFIED = 'Unclassified'
UNCONVERGED = 'Unconverged'
UNCONVERGED_PARAMETERS = 'Unconverged_parameters'
INITIALIZATION = 'Initialization'
RESTART = 'Restart'
POSTPROCESS = 'Postprocess'
WALLTIME = 'Walltime'
exception abiflows.fireworks.tasks.abinit_tasks.AbiFWError(msg)[source]

Bases: Exception

Base class for the errors in abiflows

to_dict()[source]
exception abiflows.fireworks.tasks.abinit_tasks.AbinitRuntimeError(task=None, msg=None, num_errors=None, num_warnings=None, errors=None, warnings=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFWError

Exception raised for errors during Abinit calculation. Contains the information about the errors and warning extracted from the output files. Initialized with a task, uses it to prepare a suitable error message.

ERROR_CODE = 'Error'
to_dict()[source]
as_dict()[source]
classmethod from_dict(d)[source]
exception abiflows.fireworks.tasks.abinit_tasks.UnconvergedError(task=None, msg=None, num_errors=None, num_warnings=None, errors=None, warnings=None, abiinput=None, restart_info=None, history=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbinitRuntimeError

Exception raised when a calculation didn’t converge within the selected number of restarts.

ERROR_CODE = 'Unconverged'
to_dict()[source]
classmethod from_dict(d)[source]
exception abiflows.fireworks.tasks.abinit_tasks.UnconvergedParametersError(task=None, msg=None, num_errors=None, num_warnings=None, errors=None, warnings=None, abiinput=None, restart_info=None, history=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.UnconvergedError

Exception raised when the iteration to converge some parameter didn’t converge within the selected number of restarts.

ERROR_CODE = 'Unconverged_parameters'
exception abiflows.fireworks.tasks.abinit_tasks.WalltimeError(msg)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFWError

Exception raised when the calculation didn’t complete within the specified walltime.

ERROR_CODE = 'Walltime'
exception abiflows.fireworks.tasks.abinit_tasks.InitializationError(msg)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFWError

Exception raised if errors are present during the initialization of the task, before abinit is started.

ERROR_CODE = 'Initialization'
exception abiflows.fireworks.tasks.abinit_tasks.RestartError(msg)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.InitializationError

Exception raised if errors show up during the set up of the restart.

ERROR_CODE = 'Restart'
exception abiflows.fireworks.tasks.abinit_tasks.PostProcessError(msg)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks.AbiFWError

Exception raised if problems are encountered during the post processing of the abinit calculation.

ERROR_CODE = 'Postprocess'
class abiflows.fireworks.tasks.abinit_tasks.RestartInfo(previous_dir, reset=False, num_restarts=0)[source]

Bases: monty.json.MSONable

Object that contains the information about the restart of a task.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property prev_outdir

A Directory object pointing to the outdir of the previous step.

property prev_indir

A Directory object pointing to the indir of the previous step.

class abiflows.fireworks.tasks.abinit_tasks.ElasticComplianceTensor(elastic_tensor, compliance_tensor, structure, additional_info=None)[source]

Bases: abipy.core.mixins.Has_Structure

This object is used to store the elastic and compliance tensors.

property structure

abipy.core.structure.Structure object.

classmethod from_ec_nc_file(ec_nc_file, tensor_type='relaxed_ion')[source]
as_dict()[source]
extended_dict()[source]
classmethod from_dict(dd)[source]
get_pmg_elastic_tensor()[source]

Converts to a pymatgen ElasticTensor object.

abiflows.fireworks.tasks.abinit_tasks_src module

class abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin[source]

Bases: object

prefix = Prefix(idata='indata/in', odata='outdata/out', tdata='tmpdata/tmp')
get_fw_task_manager(fw_spec)[source]
setup_rundir(rundir, create_dirs=False, directories_only=False)[source]

Set the run directory.

class abiflows.fireworks.tasks.abinit_tasks_src.AbinitSetupTask(abiinput, deps=None, task_helper=None, task_type=None, restart_info=None, pass_input=False)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.SetupTask

RUN_PARAMETERS = ['_queueadapter', 'qtk_queueadapter']
setup_directories(fw_spec, create_dirs=False)[source]
run_task(fw_spec)[source]

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.

Parameters

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_run_parameters(fw_spec, parameters=['_queueadapter', 'qtk_queueadapter'])[source]
file_transfers(fw_spec)[source]
fetch_previous_info(fw_spec)[source]
prepare_run(fw_spec)[source]
run_autoparal(abiinput, fw_spec, clean_up='partial')[source]

Runs the autoparal using AbinitInput abiget_autoparal_pconfs method. The information are retrieved from the FWTaskManager that should be present and contain the standard abipy TaskManager, that provides information about the queue adapters.

resolve_deps_per_task_type(previous_tasks, deps_list)[source]
resolve_deps(fw_spec)[source]

Method to link the required deps for the current FW. Note that different cases are handled here depending whether the current FW is a restart or not and whether the rerun is performed in the same folder or not. In case of restart the safest choice is to link the deps of the previous FW, so that if they have been updated in the meanwhile we are taking the correct one. TODO: this last case sounds quite unlikely and should be tested

property filesfile_string

String with the list of files and prefixes needed to execute ABINIT.

out_to_in(out_file)[source]

links or copies, according to the fw_policy, the output file to the input data directory of this task and rename the file so that ABINIT will read it as an input data file.

Returns

The absolute path of the new file in the indata directory.

in_to_in(in_file)[source]

copies the input file to the input of a previous task to the data directory of this task

Returns

The absolute path of the new file in the indata directory.

remove_restart_vars(exts)[source]
additional_task_info()[source]
class abiflows.fireworks.tasks.abinit_tasks_src.AbinitRunTask(control_procedure, task_helper, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.RunTask

config(fw_spec)[source]
run(fw_spec)[source]
postrun(fw_spec)[source]
class abiflows.fireworks.tasks.abinit_tasks_src.AbinitControlTask(control_procedure, manager=None, max_restarts=10, src_cleaning=None, task_helper=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.ControlTask

get_initial_objects_info(setup_fw, run_fw, src_directories)[source]
class abiflows.fireworks.tasks.abinit_tasks_src.AbinitTaskHelper[source]

Bases: monty.json.MSONable

task_type = 'abinit'
CRITICAL_EVENTS = []
set_task(task)[source]
restart(restart_info)[source]

Restart method. Each subclass should implement its own restart.

prepare_restart()[source]
conclude_task()[source]
additional_update_spec()[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

class abiflows.fireworks.tasks.abinit_tasks_src.GsTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitTaskHelper

property gsr_path

Absolute path of the GSR file. Empty string if file is not present.

open_gsr()[source]

Open the GSR file located in the in the task outdir. Returns GsrFile object, raise a HelperError exception if file could not be found or file is not readable.

class abiflows.fireworks.tasks.abinit_tasks_src.ScfTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.GsTaskHelper

task_type = 'scf'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.ScfConvergenceWarning'>]
restart(restart_info)[source]

SCF calculations can be restarted if we have either the WFK file or the DEN file.

class abiflows.fireworks.tasks.abinit_tasks_src.NscfTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.GsTaskHelper

task_type = 'nscf'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.NscfConvergenceWarning'>]
restart(restart_info)[source]

NSCF calculations can be restarted only if we have the WFK file.

class abiflows.fireworks.tasks.abinit_tasks_src.RelaxTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.GsTaskHelper

task_type = 'relax'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.RelaxConvergenceWarning'>]
get_final_structure()[source]

Read the final structure from the GSR file.

get_computed_entry()[source]

Get the computed entry from the GSR file.

restart(restart_info)[source]

Restart the structural relaxation.

See original RelaxTask for more details

class abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitTaskHelper

task_type = 'dfpt'
CRITICAL_EVENTS = [<class 'abipy.flowtk.events.ScfConvergenceWarning'>]
restart(restart_info)[source]

Phonon calculations can be restarted only if we have the 1WF file or the 1DEN file. from which we can read the first-order wavefunctions or the first order density. Prefer 1WF over 1DEN since we can reuse the wavefunctions. Try to handle an input with many perturbation calculated at the same time. link/copy all the 1WF or 1DEN files

class abiflows.fireworks.tasks.abinit_tasks_src.DdkTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper

task_type = 'ddk'
conclude_task()[source]
class abiflows.fireworks.tasks.abinit_tasks_src.DdeTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper

class abiflows.fireworks.tasks.abinit_tasks_src.PhononTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper

class abiflows.fireworks.tasks.abinit_tasks_src.BecTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper

class abiflows.fireworks.tasks.abinit_tasks_src.StrainPertTaskHelper[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.DfptTaskHelper

task_type = 'strain-pert'
class abiflows.fireworks.tasks.abinit_tasks_src.Cut3DAbinitTaskOld(cut3d_option=None, deps=None, cut3d_input_file='cut3d.in', cut3d_log_file='cut3d.log', cut3d_err_file='cut3d.err', task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, fireworks.core.firework.FireTaskBase

CUT3D_OPTIONS = ['den_to_cube']
task_type = 'cut3d'
run_cut3d()[source]

executes cut3d and waits for the end of the process.

setup_task(fw_spec)[source]
resolve_deps(fw_spec)[source]
resolve_deps_per_task_type(previous_tasks, deps_list)[source]
run_task(fw_spec)[source]

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.

Parameters

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)

classmethod den_to_cube(deps, task_type=None)[source]
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
prefix = Prefix(idata='indata/in', odata='outdata/out', tdata='tmpdata/tmp')
class abiflows.fireworks.tasks.abinit_tasks_src.Cut3DAbinitTask(cut3d_input, structure=None, deps=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, fireworks.core.firework.FireTaskBase

task_type = 'cut3d'
run_cut3d()[source]

executes cut3d and waits for the end of the process.

set_workdir(workdir)[source]

Set the working directory.

setup_task(fw_spec)[source]
resolve_deps(fw_spec)[source]
resolve_deps_per_task_type(previous_tasks, deps_list)[source]
run_task(fw_spec)[source]

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.

Parameters

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)

classmethod den_to_cube(deps, task_type=None)[source]
classmethod hirshfeld(deps, structure, task_type=None, all_el_dens_paths=None, fhi_all_el_path=None)[source]
get_hirshfeld_charges()[source]
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
prefix = Prefix(idata='indata/in', odata='outdata/out', tdata='tmpdata/tmp')
class abiflows.fireworks.tasks.abinit_tasks_src.BaderTask(bader_log_file='bader.log', bader_err_file='bader.err', electrons=None)[source]

Bases: abiflows.fireworks.tasks.abinit_tasks_src.AbinitSRCMixin, fireworks.core.firework.FireTaskBase

task_type = 'bader'
set_workdir(workdir)[source]
setup_task(fw_spec)[source]
run_bader()[source]

executes bader and waits for the end of the process.

setup_rundir(rundir, create_dirs=True, directories_only=False)[source]

Set the run directory.

run_task(fw_spec)[source]

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.

Parameters

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)

get_bader_data()[source]
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
class abiflows.fireworks.tasks.abinit_tasks_src.GeneratePiezoElasticFlowFWSRCAbinitTask(piezo_elastic_factory=None, helper=None, previous_scf_task_type='scf', previous_ddk_task_type='ddk', control_procedure=None, additional_controllers=None, mrgddb_task_type='mrgddb-strains', rf_tol=None, additional_input_vars=None, rf_deps=None, allow_parallel_perturbations=True, do_phonons=True)[source]

Bases: fireworks.core.firework.FireTaskBase

run_task(fw_spec)[source]

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.

Parameters

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)

to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
get_fw_task_manager(fw_spec)[source]
exception abiflows.fireworks.tasks.abinit_tasks_src.HelperError[source]

Bases: Exception

exception abiflows.fireworks.tasks.abinit_tasks_src.InitializationError[source]

Bases: Exception

exception abiflows.fireworks.tasks.abinit_tasks_src.RestartError[source]

Bases: Exception

exception abiflows.fireworks.tasks.abinit_tasks_src.WalltimeError[source]

Bases: Exception

exception abiflows.fireworks.tasks.abinit_tasks_src.PostProcessError[source]

Bases: Exception

class abiflows.fireworks.tasks.abinit_tasks_src.RestartInfo(previous_dir, reset=False)[source]

Bases: monty.json.MSONable

Object that contains the information about the restart of a task.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property prev_outdir
property prev_indir

abiflows.fireworks.tasks.analysis_tasks module

class abiflows.fireworks.tasks.analysis_tasks.ChemEnvStructureEnvironmentsTask(*args, **kwargs)[source]

Bases: fireworks.core.firework.FireTaskBase

run_task(fw_spec)[source]

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.

Parameters

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 abiflows.fireworks.tasks.analysis_tasks.ChemEnvLightStructureEnvironmentsTask(*args, **kwargs)[source]

Bases: fireworks.core.firework.FireTaskBase

run_task(fw_spec)[source]

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.

Parameters

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)

abiflows.fireworks.tasks.flow_wrapper_tasks module

class abiflows.fireworks.tasks.flow_wrapper_tasks.FireTaskWithFlow(*args, **kwargs)[source]

Bases: fireworks.core.firework.FireTaskBase

required_params = ['flow']
run_task(fw_spec)[source]

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.

Parameters

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)

abiflows.fireworks.tasks.handlers module

Error handlers and validators

class abiflows.fireworks.tasks.handlers.AbinitHandler(job_rundir='.', critical_events=None, queue_adapter=None)[source]

Bases: abiflows.fireworks.utils.custodian_utils.SRCErrorHandler

General handler for abinit’s critical events handlers.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property allow_fizzled
property allow_completed
property handler_priority
property skip_remaining_handlers
setup()[source]
check()[source]

This method is called during the job (for monitors) or at the end of the job to check for errors.

Returns

(bool) Indicating if errors are detected.

has_corrections()[source]
correct()[source]

This method is called at the end of a job when an error is detected. It should perform any corrective measures relating to the detected error.

Returns

(dict) JSON serializable dict that describes the errors and actions taken. E.g. {“errors”: list_of_errors, “actions”: list_of_actions_taken}. If this is an unfixable error, actions should be set to None.

class abiflows.fireworks.tasks.handlers.WalltimeHandler(job_rundir='.', qout_file='queue.qout', qerr_file='queue.qerr', queue_adapter=None, max_timelimit=None, timelimit_increase=None)[source]

Bases: abiflows.fireworks.utils.custodian_utils.SRCErrorHandler

Handler for walltime infringements of the resource manager.

setup_filepaths()[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property allow_fizzled
property allow_completed
property handler_priority
property skip_remaining_handlers
setup()[source]
check()[source]

This method is called during the job (for monitors) or at the end of the job to check for errors.

Returns

(bool) Indicating if errors are detected.

correct()[source]

This method is called at the end of a job when an error is detected. It should perform any corrective measures relating to the detected error.

Returns

(dict) JSON serializable dict that describes the errors and actions taken. E.g. {“errors”: list_of_errors, “actions”: list_of_actions_taken}. If this is an unfixable error, actions should be set to None.

has_corrections()[source]
class abiflows.fireworks.tasks.handlers.MemoryHandler(job_rundir='.', qout_file='queue.qout', qerr_file='queue.qerr', queue_adapter=None, max_mem_per_proc_mb=8000, mem_per_proc_increase_mb=1000, max_master_mem_overhead_mb=8000, master_mem_overhead_increase_mb=1000)[source]

Bases: abiflows.fireworks.utils.custodian_utils.SRCErrorHandler

Handler for memory infringements of the resource manager. The handler should be able to handle the possible overhead of the master process.

setup_filepaths()[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property allow_fizzled
property allow_completed
property handler_priority
property skip_remaining_handlers
setup()[source]
check()[source]

This method is called during the job (for monitors) or at the end of the job to check for errors.

Returns

(bool) Indicating if errors are detected.

correct()[source]

This method is called at the end of a job when an error is detected. It should perform any corrective measures relating to the detected error.

Returns

(dict) JSON serializable dict that describes the errors and actions taken. E.g. {“errors”: list_of_errors, “actions”: list_of_actions_taken}. If this is an unfixable error, actions should be set to None.

has_corrections()[source]
class abiflows.fireworks.tasks.handlers.UltimateMemoryHandler(job_rundir='.', qout_file='queue.qout', qerr_file='queue.qerr', queue_adapter=None, max_mem_per_proc_mb=8000, mem_per_proc_increase_mb=1000, max_master_mem_overhead_mb=8000, master_mem_overhead_increase_mb=1000)[source]

Bases: abiflows.fireworks.tasks.handlers.MemoryHandler

Handler for infringements of the resource manager. If no memory error is found,

property handler_priority
check()[source]

This method is called during the job (for monitors) or at the end of the job to check for errors.

Returns

(bool) Indicating if errors are detected.

correct()[source]

This method is called at the end of a job when an error is detected. It should perform any corrective measures relating to the detected error.

Returns

(dict) JSON serializable dict that describes the errors and actions taken. E.g. {“errors”: list_of_errors, “actions”: list_of_actions_taken}. If this is an unfixable error, actions should be set to None.

abiflows.fireworks.tasks.src_tasks_abc module

class abiflows.fireworks.tasks.src_tasks_abc.SRCTaskMixin[source]

Bases: object

src_type = ''
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
setup_directories(fw_spec, create_dirs=False)[source]
property src_directories
class abiflows.fireworks.tasks.src_tasks_abc.SetupTask(deps=None, restart_info=None, task_type=None)[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCTaskMixin, fireworks.core.firework.FireTaskBase

src_type = 'setup'
RUN_PARAMETERS = ['_queueadapter', 'mpi_ncpus', 'qtk_queueadapter']
task_type = 'unknown'
set_restart_info(restart_info=None)[source]
run_task(fw_spec)[source]

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.

Parameters

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_run_parameters(fw_spec)[source]
file_transfers(fw_spec)[source]
fetch_previous_info(fw_spec)[source]
prepare_run(fw_spec)[source]
additional_task_info()[source]
class abiflows.fireworks.tasks.src_tasks_abc.RunTask(control_procedure, task_type=None)[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCTaskMixin, fireworks.core.firework.FireTaskBase

src_type = 'run'
task_type = 'unknown'
set_control_procedure(control_procedure)[source]
run_task(fw_spec)[source]

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.

Parameters

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)

config(fw_spec)[source]
abstract run(fw_spec)[source]
postrun(fw_spec)[source]
additional_task_info()[source]
class abiflows.fireworks.tasks.src_tasks_abc.ScriptRunTask(script_str, control_procedure)[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.RunTask

task_type = 'script'
run(fw_spec)[source]
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
class abiflows.fireworks.tasks.src_tasks_abc.ControlTask(control_procedure, manager=None, max_restarts=10, src_cleaning=None)[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCTaskMixin, fireworks.core.firework.FireTaskBase

src_type = 'control'
run_task(fw_spec)[source]

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.

Parameters

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)

get_setup_and_run_fw(fw_spec)[source]
get_initial_objects_info(setup_fw, run_fw, src_directories)[source]
classmethod from_controllers(controllers, max_restarts=10)[source]
to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
class abiflows.fireworks.tasks.src_tasks_abc.SRCCleanerOptions(when_to_clean, current_src_states_allowed, which_src_steps_to_clean)[source]

Bases: monty.json.MSONable

WHEN_TO_CLEAN = ['EACH_STEP', 'LAST_STEP', 'EACH_STEP_EXCEPT_LAST']
CURRENT_SRC_STATES_ALLOWED = ['RECOVERABLE', 'UNRECOVERABLE', 'MAXRESTARTS', 'FINALIZED']
classmethod clean_all()[source]
classmethod clean_all_except_last()[source]
property when_to_clean
property current_src_states_allowed
property which_src_steps_to_clean
steps_to_clean(this_step_index, this_step_state)[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

class abiflows.fireworks.tasks.src_tasks_abc.SRCCleaner(cleaners=None, src_type='run', cleaner_options=<abiflows.fireworks.tasks.src_tasks_abc.SRCCleanerOptions object>)[source]

Bases: monty.json.MSONable

SRC_TYPES = ['setup', 'run', 'control', 'src_root']
property cleaners
property src_type
src_dir_to_clean(src_directories)[source]
check_recurrence(src_task_index, state)[source]
clean(last_src_directories, previous_src_dirs, src_task_index, state)[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

class abiflows.fireworks.tasks.src_tasks_abc.SRCCleaning(src_cleaners=None)[source]

Bases: monty.json.MSONable

clean(src_directories, previous_src_dirs, state)[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

abiflows.fireworks.tasks.src_tasks_abc.createSRCFireworks(setup_task, run_task, control_task, spec=None, initialization_info=None, task_index=None, setup_spec_update=None, run_spec_update=None)[source]
class abiflows.fireworks.tasks.src_tasks_abc.SRCTaskIndex(task_type, index=1)[source]

Bases: monty.json.MSONable

ALLOWED_CHARS = ['-']
set_task_type(task_type)[source]
property index
increase_index()[source]
property setup_str
property run_str
property control_str
classmethod from_string(SRC_task_index_string)[source]
classmethod from_any(SRC_task_index)[source]
classmethod from_task(task)[source]
classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

as_dict()[source]

A JSON serializable dict representation of an object.

abiflows.fireworks.tasks.src_tasks_abc.get_queue_adapter_update(qtk_queueadapter, corrections, qa_params=None)[source]
exception abiflows.fireworks.tasks.src_tasks_abc.SRCError[source]

Bases: Exception

exception abiflows.fireworks.tasks.src_tasks_abc.SetupError[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCError

exception abiflows.fireworks.tasks.src_tasks_abc.RunError[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCError

exception abiflows.fireworks.tasks.src_tasks_abc.ControlError[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.SRCError

class abiflows.fireworks.tasks.src_tasks_abc.FWTime(fw_name, fw_id, ncpus, fwtime_secs, clustertime_secs=None)[source]

Bases: monty.json.MSONable

property time_per_cpu
property total_time
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

classmethod from_fw_id(fw_id, lpad=None)[source]
class abiflows.fireworks.tasks.src_tasks_abc.SRCFWTime(fw_name, fw_id, ncpus, fwtime_secs, clustertime_secs=None, src_type=None, task_type=None, task_index=None)[source]

Bases: abiflows.fireworks.tasks.src_tasks_abc.FWTime

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

classmethod from_fw_id(fw_id, lpad=None)[source]

abiflows.fireworks.tasks.utility_tasks module

Utility tasks for Fireworks.

abiflows.fireworks.tasks.utility_tasks.createSRCFireworksOld(task_class, task_input, SRC_spec, initialization_info, wf_task_index_prefix, current_task_index=1, handlers=None, validators=None, deps=None, task_type=None, queue_adapter_update=None)[source]
class abiflows.fireworks.tasks.utility_tasks.FinalCleanUpTask(out_exts=None)[source]

Bases: fireworks.core.firework.FireTaskBase

Eliminates all the files in outdata based on the extension of the files and deletes of the files in indata and tmpdata.

task_type = 'finalclnup'
to_dict(*args, **kwargs)
classmethod from_dict(m_dict)[source]
static delete_files(d, exts=None)[source]
run_task(fw_spec)[source]

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.

Parameters

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 abiflows.fireworks.tasks.utility_tasks.DatabaseInsertTask(insertion_data=None, criteria=None)[source]

Bases: fireworks.core.firework.FireTaskBase

task_type = 'dbinsert'
to_dict(*args, **kwargs)
classmethod from_dict(m_dict)[source]
static insert_objects()[source]
run_task(fw_spec)[source]

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.

Parameters

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 abiflows.fireworks.tasks.utility_tasks.MongoEngineDBInsertionTask(db_data, object_id=None)[source]

Bases: fireworks.core.firework.FireTaskBase

Task that insert the results of a workflow in a database. The method calls the “get_mongoengine_results” of the workflow generator. The database is defined according to a DatabaseData.

to_dict(*args, **kwargs)
classmethod from_dict(m_dict)[source]
run_task(fw_spec)[source]

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.

Parameters

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 abiflows.fireworks.tasks.utility_tasks.CheckMemoryTask(memory_increase_megabytes=1000, max_memory_megabytes=7600)[source]

Bases: fireworks.core.firework.FireTaskBase

task_type = 'checkmem'
to_dict(*args, **kwargs)
classmethod from_dict(m_dict)[source]
class abiflows.fireworks.tasks.utility_tasks.CheckTask(handlers=None, validators=None, max_restarts=10)[source]

Bases: fireworks.core.firework.FireTaskBase

task_type = 'check'
optional_params = ['handlers', 'validators']
to_dict(*args, **kwargs)
classmethod from_dict(m_dict)[source]
run_task(fw_spec)[source]

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.

Parameters

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)

apply_corrections(fw_to_correct, corrections)[source]
abiflows.fireworks.tasks.utility_tasks.print_myself()[source]
abiflows.fireworks.tasks.utility_tasks.get_fw_task_manager(fw_spec)[source]
abiflows.fireworks.tasks.utility_tasks.apply_corrections_to_spec(corrections, spec)[source]
abiflows.fireworks.tasks.utility_tasks.get_queue_adapter_update(qtk_queueadapter, corrections, qa_params=None)[source]

abiflows.fireworks.tasks.vasp_sets module

class abiflows.fireworks.tasks.vasp_sets.MPNEBSet(structures, unset_encut=False, **kwargs)[source]

Bases: pymatgen.io.vasp.sets.MPRelaxSet

property poscar

Poscar

Type

return

property poscars
write_input(output_dir, make_dir_if_not_present=True, write_cif=False, write_path_cif=False, write_endpoint_inputs=False)[source]

NEB inputs has a special directory structure where inputs are in 00, 01, 02, ….

Parameters
  • output_dir (str) – Directory to output the VASP input files

  • make_dir_if_not_present (bool) – Set to True if you want the directory (and the whole path) to be created if it is not present.

  • write_cif (bool) – If true, writes a cif along with each POSCAR.

  • write_path_cif (bool) – If true, writes a cif for each image.

  • write_endpoint_inputs (bool) – If true, writes input files for running endpoint calculations.

class abiflows.fireworks.tasks.vasp_sets.MPcNEBSet(structures, unset_encut=False, **kwargs)[source]

Bases: abiflows.fireworks.tasks.vasp_sets.MPNEBSet

abiflows.fireworks.tasks.vasp_tasks_src module

class abiflows.fireworks.tasks.vasp_tasks_src.VaspSRCMixin[source]

Bases: object

get_fw_task_manager(fw_spec)[source]
setup_rundir(rundir)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.VaspSetupTask(vasp_input_set, deps=None, task_helper=None, task_type=None, restart_info=None, pass_input=False)[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.VaspSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.SetupTask

RUN_PARAMETERS = ['_queueadapter', 'qtk_queueadapter']
setup_directories(fw_spec, create_dirs=False)[source]
run_task(fw_spec)[source]

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.

Parameters

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_run_parameters(fw_spec, parameters=['_queueadapter', 'qtk_queueadapter'])[source]
file_transfers(fw_spec)[source]
fetch_previous_info(fw_spec)[source]
prepare_run(fw_spec)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.VaspRunTask(control_procedure, task_helper, task_type=None, custodian_handlers=None)[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.VaspSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.RunTask

config(fw_spec)[source]
run(fw_spec)[source]
postrun(fw_spec)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.VaspControlTask(control_procedure, manager=None, max_restarts=10, src_cleaning=None, task_helper=None)[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.VaspSRCMixin, abiflows.fireworks.tasks.src_tasks_abc.ControlTask

get_initial_objects_info(setup_fw, run_fw, src_directories)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.GenerateVacanciesRelaxationTask[source]

Bases: fireworks.core.firework.FireTaskBase

run_task(fw_spec)[source]

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.

Parameters

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)

to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.GenerateNEBRelaxationTask(n_insert=1, user_incar_settings=None, climbing_image=True, task_index=None, terminal_start_task_type=None, terminal_end_task_type=None, prev_neb_task_type=None)[source]

Bases: fireworks.core.firework.FireTaskBase

run_task(fw_spec)[source]

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.

Parameters

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)

to_dict(*args, **kwargs)
classmethod from_dict(d)[source]
abiflows.fireworks.tasks.vasp_tasks_src.createVaspSRCFireworks(vasp_input_set, task_helper, task_type, control_procedure, custodian_handlers, max_restarts, src_cleaning, task_index, spec, setup_spec_update=None, run_spec_update=None)[source]
class abiflows.fireworks.tasks.vasp_tasks_src.VaspTaskHelper[source]

Bases: monty.json.MSONable

task_type = 'vasp'
CRITICAL_EVENTS = []
qtk_parallelization(vasp_input_set)[source]
set_task(task)[source]
restart(restart_info)[source]

Restart method. Each subclass should implement its own restart.

prepare_restart()[source]
conclude_task()[source]
additional_update_spec()[source]
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

class abiflows.fireworks.tasks.vasp_tasks_src.MPRelaxTaskHelper[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.VaspTaskHelper

task_type = 'MPRelaxVasp'
restart(restart_info)[source]

Restart method. Each subclass should implement its own restart.

get_final_structure()[source]
class abiflows.fireworks.tasks.vasp_tasks_src.MPNEBTaskHelper[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.VaspTaskHelper

task_type = 'MPNEBVasp'
qtk_parallelization(vasp_input_set)[source]
restart(restart_info)[source]

Restart method. Each subclass should implement its own restart.

class abiflows.fireworks.tasks.vasp_tasks_src.MPcNEBTaskHelper[source]

Bases: abiflows.fireworks.tasks.vasp_tasks_src.MPNEBTaskHelper

task_type = 'MPcNEBVasp'
exception abiflows.fireworks.tasks.vasp_tasks_src.HelperError[source]

Bases: Exception

exception abiflows.fireworks.tasks.vasp_tasks_src.InitializationError[source]

Bases: Exception

exception abiflows.fireworks.tasks.vasp_tasks_src.RestartError[source]

Bases: Exception

exception abiflows.fireworks.tasks.vasp_tasks_src.WalltimeError[source]

Bases: Exception

exception abiflows.fireworks.tasks.vasp_tasks_src.PostProcessError[source]

Bases: Exception

class abiflows.fireworks.tasks.vasp_tasks_src.RestartInfo(previous_dir, reset=False)[source]

Bases: monty.json.MSONable

Object that contains the information about the restart of a task.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

property prev_outdir
property prev_indir

Module contents