FleurinpData — AiiDA-FLEUR 1.1.0 documentation

# 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

`FleurinpData` is an additional AiiDA data structure which represents everything a `FleurCalculation` 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

If you want to change the input file use the `FleurinpModifier` (FleurinpModifier) class, because a `FleurinpData` object has to be stored in the database and usually sealed.

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 an absolute path `path_to_inp.xml_file`.

Be aware that the `inp.xml` file name has to be named ‘inp.xml’, i.e. no file names are changed because the filenames will not be changed before submitting a Fleur Calculation. If you add another 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.

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

> - `del_file()` - Deletes a file from `FleurinpData` instance.

> - `set_file()` - Adds a file from a folder node to `FleurinpData` instance.

> - `set_files()` - Adds several files from a folder node to `FleurinpData` instance.

> - `get_fleur_modes()` - Analyses inp.xml and get a corresponding calculation mode.

> - `get_structuredata()` - A CalcFunction which returns an AiiDA `StructureData` type extracted from the inp.xml file.

> - `get_kpointsdata()` - A CalcFunction which returns an AiiDA `KpointsData` type produced from the inp.xml file. This only works if the kpoints are listed in the in inp.xml.

> - `get_parameterdata()` - A CalcFunction that extracts a `Dict` node containing FLAPW parameters. This node can be used as an input for inpgen.

> - `set_kpointsdata()` - A CalcFunction that writes kpoints of a `KpointsData` node in the inp.xml file returns a new `FleurinpData` instance. It replaces old kpoints.

## Setting up atom labels

Label is a string that marks a certain atom in the `inp.xml` file. Labels are created automatically by the inpgen, however, in some cases it is helpful to control atom labeling. This can be done by setting up the kind name while initialising the structure:

    structure = StructureData(cell=cell)
    structure.append_atom(position=(0.0, 0.0, -z), symbols='Fe', name='Fe123')
    structure.append_atom(position=(x, y, 0.0), symbols='Pt')
    structure.append_atom(position=(0., 0., z), symbols='Pt')

in this case both of the Pr atoms will get default labels, but ‘Fe’ atom will the label ‘123’ (actually ‘ 123’, but all of the methods in AiiDA-Fleur are implemented in a way that user should know only last digit characters).

Note

Kind name, which is used for labeling, must begin from the element name and end up with a number. It is very important that the first digit of the number is smaller than 4: `152`, `3`, `21` can be good choices, when `492`, `66`, `91` are forbidden.

Warning

Except setting a label, providing the kind name also creates a new specie. This is because the `123` will not only appear as a label, but also as an atom number. In our case, the line in the inpgen input corresponding to Fe atom will look like `26.123 0 0 -z 123`. Hence, if we would have another Fe atom with the default kind name, both of the Fe atom would belong to different atom group generally resulting in lower symmetry.

Given labels can be used for simplified xml methods. For example, when one performs SOC calculations it might be needed to vary `socscale` parameter for a certain atom. Knowing the correct label of the atom, it is straightforward to make such a change in `FleurinpData` object (using the `FleurinpModifier`) or pass a corresponding line to `inpxml_changes` of workchain parameters:

    # an example of inpxml_changes list, that sets socscale of the iron atom
    # from the above structure to zero
    inpxml_changes = [('set_species_label', {'at_label': '123',
                                            'attributedict': {
                                                'special': {'socscale': 0.0}
                                                },
                                            'create': True
                                           })]

    # in this example the atomgroup, to which the atom with label '222' belongs,
    # will be modified
    fm = FleurinpModifier(SomeFleurinp)
    fm.set_atomgr_att_label(attributedict={'force': [('relaxXYZ', 'FFF')]}, atom_label='                 222')