FleurinpData

  • Class: FleurinpData
  • String to pass to the DataFactory(): fleur.fleurinp
  • Aim: store input files for the FLEUR code and provide user-friendly editing.
  • What is stored in the database: the filenames, a parsed inp.xml files as nested dictionary
  • What is stored in the file repository: inp.xml file and other optional files.
  • Additional functionality: Provide user-friendly methods. Connected to structure and Kpoints AiiDA data structures

Description/Features

../../_images/fleurinpdata.png

FleurinpData is an additional AiiDA data structure which represents everything a Fleur calculation needs, which is mainly a complete inp.xml file.

Note

Currently, FleurinpData methods support ONLY inp.xml files, which have everything in them (kpoints, energy parameters, …), i.e which were created with the -explicit inpgen command line switch. In general it was designed to account for several separate files too, but this is no the default way Fleur should be used with AiiDA.

FleurinpData was implemented to make the plugin more user-friendly, hide complexity and ensure the connection to AiiDA data structures (StructureData, KpointsData). More detailed information about the methods can be found below and in the module code documentation.

Note

For changing the input file use the class FleurinpModifier class, because a new FleurinpData object has to be stored in the database which will be linked in the database over a CalcFunction to the parent FleurinpData. Otherwise the provenance of from where the new FleurinpData comes from is likely lost.

Initialization:

from aiida_fleur.data.fleurinp import FleurinpData
# or FleurinpData = DataFactory('fleur.fleurinp')

F = FleurinpData(files=['path_to_inp.xml_file', <other files>])
#or
F = FleurinpData(files=['inp.xml', <other files>], node=<folder_data_pk>)

If the node attribute is specified, AiiDA will try to get files from the FolderData corresponding to the node. If not, it tries to find an inp.xml file using absolute path path_to_inp.xml_file. The use of absolute paths will be deprecated in the future hence it is recommended to always use files attached to a database node.

Be aware that the inp.xml file name has to be named ‘inp.xml’, i.e. no file names are changed, the files will be given with the provided names to Fleur (so far). Also if you add an other inp.xml file the first one will be overwritten.

Properties

  • inp_dict: Returns the inp_dict (the representation of the inp.xml file) as it will or is stored in the database.
  • files: Returns a list of files, which were added to FleurinpData. Note that all of these files will be copied to the folder where FLEUR will be run.
  • _schema_file_path: Returns the absolute path of the xml schema file used for the current inp.xml file.

Note

FleurinpData will first look in the aiida_fleur/fleur_schema/input/ for matching Fleur xml schema files to the inp.xml files. If it does not find a match there, it will recursively search in your PYTHONPATH and the current directory. If you installed the package with pip there should be no problem, as long the package versions is new enough for the version of the Fleur code you are deploying.

User Methods

Fleurinpmodifier

Description

The FleurinpModifier class has to be used if you want to change anything in a stored FleurinpData. It will store and validate all the changes you wish to do and produce a new FleurinpData node after you are done making changes and apply them.

FleurinpModifier provides a user with methods to change the Fleur input. Not every possible change is supported, some changes are forbidden, others will be supported in the future. In principle a user can do everything, since he could prepare a FLEUR input himself and create a FleurinpData object from that input.

Note

In the open provenance model no data to data links exist and nodes stored in the database cannot be changed anymore (except extras and comments). Therefore, to modify something in the inp.xml file one has to create a new FleurinpData which is not stored, modify it and store it again. However, this node would pop into existence unlinked in the database and this would mean we loose the origin from what data it comes from and what was done to it. This is the task of FleurinpModifier.

Usage

To modify an existing FleurinpData, a FleurinpModifier instance has to be initialised staring from the FleurinpData instance. Then a user can perform certain modifications which will be cached and can be previewed. They can only be applied on a new FleurinpData object when the freeze method is executed. A code example:

from aiida_fleur.data.fleurinpmodifier import  FleurinpModifier

F = FleurinpData(files=['inp.xml', <other files>], node=<folder_data_pk>)
fm = FleurinpModifier(F)                                # Initialise FleurinpModifier class
fm.set_inpchanges({'dos' : True, 'Kmax': 3.9 })         # Add changes
fm.show()                                               # Preview
new_fleurinpdata = fm.freeze()                          # Apply

User Methods

General methods:

Change methods:

  • xml_set_attribv_occ(xpathn, attributename, attribv, occ=[0], create=False): Set an attribute of a specific occurrence of xml elements
  • xml_set_first_attribv(xpathn, attributename, attribv, create=False): Set an attribute of first occurrence of xml element
  • xml_set_all_attribv(xpathn, attributename, attribv, create=False): Set an attribute of several xml elements
  • xml_set_text(xpathn, text, create=False): Set the text of first occurrence of xml element
  • xml_set_all_text(xpathn, text, create=False): Set the text of xml elements
  • create_tag(xpath, newelement, create=False): Insert an xml element in the xml tree.
  • delete_att(xpath, attrib): Delete an attribute for xml elements from the xpath evaluation.
  • delete_tag(xpath) : Delete an xml element.
  • replace_tag(xpath, newelement): Replace an xml element.
  • set_species(species_name, attributedict, create=False): Specific user-friendly method to change species parameters.
  • set_atomgr_att(attributedict, position=None, species=None,create=False): Specific method to change atom group parameters.
  • set_species_label(at_label, attributedict, create=False): Specific user-friendly method to change a specie of an atom with a certain label.
  • set_atomgr_att_label(attributedict, atom_label, create=False): Specific method to change atom group parameters of an atom with a certain label.
  • set_inpchanges(self, change_dict): Specific user-friendly method for easy changes of attribute key value type.
  • set_nkpts(self, count, gamma='F'): Specific method to set the number of kpoints.