Workflows

This section describes the aiida-kkr workflows.

Generate KKR start potential

In this module you find the base workflow for a dos calculation and some helper methods to do so with AiiDA

class aiida_kkr.workflows.voro_start.kkr_startpot_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain create starting potential for a KKR calculation by running voronoi and getting the starting DOS for first checks on the validity of the input setting. Starts from a structure together with a KKR parameter node.

Parameters:
  • wf_parameters – (Dict), Workchain specifications
  • options – (Dict), specifications for the computer
  • structure – (StructureData), aiida structure node to begin calculation from (needs to contain vacancies, if KKR needs empty spheres)
  • kkr – (Code)
  • voronoi – (Code)
  • calc_parameters – (Dict), KKR parameter set, passed on to voronoi run.
Return result_kkr_startpot_wc:
 

(Dict), Information of workflow results like Success, last result node, dos array data

check_dos()[source]

checks if dos of starting potential is ok

check_voronoi()[source]

check voronoi output. return True/False if voronoi output is ok/problematic if output is problematic try to increase some parameters (e.g. cluster radius) and rerun up tp N_rerun_max times initializes with returning True

classmethod define(spec)[source]

Defines the outline of the workflow.

do_iteration_check()[source]

check if another iteration should be done

error_handler()[source]

Capture errors raised in validate_input

find_cluster_radius_alat()[source]

Find an estimate for the cluster radius that comes close to having nclsmin atoms in the cluster.

get_dos()[source]

call to dos sub workflow passing the appropriate input and submitting the calculation

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters. returns _wf_defaults

return_results()[source]

return the results of the dos calculations This should run through and produce output nodes even if everything failed, therefore it only uses results from context.

run_voronoi()[source]

run voronoi calculation with parameters from input

start()[source]

init context and some parameters

aiida_kkr.workflows.voro_start.update_voro_input(params_old, updatenode, voro_output)[source]

Pseudo wf used to keep track of updated parameters in voronoi calculation. voro_output only enters as dummy argument for correct connection but logic using this value is done somewhere else.

KKR scf cycle

In this module you find the base workflow for converging a kkr calculation and some helper methods to do so with AiiDA

aiida_kkr.workflows.kkr_scf.create_scf_result_node(**kwargs)[source]

This is a pseudo wf, to create the right graph structure of AiiDA. This workfunction will create the output node in the database. It also connects the output_node to all nodes the information commes from. So far it is just also parsed in as argument, because so far we are to lazy to put most of the code overworked from return_results in here.

aiida_kkr.workflows.kkr_scf.extract_noco_angles(**kwargs)[source]

Extract noco angles from retrieved nonco_angles_out.dat files and save as Dict node which can be used as initial values for the next KkrCalculation. New angles are compared to old angles and if they are closer thanfix_dir_threshold they are not allowed to change anymore

aiida_kkr.workflows.kkr_scf.get_site_symbols(structure)[source]

extract the site number taking into account a possible CPA structure

class aiida_kkr.workflows.kkr_scf.kkr_scf_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain for converging a KKR calculation (SCF).

It converges the charge potential. Two paths are possible:

(1) Start from a structure and run a voronoi calculation first, optional with calc_parameters (2) Start from an existing Voronoi or KKR calculation, with a remoteData

Parameters:
  • wf_parameters – (Dict), Workchain Specifications
  • options – (Dict); specifications for the computer
  • structure – (StructureData), Crystal structure
  • calc_parameters – (Dict), Voronoi/Kkr Parameters
  • remote_data – (RemoteData), from a KKR, or Voronoi calculation
  • voronoi – (Code)
  • kkr – (Code)
Return output_kkr_scf_wc_para:
 

(Dict), Information of workflow results like Success, last result node, list with convergence behavior

minimum input example: 1. Code1, Code2, Structure, (Parameters), (wf_parameters) 2. Code2, remote_data, (Parameters), (wf_parameters)

maximum input example: 1. Code1, Code2, Structure, Parameters

wf_parameters: {‘queue_name’ : String,
‘resources’ : dict({“num_machines”: int, “num_mpiprocs_per_machine” : int}) ‘walltime’ : int}
  1. Code2, (remote-data), wf_parameters as in 1.

Hints: 1. This workflow does not work with local codes!

_get_new_noco_angles()[source]

extract nonco angles from output of calculation, if fix_dir is True we skip this and leave the initial angles unchanged Here we update self.ctx.initial_noco_angles with the new values

check_dos()[source]

checks if dos of final potential is ok

check_input_params(params, is_voronoi=False)[source]

Checks input parameter consistency and aborts wf if check fails.

check_voronoi()[source]

check output of kkr_startpot_wc workflow that creates starting potential, shapefun etc.

condition()[source]

check convergence condition

convergence_on_track()[source]

Check if convergence behavior of the last calculation is on track (i.e. going down)

classmethod define(spec)[source]

Defines the outline of the workflow.

get_dos()[source]

call to dos sub workflow passing the appropriate input and submitting the calculation

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_default dictionary. Can be used to easily create set of wf_parameters. returns _wf_default, _options_default

inspect_kkr()[source]

check for convergence and store some of the results of the last calculation to context

return_results()[source]

return the results of the calculations This shoudl run through and produce output nodes even if everything failed, therefore it only uses results from context.

run_kkr()[source]

submit a KKR calculation

run_voronoi()[source]

run the voronoi step calling voro_start workflow

start()[source]

init context and some parameters

update_kkr_params()[source]

update set of KKR parameters (check for reduced mixing, change of mixing strategy, change of accuracy setting)

validate_input()[source]

# validate input and find out which path (1, or 2) to take # return True means run voronoi if false run kkr directly

Density of states

In this module you find the base workflow for a dos calculation and some helper methods to do so with AiiDA

class aiida_kkr.workflows.dos.kkr_dos_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain a DOS calculation with KKR starting from the remoteData node of a previous calculation (either Voronoi or KKR).

Parameters:
  • wf_parameters – (Dict); Workchain specifications
  • options – (Dict); specifications for the computer
  • remote_data – (RemoteData), mandatory; from a KKR or Vornoi calculation
  • kkr – (Code), mandatory; KKR code running the dos calculation
Return result_kkr_dos_wc:
 

(Dict), Information of workflow results like Success, last result node, list with convergence behavior

classmethod define(spec)[source]

Defines the outline of the workflow.

get_dos()[source]

submit a dos calculation and interpolate result if returns complete

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters. returns _wf_defaults

return_results()[source]

Collect results, parse DOS output and link output nodes to workflow node

set_params_dos()[source]

take input parameter node and change to DOS contour according to input from wf_parameter input internally calls the update_params work function to keep track of provenance

start()[source]

init context and some parameters

validate_input()[source]

# validate input and find out which path (1, or 2) to take # return True means run voronoi if false run kkr directly

aiida_kkr.workflows.dos.parse_dosfiles(dos_retrieved)[source]

parse dos files to XyData nodes

Bandstructure

This module contains the band structure workflow for KKR which is done by calculating the k-resolved spectral density also known as Bloch spectral function.

class aiida_kkr.workflows.bs.kkr_bs_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain for BandStructure calculation, starting from RemoteFolderData of the previous converged KKR calculation remote folder data

inputs: :param wf_parameters: (Dict), (optional); Workchain Specifications, contains nepts, tempr, emin (in eV relative to EF), emax (in eV),

and RCLUSTZ (can be used to increase the screening cluster radius) keys.
Parameters:
  • options – (Dict), (optional); Computer Specifications, scheduler command, parallel or serial
  • kpoints – (KpointsData),(optional); Kpoints data type from the structure, but not mendatory as it can be extracted from structure internaly from the remote data
  • remote_data – (RemoteData)(mendaory); From the previous kkr-converged calculation.
  • kkr – (Code)(mendaory); KKR code specifiaction
  • label – (Str) (optional) ; label for WC but will be found in the “result_wf” output Dict as ‘BS_wf_label’ key
  • description – (Str) (optional) : description for WC but will be found in the “result_wf” output Dict as ‘BS_wf_description’ key

returns: :out BS_Data : (ArrayData) ; Consist of BlochSpectralFunction, k_points (list), energy_points (list), special_kpoints(dict) :out result_wf: (Dict); work_chain_specifications node, BS_data node, remote_folder node

classmethod define(spec)[source]

Layout of the workflow, defines the input nodes and the outline of the workchain

get_BS()[source]

submit the KkrCalcultion with the qdos settings for a bandstructure calculation

classmethod get_wf_defaults(silent=False)[source]

Return the default values of the workflow parameters (wf_parameters input node)

return_results()[source]

Collect results, parse BS_calc output and link output nodes to workflow node

set_params_BS()[source]

set kkr parameters for the bandstructure (i.e. qdos) calculation

start()[source]

set up context of the workflow

validate_input()[source]

validate input and find out which path ( converged kkr calc or wf ) to take return True means run voronoi if false run kkr directly

aiida_kkr.workflows.bs.parse_BS_data(retrieved_folder, fermi_level, kpoints)[source]

parse the qdos files from the retreived folderand save as ArrayData

aiida_kkr.workflows.bs.set_energy_params(econt_new, ef, para_check)[source]

set energy contour values to para_check internally convert from relative eV units to absolute Ry units

Equation of states

In this module you find the base workflow for a EOS calculation and some helper methods to do so with AiiDA

aiida_kkr.workflows.eos.get_primitive_structure(structure, return_all)[source]

calls get_explicit_kpoints_path which gives primitive structure auxiliary workfunction to keep provenance

class aiida_kkr.workflows.eos.kkr_eos_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain of an equation of states calculation with KKR.

Layout of the workflow:
  1. determine V0, scale_range, etc. from input
  2. run voro_start for V0 and smallest volume
    2.1 get minimum for RMTCORE (needs to be fixed for all calculations to be able to compare total energies
  3. submit kkr_scf calculations for all volumes using RMTCORE setting determined in step 2
  4. collect results
check_voro_out()[source]

check outout of vorostart workflow and create input for rest of calculations (rmtcore setting etc.)

collect_data_and_fit()[source]

collect output of KKR calculations and perform eos fitting to collect results

classmethod define(spec)[source]

Defines the outline of the workflow.

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters. returns _wf_defaults, _options_default

prepare_strucs()[source]

create new set of scaled structures using the ‘rescale’ workfunction (see end of the workflow)

return_results()[source]

create output dictionary and run output node generation

run_kkr_steps()[source]

submit KKR calculations for all structures, skip vorostart step for smallest structure

run_vorostart()[source]

run vorostart workflow for smallest structure to determine rmtcore setting for all others

start()[source]

initialize context and check input nodes

aiida_kkr.workflows.eos.rescale(inp_structure, scale)[source]

Rescales a crystal structure. Keeps the provanance in the database.

:param inp_structure, a StructureData node (pk, or uuid) :param scale, float scaling factor for the cell

Returns:New StrcutureData node with rescalled structure, which is linked to input Structure and None if inp_structure was not a StructureData

copied and modified from aiida_fleur.tools.StructureData_util

aiida_kkr.workflows.eos.rescale_no_wf(structure, scale)[source]

Rescales a crystal structure. DOES NOT keep the provanence in the database.

:param structure, a StructureData node (pk, or uuid) :param scale, float scaling factor for the cell

Returns:New StrcutureData node with rescalled structure, which is linked to input Structure and None if inp_structure was not a StructureData

copied and modified from aiida_fleur.tools.StructureData_util

Find Green Function writeout for KKRimp

In this module you find the base workflow for writing out the kkr_flexfiles and some helper methods to do so with AiiDA

class aiida_kkr.workflows.gf_writeout.kkr_flex_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain of a kkr_flex calculation to calculate the Green function with KKR starting from the RemoteData node of a previous calculation (either Voronoi or KKR).

Parameters:
  • options – (Dict), Workchain specifications
  • wf_parameters – (Dict), Workflow parameters that deviate from previous KKR RemoteData
  • remote_data – (RemoteData), mandatory; from a converged KKR calculation
  • kkr – (Code), mandatory; KKR code running the flexfile writeout
  • impurity_info – Dict, mandatory: node specifying information of the impurities in the system
Return workflow_info:
 

(Dict), Information of workflow results like success, last result node, list with convergence behavior

Return GF_host_remote:
 

(RemoteData), host GF of the system

classmethod define(spec)[source]

Defines the outline of the workflow

get_flex()[source]

Submit a KKRFLEX calculation

classmethod get_wf_defaults()[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters. returns _wf_defaults

move_kkrflex_files()[source]

Move the kkrflex files from the remote folder to KkrimpCalculation._DIRNAME_GF_UPLOAD on the remote computer’s working dir. This skips retrieval to the file repository and reduces cluttering the database.

return_results()[source]

Return the results of the KKRFLEX calculation. This should run through and produce output nodes even if everything failed, therefore it only uses results from context.

set_params_flex()[source]

Take input parameter node and change to input from wf_parameter and options

start()[source]

init context and some parameters

validate_input()[source]

Validate input

KKRimp self-consistency

In this module you find the sub workflow for the kkrimp self consistency cycle and some helper methods to do so with AiiDA

aiida_kkr.workflows.kkr_imp_sub.clean_raw_input(successful, pks_calcs, dry_run=False)[source]

Clean raw_input directories that contain copies of shapefun and potential files This however breaks provenance (strictly speaking) and therefore should only be done for the calculations of a successfully finished workflow (see email on mailing list from 25.11.2019).

aiida_kkr.workflows.kkr_imp_sub.clean_sfd(sfd_to_clean, nkeep=30)[source]

Clean up potential file (keep only header) to save space in the repository WARNING: this breaks cachability!

aiida_kkr.workflows.kkr_imp_sub.extract_imp_pot_sfd(retrieved_folder)[source]

Extract potential file from retrieved folder and save as SingleFileData

class aiida_kkr.workflows.kkr_imp_sub.kkr_imp_sub_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain of a kkrimp self consistency calculation starting from the host-impurity potential of the system. (Not the entire kkr_imp workflow!)

Parameters:
  • options – (Dict), Workchain specifications
  • wf_parameters – (Dict), specifications for the calculation
  • host_imp_startpot – (RemoteData), mandatory; input host-impurity potential
  • kkrimp – (Code), mandatory; KKRimp code converging the host-imp-potential
  • remote_data – (RemoteData), mandatory; remote folder of a previous kkrflex calculation containing the flexfiles …
  • kkrimp_remote – (RemoteData), remote folder of a previous kkrimp calculation
  • impurity_info – (Dict), Parameter node with information about the impurity cluster
Return workflow_info:
 

(Dict), Information of workflow results like success, last result node, list with convergence behavior

Return host_imp_pot:
 

(SinglefileData), output potential of the sytem

condition()[source]

check convergence condition

convergence_on_track()[source]

Check if convergence behavior of the last calculation is on track (i.e. going down)

classmethod define(spec)[source]

Defines the outline of the workflow

error_handler()[source]

Capture errors raised in validate_input

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters.

returns _wf_defaults

inspect_kkrimp()[source]

check for convergence and store some of the results of the last calculation to context

return_results()[source]

Return the results of the calculations This should run through and produce output nodes even if everything failed, therefore it only uses results from context.

run_kkrimp()[source]

submit a KKR impurity calculation

start()[source]

init context and some parameters

update_kkrimp_params()[source]

update set of KKR parameters (check for reduced mixing, change of mixing strategy, change of accuracy setting)

validate_input()[source]

validate input and catch possible errors from the input

aiida_kkr.workflows.kkr_imp_sub.remove_out_pot_impcalcs(successful, pks_all_calcs, dry_run=False)[source]

Remove out_potential file from all but the last KKRimp calculation if workflow was successful

Usage:

imp_wf = load_node(266885) # maybe start with outer workflow
pk_imp_scf = imp_wf.outputs.workflow_info['used_subworkflows'].get('kkr_imp_sub')
imp_scf_wf = load_node(pk_imp_scf) # this is now the imp scf sub workflow
successful = imp_scf_wf.outputs.workflow_info['successful']
pks_all_calcs = imp_scf_wf.outputs.workflow_info['pks_all_calcs']

KKRimp complete calculation

In this module you find the total workflow for a kkr impurity calculation and some helper methods to do so with AiiDA

class aiida_kkr.workflows.kkr_imp.kkr_imp_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain of a kkrimp calculation starting either from scratch (with a structure and impurity_info node), or with a converged host potential and impurity startpotentials, … to calculate the converged host-impurity potential of the system.

Parameters:
  • options – (Dict), Workchain specifications
  • wf_parameters – (Dict), specifications for the kkr impurity workflow
  • voro_aux_parameters – (Dict), specification for the auxiliary voronoi calculation for the impurity
  • kkrimp – (Code), mandatory: KKRimp code converging the host-imp-potential
  • kkr – (Code), mandatory: KKR code for calculation the host potential
  • voronoi – (Code), mandatory: Voronoi code to generate the impurity startpot
  • remote_data_gf – (RemoteData): remote folder of a previous kkrflex calculation containing the flexfiles …
  • remote_data_host – (RemoteData): remote folder of a converged KKR host calculation
Return workflow_info:
 

(Dict), Information of workflow results

Return last_calc_output_parameters:
 

(Dict), output parameters of the last called calculation

Return last_calc_info:
 

(Dict), information of the last called calculation

construct_startpot()[source]

Take the output of GF writeout and the converged host potential as well as the auxiliary startpotentials for the impurity to construct the startpotential for the KKR impurity sub workflow

classmethod define(spec)[source]

Defines the outline of the workflow

final_cleanup()[source]

Remove unneeded files to save space

get_ef_from_parent()[source]

Extract Fermi level in Ry to which starting potential is set

classmethod get_wf_defaults(silent=False)[source]

Print and return _wf_defaults dictionary. Can be used to easily create set of wf_parameters.

returns _wf_defaults

has_starting_potential_input()[source]

check whether or not a starting potential needs to be created

return_results()[source]

Return the results and create all of the output nodes

run_gf_writeout()[source]

Run the gf_writeout workflow to calculate the host Green’s function and the KKR flexfiles using the converged host remote folder and the impurity info node

run_kkrimp_scf()[source]

Uses both the previously generated host-impurity startpotential and the output from the GF writeout workflow as inputs to run the kkrimp_sub workflow in order to converge the host-impurity potential

run_voroaux()[source]

Perform a voronoi calculation for every impurity charge using the structure from the converged KKR host calculation

start()[source]

Init context and some parameters

validate_input()[source]

Validate the input and catch possible errors from the input