Fleur input generator plug-in

Fleurinputgen Calculation

Input plug-in for the FLEUR input generator ‘inpgen’. The input generator for the Fleur code is a preprocessor and should be run locally (with the direct scheduler) or inline, because it does not take many resources.

class aiida_fleur.calculation.fleurinputgen.FleurinputgenCalculation(*args, **kwargs)[source]

JobCalculationClass for the inpgen, which is a preprocessor for a FLEUR calculation. For more information about produced files and the FLEUR-code family, go to http://www.flapw.de/.

prepare_for_submission(folder)[source]

This is the routine to be called when you want to create the input files for the inpgen with the plug-in.

Parameters:folder – a aiida.common.folders.Folder subclass where the plugin should put all its files.
aiida_fleur.calculation.fleurinputgen.conv_to_fortran(val, quote_strings=True)[source]
Parameters:val – the value to be read and converted to a Fortran-friendly string.
aiida_fleur.calculation.fleurinputgen.get_input_data_text(key, val, value_only, mapping=None)[source]

Given a key and a value, return a string (possibly multiline for arrays) with the text to be added to the input file.

Parameters:
  • key – the flag name
  • val – the flag value. If it is an array, a line for each element is produced, with variable indexing starting from 1. Each value is formatted using the conv_to_fortran function.
  • mapping – Optional parameter, must be provided if val is a dictionary. It maps each key of the ‘val’ dictionary to the corresponding list index. For instance, if key='magn', val = {'Fe': 0.1, 'O': 0.2} and mapping = {'Fe': 2, 'O': 1}, this function will return the two lines magn(1) = 0.2 and magn(2) = 0.1. This parameter is ignored if ‘val’ is not a dictionary.

Fleurinputgen Parser

This module contains the parser for a inpgen calculation and methods for parsing different files produced by inpgen.

class aiida_fleur.parsers.fleur_inputgen.Fleur_inputgenParser(node)[source]

This class is the implementation of the Parser class for the FLEUR inpgen. It takes the files received from an inpgen calculation and creates AiiDA nodes for the Database. From the inp.xml file a FleurinpData object is created, also some information from the out file is stored in a ParameterData node.

parse(**kwargs)[source]

Takes inp.xml generated by inpgen calculation and created an FleurinpData node.

Returns:a dictionary of AiiDA nodes to be stored in the database.

Fleur-code plugin

Fleur Calculation

This file contains a CalcJob that represents FLEUR calculation.

class aiida_fleur.calculation.fleur.FleurCalculation(*args, **kwargs)[source]

A CalcJob class that represents FLEUR DFT calculation. For more information about the FLEUR-code family go to http://www.flapw.de/

prepare_for_submission(folder)[source]

This is the routine to be called when you make a FLEUR calculation. This routine checks the inputs and modifies copy lists accordingly. The standard files to be copied are given here.

Parameters:folder – a aiida.common.folders.Folder subclass where the plugin should put all its files.

Fleur Parser

This module contains the parser for a FLEUR calculation and methods for parsing different files produced by FLEUR.

Please implement file parsing routines that they can be executed from outside the parser. Makes testing and portability easier.

class aiida_fleur.parsers.fleur.FleurParser(node)[source]

This class is the implementation of the Parser class for FLEUR. It parses the FLEUR output if the calculation was successful, i.e checks if all files are there that should be and their condition. Then it parses the out.xml file and returns a (simple) parameterData node with the results of the last iteration. Other files (DOS.x, bands.x, relax.xml, …) are also parsed if they are retrieved.

get_linkname_outparams()[source]

Returns the name of the link to the output_complex Node contains the Fleur output in a rather complex dictionary.

get_linkname_outparams_complex()[source]

Returns the name of the link to the output_complex Node contains the Fleur output in a rather complex dictionary.

parse(**kwargs)[source]

Receives in input a dictionary of retrieved nodes. Does all the logic here. Checks presents of files. Calls routines to parse them and returns parameter nodes and success.

Return successful:
 Bool, if overall parsing was successful or not
Return new_nodes_list:
 list of tuples of two (linkname, Dataobject), nodes to be stored by AiiDA
aiida_fleur.parsers.fleur.convert_frac(ratio)[source]

Converts ratio strings into float, e.g. 1.0/2.0 -> 0.5

aiida_fleur.parsers.fleur.parse_bands_file(bands_lines)[source]

Parses the returned bands.1 and bands.2 file and returns a complete bandsData object. bands.1 has the form: k value, energy

Parameters:bands_lines – string of the read in bands file
aiida_fleur.parsers.fleur.parse_dos_file(dos_lines)[source]

Parses the returned DOS.X files. Structure: (100(1x,e10.3)) e,totdos,interstitial,vac1,vac2, (at(i),i=1,ntype),((q(l,i),l=1,LMAX),i=1,ntype) where e is the energy in eV (= 1/27.2 htr) at(i) is the local DOS of a single atom of the i’th atom-type and q(l,i) is the l-resolved DOS at the i’th atom but has to be multiplied by the number of atoms of this type.

Parameters:
  • dos_lines – string of the read in dos file
  • number_of_atom_types – integer, number of atom types
aiida_fleur.parsers.fleur.parse_relax_file(rlx)[source]

This function parsers relax.xml output file and returns a Dict containing all the data given there.

aiida_fleur.parsers.fleur.parse_xmlout_file(outxmlfile)[source]

Parses the out.xml file of a FLEUR calculation Receives as input the absolute path to the xml output file

Parameters:outxmlfile – path to out.xml file
Returns xml_data_dict:
 a simple dictionary (QE output like) with parsed data

Fleur input Data structure

Fleur input Data structure

In this module is the FleurinpData class, and methods for FLEUR input manipulation plus methods for extration of AiiDA data structures.

class aiida_fleur.data.fleurinp.FleurinpData(**kwargs)[source]

AiiDA data object representing everything a FLEUR calculation needs.

It is initialized with an absolute path to an inp.xml file or a FolderData node containing inp.xml. Other files can also be added that will be copied to the remote machine, where the calculation takes place.

It stores the files in the repository and stores the input parameters of the inp.xml file of FLEUR in the database as a python dictionary (as internal attributes). When an inp.xml (name important!) file is added to files, FleurinpData searches for a corresponding xml schema file in the PYTHONPATH environment variable. Therefore, it is recommend to have the plug-in source code directory in the python environment. If no corresponding schema file is found an error is raised.

FleurinpData also provides the user with methods to extract AiiDA StructureData and KpointsData nodes.

Remember that most attributes of AiiDA nodes can not be changed after they have been stored in the database! Therefore, you have to use the FleurinpModifier class and its methods if you want to change somthing in the inp.xml file. You will retrieve a new FleurinpData that way and start a new calculation from it.

__init__(**kwargs)[source]

Initialize a FleurinpData object set the files given

del_file(filename)[source]

Remove a file from FleurinpData instancefind

Parameters:filename – name of the file to be removed from FleurinpData instance
files

Returns the list of the names of the files stored

find_schema(inp_version_number)[source]

Method which searches for a schema files (.xsd) which correspond to the input xml file. (compares the version numbers)

Parameters:inp_version_number – a version of inp.xml file schema to be found
Returns:A two-element tuple:
  1. A list of paths where schema files are located
  2. A boolen which shows if the required version schema file was found
get_content(filename='inp.xml')[source]

Returns the content of the single file stored for this data node.

Returns:A string of the file content
get_fleur_modes()[source]

Analyses inp.xml file to set up a calculation mode. ‘Modes’ are paths a FLEUR calculation can take, resulting in different output files. This files can be automatically addded to the retrieve_list of the calculation.

Common modes are: scf, jspin2, dos, band, pot8, lda+U, eels, …

Returns:a dictionary containing all possible modes. A mode is activated assigning a non-empty string to the corresponding key.
get_kpointsdata()[source]

This routine returns an AiiDA KpointsData type produced from the inp.xml file. This only works if the kpoints are listed in the in inpxml. This is a calcfunction and keeps the provenance!

Returns:KpointsData node
get_kpointsdata_ncf()[source]

This routine returns an AiiDA KpointsData type produced from the inp.xml file. This only works if the kpoints are listed in the in inpxml. This is NOT a calcfunction and does not keep the provenance!

Returns:KpointsData node
static get_parameterdata(fleurinp)[source]

This routine returns an AiiDA Dict type produced from the inp.xml file. The returned node can be used for inpgen as calc_parameters. This is a calcfunction and keeps the provenance!

Returns:Dict node
get_parameterdata_ncf()[source]

This routine returns an AiiDA Dict type produced from the inp.xml file. This node can be used for inpgen as calc_parameters. This is NOT a calcfunction and does NOT keep the provenance!

Returns:Dict node
get_structuredata()[source]

This routine return an AiiDA Structure Data type produced from the inp.xml file. If this was done before, it returns the existing structure data node. This is a calcfunction and therefore keeps the provenance.

Parameters:fleurinp – a FleurinpData instance to be parsed into a StructureData
Returns:StructureData node
get_structuredata_ncf()[source]

This routine returns an AiiDA Structure Data type produced from the inp.xml file. not a calcfunction

Parameters:self – a FleurinpData instance to be parsed into a StructureData
Returns:StructureData node, or None
get_tag(xpath)[source]

Tries to evaluate an xpath expression for inp.xml file. If it fails it logs it.

Parameters:xpath – an xpath expression
Returns:A node list retrived using given xpath
inp_dict

Returns the inp_dict (the representation of the inp.xml file) as it will or is stored in the database.

open(key='inp.xml', mode='r')[source]

Returns an open file handle to the content of this data node.

Parameters:
  • key – name of the file to be opened
  • mode – the mode with which to open the file handle
Returns:

A file handle in read mode

set_file(filename, dst_filename=None, node=None)[source]

Add a file to the FleurinpData instance.

Parameters:
  • filename – absolute path to the file or a filename of node is specified
  • node – a FolderData node containing the file
set_files(files, node=None)[source]

Add the list of files to the FleurinpData instance. Can by used as an alternative to the setter.

Parameters:
  • files – list of abolute filepaths or filenames of node is specified
  • node – a FolderData node containing files from the filelist
set_kpointsdata(fleurinp_orgi, KpointsDataNode)[source]

This calc function writes the all the kpoints from a KpointsData node in the inp.xml file as a kpointslist. It replaces kpoints written in the inp.xml file. The output FleurinpData is stored in the database.

Currently it is the users resposibility to provide a full KpointsData node with weights.

Parameters:KpointsDataNodeKpointsData node to be written into inp.xml
Returns:modified FleurinpData node

Fleurinp modifier

In this module is the FleurinpModifier class, which is used to manipulate FleurinpData objects in a way which keeps the provernance.

class aiida_fleur.data.fleurinpmodifier.FleurinpModifier(original)[source]

A class which represents changes to the FleurinpData object.

static apply_modifications(fleurinp_tree_copy, modification_tasks, schema_tree=None)[source]

Applies given modifications to the fleurinp lxml tree. It also checks if a new lxml tree is validated against schema. Does not rise an error if inp.xml is not validated, simple prints a message about it.

Parameters:
  • fleurinp_tree_copy – a fleurinp lxml tree to be modified
  • modification_tasks – a list of modification tuples
Returns:

a modified fleurinp lxml tree

changes()[source]

Prints out all changes given in a FleurinpModifier instance.

create_tag(xpath, newelement, create=False)[source]

Appends a create_tag() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path where to place a new tag
  • newelement – a tag name to be created
  • create – if True and there is no given xpath in the FleurinpData, creates it
delete_att(xpath, attrib)[source]

Appends a delete_att() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute to be deleted
  • attrib – the name of an attribute
delete_tag(xpath)[source]

Appends a delete_tag() to the list of tasks that will be done on the FleurinpData.

Parameters:xpathn – a path to the tag to be deleted
freeze()[source]

This method applies all the modifications to the input and returns a new stored fleurinpData object.

Returns:stored FleurinpData with applied changes
get_avail_actions()[source]

Returns the allowed functions from fleurinpmod

static modify_fleurinpdata(original, modifications)[source]

A CalcFunction that performs the modification of the given FleurinpData and stores the result in a database.

Parameters:
  • original – a FleurinpData to be modified
  • modifications – a python dictionary of modifications in the form of {‘task’: …}
Returns new_fleurinp:
 

a modified FleurinpData that is stored in a database

replace_tag(xpath, newelement)[source]

Appends a replace_tag() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the tag to be replaced
  • newelement – a new tag
set_atomgr_att(attributedict, position=None, species=None, create=False)[source]

Appends a change_atomgr_att() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • species_name – a path to the tag to be replaced
  • attributedict – attribute dictionary to be set into the atom group
  • create – if True and there is no given atom group in the FleurinpData, creates it
set_atomgr_att_label(attributedict, atom_label, create=False)[source]

Appends a change_atomgr_att_label() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • attributedict – a new tag
  • atom_label – Atom label which atom group will be set
  • create – if True and there is no given atom group in the FleurinpData, creates it
set_inpchanges(change_dict)[source]

Appends a set_inpchanges() to the list of tasks that will be done on the FleurinpData.

Parameters:change_dict – a dictionary with changes

An example of change_dict:

change_dict = {'itmax' : 1,
               'l_noco': True,
               'ctail': False,
               'l_ss': True}
set_nkpts(count, gamma='F')[source]

Appends a set_nkpts() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • attributedict – a new tag
  • atom_label – Atom label which atom group will be set
  • create – if True and there is no given atom group in the FleurinpData, creates it
set_species(species_name, attributedict, create=False)[source]

Appends a set_species() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • species_name – a path to the tag to be replaced
  • attributedict – attribute dictionary to be set into the specie
  • create – if True and there is no given specie in the FleurinpData, creates it
set_species_label(at_label, attributedict, create=False)[source]

Appends a set_species_label() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • at_label – Atom label which specie will be set
  • attributedict – attribute dictionary to be set into the specie
  • create – if True and there is no given specie in the FleurinpData, creates it
shift_value(change_dict)[source]

Appends a shift_value() to the list of tasks that will be done on the FleurinpData.

Parameters:change_dict – a dictionary with changes

An example of change_dict:

change_dict = {'itmax' : 1, dVac = -2}
show(display=True, validate=False)[source]

Applies the modifications and displays/prints the resulting inp.xml file. Does not generate a new FleurinpData object.

Parameters:
  • display – a boolean that is True if resulting inp.xml has to be printed out
  • validate – a boolean that is True if changes have to be validated
Returns:

a lxml tree representing inp.xml with applied changes

undo(all=False)[source]

Cancels the last change or all of them

Parameters:all – set True if need to cancel all the changes, False if the last one.
validate()[source]

Extracts the schema-file. Makes a test if all the changes lead to an inp.xml file that is validated against the schema.

Returns:a lxml tree representing inp.xml with applied changes
xml_set_all_attribv(xpathn, attributename, attribv, create=False)[source]

Appends a xml_set_all_attribv() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • attributename – an attribute name
  • attribv – an attribute value which will be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
xml_set_all_text(xpathn, text, create=False)[source]

Appends a xml_set_all_text() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • text – text to be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
xml_set_attribv_occ(xpathn, attributename, attribv, occ=None, create=False)[source]

Appends a xml_set_attribv_occ() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • attributename – an attribute name
  • attribv – an attribute value which will be set
  • occ – a list of integers specifying number of occurrence to be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
xml_set_first_attribv(xpathn, attributename, attribv, create=False)[source]

Appends a xml_set_first_attribv() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • attributename – an attribute name
  • attribv – an attribute value which will be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
xml_set_text(xpathn, text, create=False)[source]

Appends a xml_set_text() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • text – text to be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
xml_set_text_occ(xpathn, text, create=False, occ=0)[source]

Appends a xml_set_text_occ() to the list of tasks that will be done on the FleurinpData.

Parameters:
  • xpathn – a path to the attribute
  • text – text to be set
  • create – if True and there is no given xpath in the FleurinpData, creates it
  • occ – an integer specifying number of occurrence to be set

Workflows/Workchains

Base: Fleur-Base WorkChain

This module contains the FleurBaseWorkChain. FleurBaseWorkChain is a workchain that wraps the submission of the FLEUR calculation. Inheritance from the BaseRestartWorkChain allows to add scenarios to restart a calculation in an automatic way if an expected failure occurred.

class aiida_fleur.workflows.base_fleur.FleurBaseWorkChain(*args, **kwargs)[source]

Workchain to run a FLEUR calculation with automated error handling and restarts

check_kpts()[source]

This routine checks if the total number of requested cpus is a factor of kpts and makes an optimisation.

If suggested number of num_mpiprocs_per_machine is 60% smaller than requested, it throws an exit code and calculation stop withour submission.

validate_inputs()[source]

Validate inputs that might depend on each other and cannot be validated by the spec. Also define dictionary inputs in the context, that will contain the inputs for the calculation that will be launched in the run_calculation step.

SCF: Fleur-Scf WorkChain

In this module you find the workchain ‘FleurScfWorkChain’ for the self-consistency cycle management of a FLEUR calculation with AiiDA.

class aiida_fleur.workflows.scf.FleurScfWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Workchain for converging a FLEUR calculation (SCF).

It converges the charge density, total energy or the largest force. Two paths are possible:

  1. Start from a structure and run the inpgen first optional with calc_parameters
  2. Start from a Fleur calculation, with optional remoteData
Params wf_parameters:
 (Dict), Workchain Specifications
Params structure:
 (StructureData), Crystal structure
Params calc_parameters:
 (Dict), Inpgen Parameters
Params fleurinp:
 (FleurinpData), to start with a Fleur calculation
Params remote_data:
 (RemoteData), from a Fleur calculation
Params inpgen:(Code)
Params fleur:(Code)
Returns output_scf_wc_para:
 (Dict), Information of workflow results like Success, last result node, list with convergence behavior
change_fleurinp()[source]

This routine sets somethings in the fleurinp file before running a fleur calculation.

condition()[source]

check convergence condition

control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. will initialize the output nodes The shutdown of the workchain will has to be done afterwards

fleurinpgen_needed()[source]

Returns True if inpgen calculation has to be submitted before fleur calculations

get_res()[source]

Check how the last Fleur calculation went Parse some results.

inspect_fleur()[source]

Analyse the results of the previous Calculation (Fleur or inpgen), checking whether it finished successfully or if not, troubleshoot the cause and adapt the input parameters accordingly before restarting, or abort if unrecoverable error was found

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_fleur()[source]

run a FLEUR calculation

run_fleurinpgen()[source]

run the inpgen

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 inpgen if false run fleur directly

aiida_fleur.workflows.scf.create_scf_result_node(**kwargs)[source]

This is a pseudo wf, to create the right graph structure of AiiDA. This wokfunction 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.

Band: Bandstructure WorkChain

This is the worklfow ‘band’ for the Fleur code, which calculates a electron bandstructure.

class aiida_fleur.workflows.band.fleur_band_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculated a bandstructure from a Fleur calculation

Params:a Fleurcalculation node
Returns:Success, last result node, list with convergence behavior
create_new_fleurinp()[source]

create a new fleurinp from the old with certain parameters

return_results()[source]

return the results of the calculations

run_fleur()[source]

run a FLEUR calculation

start()[source]

check parameters, what condictions? complete? check input nodes

DOS: Density of states WorkChain

This is the worklfow ‘dos’ for the Fleur code, which calculates a density of states (DOS).

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

This workflow calculated a DOS from a Fleur calculation

Params:a Fleurcalculation node
Returns:Success, last result node, list with convergence behavior

wf_parameters: { ‘tria’, ‘nkpts’, ‘sigma’, ‘emin’, ‘emax’} defaults : tria = True, nkpts = 800, sigma=0.005, emin= -0.3, emax = 0.8

create_new_fleurinp()[source]

create a new fleurinp from the old with certain parameters

return_results()[source]

return the results of the calculations

run_fleur()[source]

run a FLEUR calculation

start()[source]

check parameters, what condictions? complete? check input nodes

EOS: Calculate a lattice constant

In this module you find the workflow ‘FleurEosWorkChain’ for the calculation of of an equation of state

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

This workflow calculates the equation of states of a structure. Calculates several unit cells with different volumes. A Birch_Murnaghan equation of states fit determines the Bulk modulus and the groundstate volume of the cell.

Params wf_parameters:
 Dict node, optional ‘wf_parameters’, protocol specifying parameter dict
Params structure:
 StructureData node, ‘structure’ crystal structure
Params calc_parameters:
 Dict node, optional ‘calc_parameters’ parameters for inpgen
Params inpgen:Code node,
Params fleur:Code node,
Return output_eos_wc_para:
 Dict node, contains relevant output information. about general succeed, fit results and so on.
control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. It will initialize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Launch fleur_scfs from the generated structures

get_inputs_scf()[source]

get and ‘produce’ the inputs for a scf-cycle

return_results()[source]

return the results of the calculations (scf workchains) and do a Birch-Murnaghan fit for the equation of states

start()[source]

check parameters, what condictions? complete? check input nodes

structures()[source]

Creates structure data nodes with different Volume (lattice constants)

aiida_fleur.workflows.eos.birch_murnaghan(volumes, volume0, bulk_modulus0, bulk_deriv0)[source]

This evaluates the Birch Murnaghan equation of states

aiida_fleur.workflows.eos.birch_murnaghan_fit(energies, volumes)[source]

least squares fit of a Birch-Murnaghan equation of state curve. From delta project containing in its columns the volumes in A^3/atom and energies in eV/atom # The following code is based on the source code of eos.py from the Atomic # Simulation Environment (ASE) <https://wiki.fysik.dtu.dk/ase/>. :params energies: list (numpy arrays!) of total energies eV/atom :params volumes: list (numpy arrays!) of volumes in A^3/atom

#volume, bulk_modulus, bulk_deriv, residuals = Birch_Murnaghan_fit(data)

aiida_fleur.workflows.eos.create_eos_result_node(**kwargs)[source]

This is a pseudo wf, to create the right graph structure of AiiDA. This wokfunction 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_fleur.workflows.eos.eos_structures(inp_structure, scalelist)[source]

Creates many rescalled StructureData nodes out of a crystal structure. Keeps the provenance in the database.

:param StructureData, a StructureData node (pk, sor uuid) :param scalelist, list of floats, scaling factors for the cell

Returns:list of New StructureData nodes with rescalled structure, which are linked to input Structure
aiida_fleur.workflows.eos.save_structure(structure)[source]

Saves a structure data node

Relax: Relaxation of a Cystalstructure WorkChain

In this module you find the workflow ‘FleurRelaxWorkChain’ for geometry optimization.

class aiida_fleur.workflows.relax.FleurRelaxWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow performs structure optimization.

static analyse_relax(relax_dict)[source]

This function generates a new fleurinp analysing parsed relax.xml from the previous calculation.

NOT IMPLEMENTED YET

Parameters:relax_dict – parsed relax.xml from the previous calculation
Return new_fleurinp:
 new FleurinpData object that will be used for next relax iteration
check_failure()[source]

Throws an exit code if scf failed

condition()[source]

Checks if relaxation criteria is achieved.

Returns:True if structure is optimised and False otherwise
control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. It will initialize the output nodes The shutdown of the workchain will has to be done afterwards.

converge_scf()[source]

Submits aiida_fleur.workflows.scf.FleurScfWorkChain.

generate_new_fleurinp()[source]

This function fetches relax.xml from the previous iteration and calls analyse_relax(). New FleurinpData is stored in the context.

get_inputs_first_scf()[source]

Initialize inputs for the first iteration. Here one can find initialization of different input regimes described in validate().

get_inputs_scf()[source]

Initializes inputs for further iterations.

get_results()[source]

Generates results of the workchain. Creates a new structure data node which is an optimized structure.

return_results()[source]

This function stores results of the workchain into the output nodes.

start()[source]

Retrieve and initialize paramters of the WorkChain

validate()[source]

This function analyses inputs nodes and decides what is the input mode:

  1. Fleurinp is given -> relax iterations
  2. Fleurinp and remote are given -> take cdn1 from remote, relax iterations
  3. Remote is given -> take inp.xml and cdn1 from remote, relax iterations
  4. Structure is given -> run inpgen, relax iterations
aiida_fleur.workflows.relax.save_output_node(out)[source]

Save the out dict in the db to provide correct provenance.

aiida_fleur.workflows.relax.save_structure(structure)[source]

Save a structure data node to provide correct provenance.

initial_cls: Caluclation of inital corelevel shifts

This is the worklfow ‘initial_cls’ using the Fleur code calculating corelevel shifts with different methods.

aiida_fleur.workflows.initial_cls.clshifts_to_be(coreleveldict, reference_dict)[source]

This methods converts corelevel shifts to binding energies, if a reference is given. These can than be used for plotting.

Example:

reference = {'W' : {'4f7/2' : [124],
                   '4f5/2' : [102]},
             'Be' : {'1s': [117]}}
corelevels = {'W' : {'4f7/2' : [0.4, 0.3, 0.4 ,0.1],
                     '4f5/2' : [0, 0.3, 0.4, 0.1]},
              'Be' : {'1s': [0, 0.2, 0.4, 0.1, 0.3]}}
aiida_fleur.workflows.initial_cls.create_initcls_result_node(**kwargs)[source]

This is a pseudo wf, to create the rigth graph structure of AiiDA. This wokfunction 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_fleur.workflows.initial_cls.extract_results(calcs)[source]

Collect results from certain calculation, check if everything is fine, calculate the wanted quantities.

params: calcs : list of scf workchains nodes

aiida_fleur.workflows.initial_cls.fleur_calc_get_structure(calc_node)[source]

Get the AiiDA data structure from a fleur calculations

class aiida_fleur.workflows.initial_cls.fleur_initial_cls_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Turn key solution for the calculation of core level shift

check_input()[source]

Init same context and check what input is given if it makes sence

collect_results()[source]

Collect results from certain calculation, check if everything is fine, calculate the wanted quantities. currently all energies are in hartree (as provided by Fleur)

control_end_wc(errormsg)[source]

Controled way to shutdown the workchain. will initalize the output nodes The shutdown of the workchain will has to be done afterwards

find_parameters()[source]

If the same parameters shall be used in the calculations you have to find some that match. For low error on CLS. therefore use the ones enforced or extract from the previous Fleur calculation.

get_references()[source]

To calculate a CLS in initial state approx, we need reference calculations to the Elemental crystals. First it is checked if the user has provided them Second the database is checked, if there are structures with certain extras. Third the COD database is searched for the elemental Cystal structures. If some referneces are not found stop here. Are there already calculation of these ‘references’, ggf use them. We do not put these calculation in the calculation queue yet because we need specific parameters for them

handle_scf_failure()[source]

In here we handle all failures from the scf workchain

relax()[source]

Do structural relaxation for certain structures.

relaxation_needed()[source]

If the structures should be relaxed, check if their Forces are below a certain threshold, otherwise throw them in the relaxation wf.

return_results()[source]

return the results of the calculations

run_fleur_scfs()[source]

Run SCF-cycles for all structures, calculations given in certain workflow arrays.

run_scfs_ref()[source]

Run SCF-cycles for ref structures, calculations given in certain workflow arrays. parameter nodes should be given

aiida_fleur.workflows.initial_cls.get_para_from_group(element, group)[source]

get structure node for a given element from a given group of structures (quit creedy, done straighforward)

aiida_fleur.workflows.initial_cls.get_ref_from_group(element, group)[source]

Return a structure data node from a given group for a given element. (quit creedy, done straighforward)

params: group: group name or pk params: element: string with the element i.e ‘Si’

returns: AiiDA StructureData node

aiida_fleur.workflows.initial_cls.querry_for_ref_structure(element_string)[source]

This methods finds StructureData nodes with the following extras: extra.type = ‘bulk’, # Should be done by looking at pbc, but I could not get querry to work. extra.specific = ‘reference’, ‘extra.elemental’ = True, extra.structure = element_string

param: element_string: string of an element return: the latest StructureData node that was found

corehole: Performance of coreholes calculations

This is the worklfow ‘corehole’ using the Fleur code, which calculates Binding energies and corelevel shifts with different methods. ‘divide and conquer’

aiida_fleur.workflows.corehole.create_corehole_result_node(**kwargs)[source]

This is a pseudo wf, to create the rigth graph structure of AiiDA. This wokfunction 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_fleur.workflows.corehole.extract_results_corehole(calcs)[source]

Collect results from certain calculation, check if everything is fine, calculate the wanted quantities.

params: calcs : list of scf workchains nodes

class aiida_fleur.workflows.corehole.fleur_corehole_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

Turn key solution for a corehole calculation with the FLEUR code. Has different protocols for different core-hole types (valence, charge).

Calculates supercells. Extracts binding energies for certain corelevels from the total energy differences a the calculation with corehole and without.

Documentation: See help for details.

Two paths are possible:

  1. Start from a structure -> workchains run inpgen first (recommended)
  2. Start from a Fleurinp data object

Also it is recommended to provide a calc parameter node for the structure

Params:wf_parameters: Dict node, specify, resources and what should be calculated
Params:structure : structureData node, crystal structure
Params:calc_parameters: Dict node, inpgen parameters for the crystal structure
Params:fleurinp: fleurinpData node,
Params:inpgen: Code node,
Params:fleur: Code node,
Returns:output_corehole_wc_para: Dict node, successful=True if no error
Uses workchains:
 fleur_scf_wc, fleur_relax_wc
Uses calcfunctions:
 supercell, create_corehole_result_node, prepare_struc_corehole_wf
check_input()[source]

init all context parameters, variables. Do some input checks. Further input checks are done in further workflow steps

check_scf()[source]

Check if ref scf was successful, or something needs to be dealt with. If unsuccesful abort, because makes no sense to continue.

collect_results()[source]

Collect results from certain calculation, check if everything is fine, calculate the wanted quantities. currently all energies are in hartree (as provided by Fleur)

control_end_wc(errormsg)[source]

Controled way to shutdown the workchain. report errors and always initalize/produce output nodes. But log successful=False

create_coreholes()[source]

Check the input for the corelevel specification, create structure and parameter nodes with all the need coreholes. create the wf_parameter nodes for the scfs. Add all calculations to scfs_to_run.

Layout: # Check what coreholes should be created. # said in the input, look in the original cell # These positions are the same for the supercell. # break the symmetry for the supercells. (make the corehole atoms its own atom type) # create a new species and a corehole for this atom group. # move all the atoms in the cell that impurity is in the origin (0.0, 0.0, 0.0) # use the fleurinp_change feature of scf to create the corehole after inpgen gen in the scf # start the scf with the last charge density of the ref calc? so far no, might not make sense

# TODO if this becomes to long split

create_supercell()[source]

create the needed supercell

relax()[source]

Do structural relaxation for certain structures.

relaxation_needed()[source]

If the structures should be relaxed, check if their Forces are below a certain threshold, otherwise throw them in the relaxation wf.

return_results()[source]

return the results of the calculations

run_ref_scf()[source]

Run a scf for the reference super cell

run_scfs()[source]

Run a scf for the all corehole calculations in parallel super cell

supercell_needed()[source]

check if a supercell is needed and what size it should be

aiida_fleur.workflows.corehole.prepare_struc_corehole_wf(base_supercell, wf_para, para)[source]

calcfunction which does all/some the structure+calcparameter manipulations together (therefore less nodes are produced and proverance is kept) wf_para: Dict node dict: {‘site’ : sites[8], ‘kindname’ : ‘W1’, ‘econfig’: “[Kr] 5s2 4d10 4f13 | 5p6 5d5 6s2”, ‘fleurinp_change’ : []}

delta: Calculates a Delta Factor

In this module you find the worklfow ‘fleur_delta_wc’ which is a turnkey solution to calculate a delta for a given code with AiiDA.

aiida_fleur.workflows.delta.create_delta_result_node(**kwargs)[source]

This is a pseudo wf, to create the rigth graph structure of AiiDA. This wokfunction 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.

class aiida_fleur.workflows.delta.fleur_delta_wc(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates a equation of states and from a given group of structures in the database using a group of given parameter nodes in the database

calculate_delta()[source]

Execute here the script to calculate a delta factor

extract_results_eos()[source]

extract information out of the result nodes of the the eos workchains ran in the step before

get_calcs_from_groups()[source]

Extract the crystal structures and parameter data nodes from the given groups and create calculation ‘pairs’ (stru, para).

get_inputs_eos()[source]

get the inputs for a scf-cycle

return_results()[source]

return the results of the calculations

run_eos()[source]

Run the equation of states for all delta structures with their parameters

start_up()[source]

init context and some parameters

aiida_fleur.workflows.delta.get_paranode(struc, para_nodes)[source]

find out if a parameter node for a structure is in para_nodes (currently very creedy, but lists are small (100x100) but maybe reduce database accesses)

MAE: Force-theorem calculation of magnetic anisotropy energies

In this module you find the workflow ‘FleurMaeWorkChain’ for the calculation of Magnetic Anisotropy Energy via the force theorem.

class aiida_fleur.workflows.mae.FleurMaeWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates the Magnetic Anisotropy Energy of a structure.

change_fleurinp()[source]

This routine sets somethings in the fleurinp file before running a fleur calculation.

control_end_wc(errormsg)[source]

Controled way to shutdown the workchain. will initalize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Converge charge density with or without SOC. Submit a single Fleur calculation to obtain a reference for further force theorem calculations.

force_after_scf()[source]

Calculate energy of a system for given SQAs using the force theorem. Converged reference is stored in self.ctx[‘xyz’].

force_wo_scf()[source]

Submit FLEUR force theorem calculation using input remote

get_inputs_scf()[source]

Initialize inputs for scf workflow: wf_param, options, calculation parameters, codes, structure

get_results()[source]

Generates results of the workchain.

return_results()[source]

This function outputs results of the wc

scf_needed()[source]

This function handles setting of required parameters for force theorem calculation depending on if scf is needed or not.

start()[source]

Retrieve and initialize paramters of the WorkChain

aiida_fleur.workflows.mae.save_output_node(out)[source]

This calcfunction saves the out dict in the db

MAE Conv: Self-consistent calculation of magnetic anisotropy energies

In this module you find the workflow ‘FleurMAEWorkChain’ for the calculation of Magnetic Anisotropy Energy converging all the directions.

class aiida_fleur.workflows.mae_conv.FleurMaeConvWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates the Magnetic Anisotropy Energy of a structure.

control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. will initialize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Converge charge density with or without SOC. Depending on a branch of MAE calculation, submit a single Fleur calculation to obtain a reference for further force theorem calculations or submit a set of Fleur calculations to converge charge density for all given SQAs.

get_inputs_scf()[source]

Initialize inputs for scf workflow: wf_param, options, calculation parameters, codes, structure

get_results()[source]

Retrieve results of converge calculations

return_results()[source]

Retrieve results of converge calculations

start()[source]

Retrieve and initialize paramters of the WorkChain

aiida_fleur.workflows.mae_conv.save_output_node(out)[source]

This calcfunction saves the out dict in the db

SSDisp: Force-theorem calculation of spin spiral dispersion

In this module you find the workflow ‘FleurSSDispWorkChain’ for the calculation of spin spiral dispersion using scalar-relatevistic Hamiltonian.

class aiida_fleur.workflows.ssdisp.FleurSSDispWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates spin spiral dispersion of a structure.

change_fleurinp()[source]

This routine sets somethings in the fleurinp file before running a fleur calculation.

control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. It will initialize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Converge charge density for collinear case which is a reference for futher spin spiral calculations.

force_after_scf()[source]

This routine uses the force theorem to calculate energies dispersion of spin spirals. The force theorem calculations implemented into the FLEUR code. Hence a single iteration FLEUR input file having <forceTheorem> tag has to be created and submitted.

force_wo_scf()[source]

Submit FLEUR force theorem calculation using input remote

get_inputs_scf()[source]

Initialize inputs for the scf cycle

get_results()[source]

Generates results of the workchain.

return_results()[source]

This function outputs results of the wc

scf_needed()[source]

This function handles setting of required parameters for force theorem calculation depending on if scf is needed or not.

start()[source]

Retrieve and initialize paramters of the WorkChain

aiida_fleur.workflows.ssdisp.save_output_node(out)[source]

This calcfunction saves the out dict in the db

SSDisp Conv: Self-consistent calculation of spin spiral dispersion

In this module you find the workflow ‘FleurSSDispConvWorkChain’ for the calculation of Magnetic Anisotropy Energy converging all the directions.

class aiida_fleur.workflows.ssdisp_conv.FleurSSDispConvWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates the Magnetic Anisotropy Energy of a structure.

control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. will initialize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Converge charge density with or without SOC. Depending on a branch of Spiral calculation, submit a single Fleur calculation to obtain a reference for further force theorem calculations or submit a set of Fleur calculations to converge charge density for all given SQAs.

get_inputs_scf()[source]

Initialize inputs for scf workflow: wf_param, options, calculation parameters, codes, structure

get_results()[source]

Retrieve results of converge calculations

return_results()[source]

Retrieve results of converge calculations

start()[source]

Retrieve and initialize paramters of the WorkChain

aiida_fleur.workflows.ssdisp_conv.save_output_node(out)[source]

This calcfunction saves the out dict in the db

DMI: Force-theorem calculation of Dzjaloshinskii-Moriya interaction energy dispersion

In this module you find the workflow ‘FleurDMIWorkChain’ for the calculation of DMI energy dispersion.

class aiida_fleur.workflows.dmi.FleurDMIWorkChain(inputs=None, logger=None, runner=None, enable_persistence=True)[source]

This workflow calculates spin spiral dispersion of a structure.

change_fleurinp()[source]

This routine sets somethings in the fleurinp file before running a fleur calculation.

control_end_wc(errormsg)[source]

Controlled way to shutdown the workchain. will initialize the output nodes The shutdown of the workchain will has to be done afterwards

converge_scf()[source]

Converge charge density for collinear case which is a reference for futher spin spiral calculations.

force_after_scf()[source]

This routine uses the force theorem to calculate energies dispersion of spin spirals. The force theorem calculations implemented into the FLEUR code. Hence a single iteration FLEUR input file having <forceTheorem> tag has to be created and submitted.

force_wo_scf()[source]

Submit FLEUR force theorem calculation using input remote

get_inputs_scf()[source]

Initialize inputs for the scf cycle

get_results()[source]

Generates results of the workchain.

return_results()[source]

This function outputs results of the wc

scf_needed()[source]

This function handles setting of required parameters for force theorem calculation depending on if scf is needed or not.

start()[source]

Retrieve and initialize paramters of the WorkChain

aiida_fleur.workflows.dmi.save_output_node(out)[source]

This calcfunction saves the out dict in the db