Utility Functions/Classes¶
Custom Datatypes¶
This module defines subclasses of UserDict and UserList to be able to prevent unintended modifications
-
masci_tools.util.lockable_containers.
LockContainer
(lock_object)[source]¶ Contextmanager for temporarily locking a lockable object. Object is unfrozen when exiting with block
- Parameters
lock_object – lockable container (not yet frzen)
-
class
masci_tools.util.lockable_containers.
LockableDict
(*args, recursive=True, **kwargs)[source]¶ Subclass of UserDict, which can prevent modifications to itself. Raises RuntimeError if modification is attempted.
Use
LockableDict.freeze()
to enforce.LockableDict.get_unlocked()
returns a copy of the locked object with builtin lists and dicts- Parameters
recursive – bool if True (default) all subitems (lists or dicts) are converted into their lockable counterparts
All other args or kwargs will be passed on to initialize the UserDict
- IMPORTANT NOTE:
This is not a direct subclass of dict. So isinstance(a, dict) will be False if a is an LockableDict
-
class
masci_tools.util.lockable_containers.
LockableList
(*args, recursive=True, **kwargs)[source]¶ Subclass of UserList, which can prevent modifications to itself. Raises RuntimeError if modification is attempted.
Use
LockableList.freeze()
to enforce.LockableList.get_unlocked()
returns a copy of the locked object with builtin lists and dicts- Parameters
recursive – bool if True (default) all subitems (lists or dicts) are converted into their lockable counterparts
All other args or kwargs will be passed on to initialize the UserList
- IMPORTANT NOTE:
This is not a direct subclass of list. So isinstance(a, list) will be False if a is an LockableList
This module defines a small helper class to make case insensitive dictionary lookups available naturally
-
class
masci_tools.util.case_insensitive_dict.
CaseInsensitiveDict
(*args, upper=False, **kwargs)[source]¶ Dict with case insensitive lookup. Used in Schema dicts to make finding paths for tags and attributes easier. Does not preserve the case of the inserted key. Does not support case insensitive lookups in nested dicts Subclass of
masci_tools.util.lockable_containers.LockableDict
. So can be frozen via the`freeze()` method- Parameters
upper – bool if True the method upper() will be used instead of lower() to normalize keys
All other args or kwargs will be passed on to initialize the UserDict
- IMPORTANT NOTE:
This is not a direct subcalss of dict. So isinstance(a, dict) will be False if a is an CaseInsensitiveDict
-
class
masci_tools.util.case_insensitive_dict.
CaseInsensitiveFrozenSet
(iterable=None)[source]¶ Frozenset (i.e. immutable set) with case insensitive membership tests. Used in Schema dicts in tag_info entries to make flexible classification easy Preserves the case of the entered keys (original_case() returns the case of the first encounter)
- Parameters
iterable – iterable only containing str
- Note:
There might be subtle differences to expected behaviour with the methods __radd__, __ror__, and so on
-
difference
(*others)[source]¶ Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
-
intersection
(*others)[source]¶ Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
Common XML utility¶
Common functions for parsing input/output files or XMLschemas from FLEUR
-
masci_tools.util.xml.common_functions.
abs_to_rel_xpath
(xpath, new_root)[source]¶ Convert a given xpath to be relative from a tag appearing in the original xpath.
- Parameters
xpath – str of the xpath to convert
new_root – str of the tag from which the new xpath should be relative
- Returns
str of the relative xpath
-
masci_tools.util.xml.common_functions.
check_complex_xpath
(node, base_xpath, complex_xpath)[source]¶ Check that the given complex xpath produces a subset of the results for the simple xpath
- Parameters
node – root node of an etree
base_xpath – str of the xpath without complex syntax
complex_xpath – str of the xpath to check
- Raises
ValueError – If the complex_xpath does not produce a subset of the results of the base_xpath
-
masci_tools.util.xml.common_functions.
clear_xml
(tree)[source]¶ Removes comments and executes xinclude tags of an xml tree.
- Parameters
tree – an xml-tree which will be processed
- Returns
cleared_tree, an xmltree without comments and with replaced xinclude tags
-
masci_tools.util.xml.common_functions.
eval_xpath
(node, xpath, logger=None, list_return=False, namespaces=None)[source]¶ Tries to evaluate an xpath expression. If it fails it logs it. If a absolute path is given (starting with ‘/’) and the tag of the node does not match the root. It will try to find the tag in the path and convert it into a relative path
- Parameters
node – root node of an etree
xpath – xpath expression (relative, or absolute)
logger – logger object for logging warnings, errors, if not provided all errors will be raised
list_return – if True, the returned quantity is always a list even if only one element is in it
namespaces – dict, passed to namespaces argument in xpath call
- Returns
text, attribute or a node list
-
masci_tools.util.xml.common_functions.
get_xml_attribute
(node, attributename, logger=None)[source]¶ Get an attribute value from a node.
- Parameters
node – a node from etree
attributename – a string with the attribute name.
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Returns
either attributevalue, or None
-
masci_tools.util.xml.common_functions.
reverse_xinclude
(xmltree, schema_dict, included_tags, **kwargs)[source]¶ Split the xmltree back up according to the given included tags. The original xmltree will be returned with the corresponding xinclude tags and the included trees are returned in a dict mapping the inserted filename to the extracted tree
Tags for which no known filename is known are returned under unknown-1.xml, … The following tags have known filenames:
relaxation:
relax.xml
kPointLists:
kpts.xml
symmetryOperations:
sym.xml
atomSpecies:
species.xml
atomGroups:
atoms.xml
Additional mappings can be given in the keyword arguments
- Parameters
xmltree – an xml-tree which will be processed
schema_dict – Schema dictionary containing all the necessary information
included_tags – Iterable of str, containing the names of the tags to be excluded
- Returns
xmltree with the inseerted xinclude tags and a dict mapping the filenames to the excluded trees
- Raises
ValueError – if the tag can not be found in teh given xmltree
-
masci_tools.util.xml.common_functions.
split_off_attrib
(xpath)[source]¶ Splits off attribute of the given xpath (part after @)
- Parameters
xpath – str of the xpath to split up
-
masci_tools.util.xml.common_functions.
split_off_tag
(xpath)[source]¶ Splits off the last part of the given xpath
- Parameters
xpath – str of the xpath to split up
-
masci_tools.util.xml.common_functions.
validate_xml
(xmltree, schema, error_header='File does not validate')[source]¶ Checks a given xmltree against a schema and produces a nice error message with all the validation errors collected
- Parameters
xmltree – xmltree of the file to validate
schema – etree.XMLSchema to validate against
error_header – str to lead a evtl error message with
- Raises
etree.DocumentInvalid if the schema does not validate
Common functions for converting types to and from XML files
-
masci_tools.util.xml.converters.
convert_attribute_to_xml
(attributevalue, possible_types, logger=None, float_format='.10', list_return=False)[source]¶ Tries to converts a given attributevalue to a string for a xml file according to the types given in possible_types. First succeeded conversion will be returned
- Parameters
attributevalue – value to convert.
possible_types – list of str What types it will try to convert from
logger – logger object for logging warnings if given the errors are logged and the list is returned with the unconverted values otherwise a error is raised, when the first conversion fails
list_return – if True, the returned quantity is always a list even if only one element is in it
- Returns
The converted str of the value of the first succesful conversion
-
masci_tools.util.xml.converters.
convert_fleur_lo
(loelements)[source]¶ Converts lo xml elements from the inp.xml file into a lo string for the inpgen
-
masci_tools.util.xml.converters.
convert_from_fortran_bool
(stringbool)[source]¶ Converts a string in this case (‘T’, ‘F’, or ‘t’, ‘f’) to True or False
- Parameters
stringbool – a string (‘t’, ‘f’, ‘F’, ‘T’)
- Returns
boolean (either True or False)
-
masci_tools.util.xml.converters.
convert_str_version_number
(version_str)[source]¶ Convert the version number as a integer for easy comparisons
- Parameters
version_str – str of the version number, e.g. ‘0.33’
- Returns
tuple of ints representing the version str
-
masci_tools.util.xml.converters.
convert_text_to_xml
(textvalue, possible_definitions, logger=None, float_format='16.13', list_return=False)[source]¶ Tries to convert a given list of values to str for a xml file based on the definitions (length and type). First succeeded conversion will be returned
- Parameters
textvalue – value to convert
possible_definitions – list of dicts What types it will try to convert to
logger – logger object for logging warnings if given the errors are logged and the list is returned with the unconverted values otherwise a error is raised, when the first conversion fails
list_return – if True, the returned quantity is always a list even if only one element is in it
- Returns
The converted value of the first succesful conversion
-
masci_tools.util.xml.converters.
convert_to_fortran_bool
(boolean)[source]¶ Converts a Boolean as string to the format defined in the input
- Parameters
boolean – either a boolean or a string (‘True’, ‘False’, ‘F’, ‘T’)
- Returns
a string (either ‘t’ or ‘f’)
-
masci_tools.util.xml.converters.
convert_xml_attribute
(stringattribute, possible_types, constants=None, logger=None, list_return=False)[source]¶ Tries to converts a given string attribute to the types given in possible_types. First succeeded conversion will be returned
If no logger is given and a attribute cannot be converted an error is raised
- Parameters
stringattribute – str, Attribute to convert.
possible_types – list of str What types it will try to convert to
constants – dict, of constants defined in fleur input
logger – logger object for logging warnings if given the errors are logged and the list is returned with the unconverted values otherwise a error is raised, when the first conversion fails
list_return – if True, the returned quantity is always a list even if only one element is in it
- Returns
The converted value of the first successful conversion
-
masci_tools.util.xml.converters.
convert_xml_text
(tagtext, possible_definitions, constants=None, logger=None, list_return=False)[source]¶ Tries to converts a given string text based on the definitions (length and type). First succeeded conversion will be returned
- Parameters
tagtext – str, text to convert.
possible_defintions – list of dicts What types it will try to convert to
constants – dict, of constants defined in fleur input
logger – logger object for logging warnings if given the errors are logged and the list is returned with the unconverted values otherwise a error is raised, when the first conversion fails
list_return – if True, the returned quantity is always a list even if only one element is in it
- Returns
The converted value of the first succesful conversion
XML Setter functions¶
Functions for modifying the xml input file of Fleur utilizing the schema dict and as little knowledge of the concrete xpaths as possible
-
masci_tools.util.xml.xml_setters_names.
add_number_to_attrib
(xmltree, schema_dict, attributename, add_number, complex_xpath=None, mode='abs', occurrences=None, **kwargs)[source]¶ Adds a given number to the attribute value in a xmltree specified by the name of the attribute and optional further specification If there are no nodes under the specified xpath an error is raised
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
attributename – the attribute name to change
add_number – number to add/multiply with the old attribute value
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
mode – str (either rel or abs). rel multiplies the old value with add_number abs adds the old value and add_number
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
xmltree with shifted attribute
-
masci_tools.util.xml.xml_setters_names.
add_number_to_first_attrib
(xmltree, schema_dict, attributename, add_number, complex_xpath=None, mode='abs', **kwargs)[source]¶ Adds a given number to the first occurrence of an attribute value in a xmltree specified by the name of the attribute and optional further specification If there are no nodes under the specified xpath an error is raised
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
attributename – the attribute name to change
add_number – number to add/multiply with the old attribute value
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
mode – str (either rel or abs). rel multiplies the old value with add_number abs adds the old value and add_number
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
xmltree with shifted attribute
-
masci_tools.util.xml.xml_setters_names.
create_tag
(xmltree, schema_dict, tag, complex_xpath=None, create_parents=False, occurrences=None, **kwargs)[source]¶ This method creates a tag with a uniquely identified xpath under the nodes of its parent. If there are no nodes evaluated the subtags can be created with create_parents=True
The tag is always inserted in the correct place if a order is enforced by the schema
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag – str of the tag to create or etree Element with the same name to insert
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
create_parents – bool optional (default False), if True and the given xpath has no results the the parent tags are created recursively
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with created tags
-
masci_tools.util.xml.xml_setters_names.
delete_att
(xmltree, schema_dict, attrib_name, complex_xpath=None, occurrences=None, **kwargs)[source]¶ This method deletes a attribute with a uniquely identified xpath.
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag – str of the attribute to delete
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
occurrences – int or list of int. Which occurence of the parent nodes to delete a attribute. By default all nodes are used.
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
xmltree with deleted attributes
-
masci_tools.util.xml.xml_setters_names.
delete_tag
(xmltree, schema_dict, tag_name, complex_xpath=None, occurrences=None, **kwargs)[source]¶ This method deletes a tag with a uniquely identified xpath.
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag – str of the tag to delete
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
occurrences – int or list of int. Which occurence of the parent nodes to delete a tag. By default all nodes are used.
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with deleted tags
-
masci_tools.util.xml.xml_setters_names.
replace_tag
(xmltree, schema_dict, tag_name, newelement, complex_xpath=None, occurrences=None, **kwargs)[source]¶ This method deletes a tag with a uniquely identified xpath.
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag – str of the tag to replace
newelement – etree Element to replace the tag
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
occurrences – int or list of int. Which occurence of the parent nodes to replace a tag. By default all nodes are used.
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with replaced tags
-
masci_tools.util.xml.xml_setters_names.
set_atomgroup
(xmltree, schema_dict, attributedict, position=None, species=None, create=False)[source]¶ Method to set parameters of an atom group of the fleur inp.xml file.
- Parameters
xmltree – xml etree of the inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
attributedict – a python dict specifying what you want to change.
position – position of an atom group to be changed. If equals to ‘all’, all species will be changed
species – atom groups, corresponding to the given species will be changed
create – bool, if species does not exist create it and all subtags?
- Returns
xml etree of the new inp.xml
attributedict is a python dictionary containing dictionaries that specify attributes to be set inside the certain specie. For example, if one wants to set a beta noco parameter it can be done via:
'attributedict': {'nocoParams': {'beta': val}}
-
masci_tools.util.xml.xml_setters_names.
set_atomgroup_label
(xmltree, schema_dict, atom_label, attributedict, create=False)[source]¶ This method calls
set_atomgroup()
method for a certain atom species that corresponds to an atom with a given label.- Parameters
xmltree – xml etree of the inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
atom_label – string, a label of the atom which specie will be changed. ‘all’ to change all the species
attributedict – a python dict specifying what you want to change.
create – bool, if species does not exist create it and all subtags?
- Returns
xml etree of the new inp.xml
attributedict is a python dictionary containing dictionaries that specify attributes to be set inside the certain specie. For example, if one wants to set a beta noco parameter it can be done via:
'attributedict': {'nocoParams': {'beta': val}}
-
masci_tools.util.xml.xml_setters_names.
set_attrib_value
(xmltree, schema_dict, attributename, attribv, complex_xpath=None, occurrences=None, create=False, **kwargs)[source]¶ Sets an attribute in a xmltree to a given value, specified by its name and further specifications. If there are no nodes under the specified xpath a tag can be created with create=True. The attribute values are converted automatically according to the types of the attribute with
convert_attribute_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
attributename – the attribute name to set
attribv – value or list of values to set
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
create – bool optional (default False), if True the tag is created if is missing
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
xmltree with set attribute
-
masci_tools.util.xml.xml_setters_names.
set_complex_tag
(xmltree, schema_dict, tag_name, changes, complex_xpath=None, create=False, **kwargs)[source]¶ Function to correctly set tags/attributes for a given tag. Goes through the attributedict and decides based on the schema_dict, how the corresponding key has to be handled. The tag is specified via its name and evtl. further specification
Supports:
attributes
tags with text only
simple tags, i.e. only attributes (can be optional single/multiple)
complex tags, will recursively create/modify them
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag_name – name of the tag to set
attributedict – Keys in the dictionary correspond to names of tags and the values are the modifications to do on this tag (attributename, subdict with changes to the subtag, …)
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
create – bool optional (default False), if True and the path, where the complex tag is set does not exist it is created
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with changes to the complex tag
-
masci_tools.util.xml.xml_setters_names.
set_first_attrib_value
(xmltree, schema_dict, attributename, attribv, complex_xpath=None, create=False, **kwargs)[source]¶ Sets the first occurrence of an attribute in a xmltree to a given value, specified by its name and further specifications. If there are no nodes under the specified xpath a tag can be created with create=True. The attribute values are converted automatically according to the types of the attribute with
convert_attribute_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
attributename – the attribute name to set
attribv – value or list of values to set
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
create – bool optional (default False), if True the tag is created if is missing
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
xmltree with set attribute
-
masci_tools.util.xml.xml_setters_names.
set_first_text
(xmltree, schema_dict, attributename, attribv, complex_xpath=None, create=False, **kwargs)[source]¶ Sets the text the first occurrence of a tag in a xmltree to a given value, specified by the name of the tag and further specifications. By default the text will be set on all nodes returned for the specified xpath. If there are no nodes under the specified xpath a tag can be created with create=True. The text values are converted automatically according to the types with
convert_text_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag_name – str name of the tag, where the text should be set
text – value or list of values to set
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
create – bool optional (default False), if True the tag is created if is missing
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with set text
-
masci_tools.util.xml.xml_setters_names.
set_inpchanges
(xmltree, schema_dict, change_dict, path_spec=None)[source]¶ This method sets all the attribute and texts provided in the change_dict.
The first occurrence of the attribute/tag is set
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
path_spec – dict, with ggf. necessary further specifications for the path of the attribute
- Params change_dict
dictionary {attrib_name : value} with all the wanted changes.
An example of change_dict:
change_dict = {'itmax' : 1, 'l_noco': True, 'ctail': False, 'l_ss': True}
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_kpath
(xmltree, schema_dict, kpath, count, gamma=False)[source]¶ Sets a k-path directly into inp.xml as a alternative kpoint set with purpose ‘bands’
Warning
This method is only supported for input versions before the Max5 release
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
kpath – a dictionary with kpoint name as key and k point coordinate as value
count – number of k-points
gamma – bool that controls if the gamma-point should be included in the k-point mesh
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_kpath_max4
(xmltree, schema_dict, kpath, count, gamma=False)[source]¶ Sets a k-path directly into inp.xml as a alternative kpoint set with purpose ‘bands’
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
kpath – a dictionary with kpoint name as key and k point coordinate as value
count – number of k-points
gamma – bool that controls if the gamma-point should be included in the k-point mesh
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_kpointlist
(xmltree, schema_dict, kpoints, weights, name=None, kpoint_type='path', special_labels=None, switch=False, overwrite=False)[source]¶ Explicitely create a kPointList from the given kpoints and weights. This routine will add the specified kPointList with the given name.
Warning
For input versions Max4 and older all keyword arguments are not valid (name, kpoint_type, special_labels, switch and overwrite)
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
kpoints – list or array containing the relative coordinates of the kpoints
weights – list or array containing the weights of the kpoints
name – str for the name of the list, if not given a default name is generated
kpoint_type – str specifying the type of the kPointList (‘path’, ‘mesh’, ‘spex’, ‘tria’, …)
special_labels – dict mapping indices to labels. The labels will be inserted for the kpoints corresponding to the given index
switch – bool, if True the kPointlist will be used by Fleur when starting the next calculation
overwrite – bool, if True and a kPointlist with the given name already exists it will be overwritten
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_kpointlist_max4
(xmltree, schema_dict, kpoints, weights)[source]¶ Explicitely create a kPointList from the given kpoints and weights. This routine is specific to input versions Max4 and before and will replace any existing kPointCount, kPointMesh, … with the specified kPointList
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
kpoints – list or array containing the relative coordinates of the kpoints
weights – list or array containing the weights of the kpoints
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_nkpts
(xmltree, schema_dict, count, gamma=False)[source]¶ Sets a k-point mesh directly into inp.xml
Warning
This method is only supported for input versions before the Max5 release
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
count – number of k-points
gamma – bool that controls if the gamma-point should be included in the k-point mesh
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_nkpts_max4
(xmltree, schema_dict, count, gamma=False)[source]¶ Sets a k-point mesh directly into inp.xml specific for inputs of version Max4
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
count – number of k-points
gamma – bool that controls if the gamma-point should be included in the k-point mesh
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
set_simple_tag
(xmltree, schema_dict, tag_name, changes, complex_xpath=None, create_parents=False, **kwargs)[source]¶ Sets one or multiple simple tag(s) in an xmltree. A simple tag can only hold attributes and has no subtags. The tag is specified by its name and further specification If the tag can occur multiple times all existing tags are DELETED and new ones are written. If the tag only occurs once it will automatically be created if its missing.
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag_name – str name of the tag to modify/set
changes – list of dicts or dict with the changes. Elements in list describe multiple tags. Keys in the dictionary correspond to {‘attributename’: attributevalue}
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
create_parents – bool optional (default False), if True and the path, where the simple tags are set does not exist it is created
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with set simple tags
-
masci_tools.util.xml.xml_setters_names.
set_species
(xmltree, schema_dict, species_name, attributedict, create=False)[source]¶ Method to set parameters of a species tag of the fleur inp.xml file.
- Parameters
xmltree – xml etree of the inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
species_name – string, name of the specie you want to change Can be name of the species, ‘all’ or ‘all-<string>’ (sets species with the string in the species name)
attributedict – a python dict specifying what you want to change.
create – bool, if species does not exist create it and all subtags?
- Raises
ValueError – if species name is non existent in inp.xml and should not be created. also if other given tags are garbage. (errors from eval_xpath() methods)
- Return xmltree
xml etree of the new inp.xml
attributedict is a python dictionary containing dictionaries that specify attributes to be set inside the certain specie. For example, if one wants to set a MT radius it can be done via:
attributedict = {'mtSphere' : {'radius' : 2.2}}
Another example:
'attributedict': {'special': {'socscale': 0.0}}
that switches SOC terms on a sertain specie.
mtSphere
,atomicCutoffs
,energyParameters
,lo
,electronConfig
,nocoParams
,ldaU
andspecial
keys are supported. To find possible keys of the inner dictionary please refer to the FLEUR documentation flapw.de
-
masci_tools.util.xml.xml_setters_names.
set_species_label
(xmltree, schema_dict, atom_label, attributedict, create=False)[source]¶ This method calls
set_species()
method for a certain atom species that corresponds to an atom with a given label- Parameters
xmltree – xml etree of the inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
atom_label – string, a label of the atom which specie will be changed. ‘all’ to change all the species
attributedict – a python dict specifying what you want to change.
create – bool, if species does not exist create it and all subtags?
- Returns
xml etree of the new inp.xml
-
masci_tools.util.xml.xml_setters_names.
set_text
(xmltree, schema_dict, tag_name, text, complex_xpath=None, occurrences=None, create=False, **kwargs)[source]¶ Sets the text on tags in a xmltree to a given value, specified by the name of the tag and further specifications. By default the text will be set on all nodes returned for the specified xpath. If there are no nodes under the specified xpath a tag can be created with create=True. The text values are converted automatically according to the types with
convert_text_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
tag_name – str name of the tag, where the text should be set
text – value or list of values to set
complex_xpath – an optional xpath to use instead of the simple xpath for the evaluation
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
create – bool optional (default False), if True the tag is created if is missing
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xmltree with set text
-
masci_tools.util.xml.xml_setters_names.
shift_value
(xmltree, schema_dict, change_dict, mode='abs', path_spec=None)[source]¶ Shifts numerical values of attributes directly in the inp.xml file.
The first occurrence of the attribute is shifted
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
change_dict – a python dictionary with the keys to shift and the shift values.
mode – ‘abs’ if change given is absolute, ‘rel’ if relative
path_spec – dict, with ggf. necessary further specifications for the path of the attribute
- Returns
a xml tree with shifted values
An example of change_dict:
change_dict = {'itmax' : 1, 'dVac': -0.123}
-
masci_tools.util.xml.xml_setters_names.
shift_value_species_label
(xmltree, schema_dict, atom_label, attributename, value_given, mode='abs', **kwargs)[source]¶ Shifts the value of an attribute on a species by label if atom_label contains ‘all’ then applies to all species
- Parameters
xmltree – xml etree of the inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
atom_label – string, a label of the atom which specie will be changed. ‘all’ if set up all species
attributename – name of the attribute to change
value_given – value to add or to multiply by
mode – ‘rel’ for multiplication or ‘abs’ for addition
- Kwargs if the attributename does not correspond to a unique path:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
xml etree of the new inp.xml
-
masci_tools.util.xml.xml_setters_names.
switch_kpointset
(xmltree, schema_dict, list_name)[source]¶ Switch the used k-point set
Warning
This method is only supported for input versions after the Max5 release
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
list_name – name of the kPoint set to use
- Returns
an xmltree of the inp.xml file with changes.
-
masci_tools.util.xml.xml_setters_names.
switch_kpointset_max4
(xmltree, schema_dict, list_name)[source]¶ Sets a k-point mesh directly into inp.xml specific for inputs of version Max4
Warning
This method is only supported for input versions after the Max5 release
- Parameters
xmltree – xml tree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
list_name – name of the kPoint set to use
- Returns
an xmltree of the inp.xml file with changes.
This module contains useful methods for initializing or modifying a n_mmp_mat file for LDA+U
-
masci_tools.util.xml.xml_setters_nmmpmat.
rotate_nmmpmat
(xmltree, nmmplines, schema_dict, species_name, orbital, phi, theta)[source]¶ Rotate the density matrix with the given angles phi and theta
- Parameters
xmltree – an xmltree that represents inp.xml
nmmplines – list of lines in the n_mmp_mat file
schema_dict – InputSchemaDict containing all information about the structure of the input
species_name – string, name of the species you want to change
orbital – integer, orbital quantum number of the LDA+U procedure to be modified
phi – float, angle (radian), by which to rotate the density matrix
theta – float, angle (radian), by which to rotate the density matrix
- Raises
ValueError – If something in the input is wrong
KeyError – If no LDA+U procedure is found on a species
- Returns
list with modified nmmplines
-
masci_tools.util.xml.xml_setters_nmmpmat.
set_nmmpmat
(xmltree, nmmplines, schema_dict, species_name, orbital, spin, state_occupations=None, orbital_occupations=None, denmat=None, phi=None, theta=None)[source]¶ Routine sets the block in the n_mmp_mat file specified by species_name, orbital and spin to the desired density matrix
- Parameters
xmltree – an xmltree that represents inp.xml
nmmplines – list of lines in the n_mmp_mat file
schema_dict – InputSchemaDict containing all information about the structure of the input
species_name – string, name of the species you want to change
orbital – integer, orbital quantum number of the LDA+U procedure to be modified
spin – integer, specifies which spin block should be modified
state_occupations – list, sets the diagonal elements of the density matrix and everything else to zero
denmat – matrix, specify the density matrix explicitely
phi – float, optional angle (radian), by which to rotate the density matrix before writing it
theta – float, optional angle (radian), by which to rotate the density matrix before writing it
- Raises
ValueError – If something in the input is wrong
KeyError – If no LDA+U procedure is found on a species
- Returns
list with modified nmmplines
-
masci_tools.util.xml.xml_setters_nmmpmat.
validate_nmmpmat
(xmltree, nmmplines, schema_dict)[source]¶ Checks that the given nmmp_lines is valid with the given xmltree
Checks that the number of blocks is as expected from the inp.xml and each block does not contain non-zero elements outside their size given by the orbital quantum number in the inp.xml. Additionally the occupations, i.e. diagonal elements are checked that they are in between 0 and the maximum possible occupation
- Parameters
xmltree – an xmltree that represents inp.xml
nmmplines – list of lines in the n_mmp_mat file
- Raises
ValueError – if any of the above checks are violated.
Functions for modifying the xml input file of Fleur with explicit xpath arguments These can still use the schema dict for finding information about the xpath
-
masci_tools.util.xml.xml_setters_xpaths.
eval_xpath_create
(xmltree, schema_dict, xpath, base_xpath, create_parents=False, occurrences=None, list_return=False)[source]¶ Evaluates and xpath and creates tag if the result is empty
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to place a new tag
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
create_parents – bool optional (default False), if True also the parents of the tag are created if they are missing
occurrences – int or list of int. Which occurence of the parent nodes to create a tag if the tag is missing. By default all nodes are used.
list_return – if True, the returned quantity is always a list even if only one element is in it
- Returns
list of nodes from the result of the xpath expression
-
masci_tools.util.xml.xml_setters_xpaths.
xml_add_number_to_attrib
(xmltree, schema_dict, xpath, base_xpath, attributename, add_number, mode='abs', occurrences=None)[source]¶ Adds a given number to the attribute value in a xmltree. By default the attribute will be shifted on all nodes returned for the specified xpath. If there are no nodes under the specified xpath an error is raised
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attributes
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
attributename – the attribute name to change
add_number – number to add/multiply with the old attribute value
mode – str (either rel or abs). rel multiplies the old value with add_number abs adds the old value and add_number
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
- Raises
ValueError – If the attribute is unknown or cannot be float or int
ValueError – If the evaluation of the old values failed
ValueError – If a float result is written to a integer attribute
- Returns
xmltree with shifted attribute
-
masci_tools.util.xml.xml_setters_xpaths.
xml_add_number_to_first_attrib
(xmltree, schema_dict, xpath, base_xpath, attributename, add_number, mode='abs')[source]¶ Adds a given number to the first occurrence of a attribute value in a xmltree. If there are no nodes under the specified xpath an error is raised
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attributes
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
attributename – the attribute name to change
add_number – number to add/multiply with the old attribute value
mode – str (either rel or abs). rel multiplies the old value with add_number abs adds the old value and add_number
- Raises
ValueError – If the attribute is unknown or cannot be float or int
ValueError – If the evaluation of the old values failed
ValueError – If a float result is written to a integer attribute
- Returns
xmltree with shifted attribute
-
masci_tools.util.xml.xml_setters_xpaths.
xml_create_tag_schema_dict
(xmltree, schema_dict, xpath, base_xpath, element, create_parents=False, occurrences=None)[source]¶ This method evaluates an xpath expression and creates a tag in a xmltree under the returned nodes. If there are no nodes evaluated the subtags can be created with create_parents=True
The tag is always inserted in the correct place if a order is enforced by the schema
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to place a new tag
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
element – a tag name or etree Element to be created
create_parents – bool optional (default False), if True and the given xpath has no results the the parent tags are created recursively
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
- Raises
ValueError – If the nodes are missing and create_parents=False
- Returns
xmltree with created tags
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_attrib_value
(xmltree, schema_dict, xpath, base_xpath, attributename, attribv, occurrences=None, create=False)[source]¶ Sets an attribute in a xmltree to a given value. By default the attribute will be set on all nodes returned for the specified xpath. If there are no nodes under the specified xpath a tag can be created with create=True. The attribute values are converted automatically according to the types of the attribute with
convert_attribute_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attributes
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
attributename – the attribute name to set
attribv – value or list of values to set
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
create – bool optional (default False), if True the tag is created if is missing
- Raises
ValueError – If the conversion to string failed
ValueError – If the tag is missing and create=False
ValueError – If the attributename is not allowed on the base_xpath
- Returns
xmltree with set attribute
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_complex_tag
(xmltree, schema_dict, xpath, base_xpath, attributedict, create=False)[source]¶ Recursive Function to correctly set tags/attributes for a given tag. Goes through the attributedict and decides based on the schema_dict, how the corresponding key has to be handled.
Supports:
attributes
tags with text only
simple tags, i.e. only attributes (can be optional single/multiple)
complex tags, will recursively create/modify them
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attributes
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
tag_name – name of the tag to set
attributedict – Keys in the dictionary correspond to names of tags and the values are the modifications to do on this tag (attributename, subdict with changes to the subtag, …)
create – bool optional (default False), if True and the path, where the complex tag is set does not exist it is created
- Returns
xmltree with changes to the complex tag
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_first_attrib_value
(xmltree, schema_dict, xpath, base_xpath, attributename, attribv, create=False)[source]¶ Sets the first occurrence attribute in a xmltree to a given value. If there are no nodes under the specified xpath a tag can be created with create=True. The attribute values are converted automatically according to the types of the attribute with
convert_attribute_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attribute
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
attributename – the attribute name to set
attribv – value or list of values to set
create – bool optional (default False), if True the tag is created if is missing
- Raises
ValueError – If the conversion to string failed
ValueError – If the tag is missing and create=False
ValueError – If the attributename is not allowed on the base_xpath
- Returns
xmltree with set attribute
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_first_text
(xmltree, schema_dict, xpath, base_xpath, text, create=False)[source]¶ Sets the text on the first occurrence of a tag in a xmltree to a given value. If there are no nodes under the specified xpath a tag can be created with create=True. The text values are converted automatically according to the types with
convert_text_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the text
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
text – value or list of values to set
create – bool optional (default False), if True the tag is created if is missing
- Raises
ValueError – If the conversion to string failed
ValueError – If the tag is missing and create=False
- Returns
xmltree with set text
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_simple_tag
(xmltree, schema_dict, xpath, base_xpath, tag_name, changes, create_parents=False)[source]¶ Sets one or multiple simple tag(s) in an xmltree. A simple tag can only hold attributes and has no subtags. If the tag can occur multiple times all existing tags are DELETED and new ones are written. If the tag only occurs once it will automatically be created if its missing.
- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the attributes
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
tag_name – name of the tag to set
changes – list of dicts or dict with the changes. Elements in list describe multiple tags. Keys in the dictionary correspond to {‘attributename’: attributevalue}
create_parents – bool optional (default False), if True and the path, where the simple tags are set does not exist it is created
- Returns
xmltree with set simple tags
-
masci_tools.util.xml.xml_setters_xpaths.
xml_set_text
(xmltree, schema_dict, xpath, base_xpath, text, occurrences=None, create=False)[source]¶ Sets the text on tags in a xmltree to a given value. By default the text will be set on all nodes returned for the specified xpath. If there are no nodes under the specified xpath a tag can be created with create=True. The text values are converted automatically according to the types with
convert_text_to_xml()
if they are not str already.- Parameters
xmltree – an xmltree that represents inp.xml
schema_dict – InputSchemaDict containing all information about the structure of the input
xpath – a path where to set the text
base_xpath – path where to place a new tag without complex syntax ([] conditions and so on)
text – value or list of values to set
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
create – bool optional (default False), if True the tag is created if is missing
- Raises
ValueError – If the conversion to string failed
ValueError – If the tag is missing and create=False
- Returns
xmltree with set text
Basic functions for modifying the xml input file of Fleur. These functions DO NOT
have the ability to create missing tags on the fly. This functionality is added on top
in xml_setters_xpaths
since we need the schema dictionary
to do these operations robustly
-
masci_tools.util.xml.xml_setters_basic.
xml_create_tag
(xmltree, xpath, element, place_index=None, tag_order=None, occurrences=None, correct_order=True, several=True)[source]¶ This method evaluates an xpath expression and creates a tag in a xmltree under the returned nodes. If there are no nodes under the specified xpath an error is raised.
The tag is appended by default, but can be inserted at a certain index (place_index) or can be inserted according to a given order of tags
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path where to place a new tag
element – a tag name or etree Element to be created
place_index – defines the place where to put a created tag
tag_order – defines a tag order
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
correct_order – bool, if True (default) and a tag_order is given, that does not correspond to the given order in the xmltree (only order wrong no unknown tags) it will be corrected and a warning is given This is necessary for some edge cases of the xml schemas of fleur
several – bool, if True multiple tags od the given name are allowed
- Raises
ValueError – If the insertion failed in any way (tag_order does not match, failed to insert, …)
- Returns
xmltree with created tags
-
masci_tools.util.xml.xml_setters_basic.
xml_delete_att
(xmltree, xpath, attrib, occurrences=None)[source]¶ Deletes an xml attribute in an xmletree.
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path to the attribute to be deleted
attrib – the name of an attribute
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
- Returns
xmltree with deleted attribute
-
masci_tools.util.xml.xml_setters_basic.
xml_delete_tag
(xmltree, xpath, occurrences=None)[source]¶ Deletes a xml tag in an xmletree.
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path to the tag to be deleted
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
- Returns
xmltree with deleted tag
-
masci_tools.util.xml.xml_setters_basic.
xml_replace_tag
(xmltree, xpath, newelement, occurrences=None)[source]¶ replaces xml tags by another tag on an xmletree in place
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path to the tag to be replaced
newelement – a new tag
occurrences – int or list of int. Which occurence of the parent nodes to create a tag. By default all nodes are used.
- Returns
xmltree with replaced tag
-
masci_tools.util.xml.xml_setters_basic.
xml_set_attrib_value_no_create
(xmltree, xpath, attributename, attribv, occurrences=None)[source]¶ Sets an attribute in a xmltree to a given value. By default the attribute will be set on all nodes returned for the specified xpath.
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path where to set the attributes
attributename – the attribute name to set
attribv – value or list of values to set (if not str they will be converted with str(value))
occurrences – int or list of int. Which occurence of the node to set. By default all are set.
- Raises
ValueError – If the lengths of attribv or occurrences do not match number of nodes
- Returns
xmltree with set attribute
-
masci_tools.util.xml.xml_setters_basic.
xml_set_text_no_create
(xmltree, xpath, text, occurrences=None)[source]¶ Sets the text of a tag in a xmltree to a given value. By default the text will be set on all nodes returned for the specified xpath.
- Parameters
xmltree – an xmltree that represents inp.xml
xpath – a path where to set the text
text – value or list of values to set (if not str they will be converted with str(value))
occurrences – int or list of int. Which occurrence of the node to set. By default all are set.
- Raises
ValueError – If the lengths of text or occurrences do not match number of nodes
- Returns
xmltree with set text
XML Getter functions¶
This module provides functions to extract distinct parts of the fleur xml files for easy versioning and reuse
-
masci_tools.util.xml.xml_getters.
get_cell
(xmltree, schema_dict, logger=None)[source]¶ Get the Bravais matrix from the given fleur xml file. In addition a list determining in, which directions there are periodic boundary conditions in the system.
Warning
Only the explicit definition of the Bravais matrix is supported. Old inputs containing the latnam definitions are not supported
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
numpy array of the bravais matrix and list of boolean values for periodic boundary conditions
-
masci_tools.util.xml.xml_getters.
get_fleur_modes
(xmltree, schema_dict, logger=None)[source]¶ Determine the calculation modes of fleur for the given xml file. Calculation modes are things that change the produced files or output in the out.xml files
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
dictionary with all the extracted calculation modes
The following modes are inspected:
jspin: How many spins are considered in the calculation
noco: Is the calculation non-collinear?
soc: Is spin-orbit coupling included?
relax: Is the calculation a structure relaxation?
gw: Special mode for GW/Spex calculations
force_theorem: Is a Force theorem calculation performed?
film: Is the structure a film system
ldau: Is LDA+U included?
dos: Is it a density of states calculation?
band: Is it a bandstructure calculation?
bz_integration: How is the integration over the Brillouin-Zone performed?
-
masci_tools.util.xml.xml_getters.
get_kpoints_data
(xmltree, schema_dict, name=None, logger=None)[source]¶ Get the kpoint sets defined in the given fleur xml file.
Warning
For file versions before Max5 the name argument is not valid
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
name – str, optional, if given only the kpoint set with the given name is returned
logger – logger object for logging warnings, errors
- Returns
tuple containing the kpoint information
The tuple contains the following entries:
- kpoints
dict or list (list if there is only one kpoint set), containing the coordinates of the kpoints
- weights
dict or list (list if there is only one kpoint set), containing the weights of the kpoints
- cell
numpy array, bravais matrix of the given system
- pbc
list of booleans, determines in which directions periodic boundary conditions are applicable
-
masci_tools.util.xml.xml_getters.
get_kpoints_data_max4
(xmltree, schema_dict, logger=None)[source]¶ Get the kpoint sets defined in the given fleur xml file.
Note
This function is specific to file version before and including the Max4 release of fleur
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
tuple containing the kpoint information
The tuple contains the following entries:
- kpoints
list containing the coordinates of the kpoints
- weights
list containing the weights of the kpoints
- cell
numpy array, bravais matrix of the given system
- pbc
list of booleans, determines in which directions periodic boundary conditions are applicable
-
masci_tools.util.xml.xml_getters.
get_nkpts
(xmltree, schema_dict, logger=None)[source]¶ Get the number of kpoints that will be used in the calculation specified in the given fleur XMl file.
Warning
For file versions before Max5 only kPointList or kPointCount tags will work. However, for kPointCount there is no real guarantee that for every occasion it will correspond to the number of kpoints. So a warning is written out
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
int with the number of kpoints
-
masci_tools.util.xml.xml_getters.
get_nkpts_max4
(xmltree, schema_dict, logger=None)[source]¶ Get the number of kpoints that will be used in the calculation specified in the given fleur XMl file. Version specific for Max4 versions or older
Warning
For file versions before Max5 only kPointList or kPointCount tags will work. However, for kPointCount there is no real guarantee that for every occasion it will correspond to the number of kpoints. So a warning is written out
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
int with the number of kpoints
-
masci_tools.util.xml.xml_getters.
get_parameter_data
(xmltree, schema_dict, inpgen_ready=True, write_ids=True, logger=None)[source]¶ This routine returns an python dictionary produced from the inp.xml file, which contains all the parameters needed to setup a new inp.xml from a inpgen input file to produce the same input (for parameters that the inpgen can control)
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
inpgen_ready – Bool, return a dict which can be inputed into inpgen while setting atoms
write_ids – Bool, if True the atom ids are added to the atom namelists
logger – logger object for logging warnings, errors
- Returns
dict, which will lead to the same inp.xml (in case if other defaults, which can not be controlled by input for inpgen, were changed)
-
masci_tools.util.xml.xml_getters.
get_relaxation_information
(xmltree, schema_dict, logger=None)[source]¶ Get the relaxation information from the given fleur XML file. This includes the current displacements, energy and posforce evolution
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
dict with the relaxation information
- Raises
ValueError – If no relaxation section is included in the xml tree
-
masci_tools.util.xml.xml_getters.
get_relaxation_information_pre029
(xmltree, schema_dict, logger=None)[source]¶ Get the relaxation information from the given fleur XML file. This includes the current displacements, energy and posforce evolution
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
dict with the relaxation information
- Raises
ValueError – If no relaxation section is included in the xml tree
-
masci_tools.util.xml.xml_getters.
get_structure_data
(xmltree, schema_dict, logger=None)[source]¶ Get the structure defined in the given fleur xml file.
Warning
Only the explicit definition of the Bravais matrix is supported. Old inputs containing the latnam definitions are not supported
- Parameters
xmltree – etree representing the fleur xml file
schema_dict – schema dictionary corresponding to the file version of the xmltree
logger – logger object for logging warnings, errors
- Returns
tuple containing the structure information
The tuple contains the following entries:
- atom_data
list of tuples containing the absolute positions and symbols of the atoms
- cell
numpy array, bravais matrix of the given system
- pbc
list of booleans, determines in which directions periodic boundary conditions are applicable
Basic IO helper functions¶
Here commonly used functions that do not need aiida-stuff (i.e. can be tested without a database) are collected.
-
masci_tools.io.common_functions.
abs_to_rel
(vector, cell)[source]¶ Converts a position vector in absolute coordinates to relative coordinates.
- Parameters
vector – list or np.array of length 3, vector to be converted
cell – Bravais matrix of a crystal 3x3 Array, List of list or np.array
- Returns
list of length 3 of scaled vector, or False if vector was not length 3
-
masci_tools.io.common_functions.
abs_to_rel_f
(vector, cell, pbc)[source]¶ Converts a position vector in absolute coordinates to relative coordinates for a film system.
- Parameters
vector – list or np.array of length 3, vector to be converted
cell – Bravais matrix of a crystal 3x3 Array, List of list or np.array
pbc – Boundary conditions, List or Tuple of 3 Boolean
- Returns
list of length 3 of scaled vector, or False if vector was not length 3
-
masci_tools.io.common_functions.
angles_to_vec
(magnitude, theta, phi)[source]¶ convert (magnitude, theta, phi) to (x,y,z)
theta/phi need to be in radians!
Input can be single number, list of numpy.ndarray data Returns x,y,z vector
-
masci_tools.io.common_functions.
camel_to_snake
(name)[source]¶ Converts camelCase to snake_case variable names Used in the Fleur parser to convert attribute names from the xml files
-
masci_tools.io.common_functions.
convert_to_fortran
(val, quote_strings=True)[source]¶ - Parameters
val – the value to be read and converted to a Fortran-friendly string.
-
masci_tools.io.common_functions.
convert_to_fortran_string
(string)[source]¶ converts some parameter strings to the format for the inpgen :param string: some string :returns: string in right format (extra “”)
-
masci_tools.io.common_functions.
convert_to_pystd
(value)[source]¶ Recursively convert numpy datatypes to standard python, needed by aiida-core.
- Usage:
converted = convert_to_pystd(to_convert)
where to_convert can be a dict, array, list, or single valued variable
-
masci_tools.io.common_functions.
filter_out_empty_dict_entries
(dict_to_filter)[source]¶ Filter out entries in a given dict that correspond to empty values. At the moment this is empty lists, dicts and None
- Parameters
dict_to_filter – dict to filter
- Returns
dict without empty entries
-
masci_tools.io.common_functions.
get_corestates_from_potential
(potfile='potential')[source]¶ Read core states from potential file
-
masci_tools.io.common_functions.
get_ef_from_potfile
(potfile)[source]¶ extract fermi energy from potfile
-
masci_tools.io.common_functions.
get_highest_core_state
(nstates, energies, lmoments)[source]¶ Find highest lying core state from list of core states, needed to find and check energy contour
-
masci_tools.io.common_functions.
get_wigner_matrix
(l, phi, theta)[source]¶ Produces the wigner rotation matrix for the density matrix
- Parameters
l – int, orbital quantum number
phi – float, angle (radian) corresponds to euler angle alpha
theta – float, angle (radian) corresponds to euler angle beta
-
masci_tools.io.common_functions.
interpolate_dos
(dosfile, return_original=False)[source]¶ interpolation function copied from complexdos3 fortran code
Principle of DOS here: Two-point contour integration for DOS in the middle of the two points. The input DOS and energy must be complex. Parameter deltae should be of the order of magnitude of eim:
<-2*deltae-> _ /\ | DOS=(n(1)+n(2))/2 + (n(1)-n(2))*eim/deltae / \ | (1) (2) 2*i*eim=2*i*pi*Kb*Tk / \ | / \ | ------------------------ (Real E axis)
- Parameters
input – either absolute path of ‘complex.dos’ file or file handle to it
- Returns
E_Fermi, numpy array of interpolated dos
- Note
output units are in Ry!
-
masci_tools.io.common_functions.
open_general
(filename_or_handle, iomode=None)[source]¶ Open a file directly from a path or use a file handle if that is given. Also take care of closed files by reopenning them. This is intended to be used like this:
f = open_general(outfile) with f: # make sure the file is properly closed txt = f.readlines()
-
masci_tools.io.common_functions.
rel_to_abs
(vector, cell)[source]¶ Converts a position vector in internal coordinates to absolute coordinates in Angstrom.
- Parameters
vector – list or np.array of length 3, vector to be converted
cell – Bravais matrix of a crystal 3x3 Array, List of list or np.array
- Returns
list of legth 3 of scaled vector, or False if vector was not lenth 3
-
masci_tools.io.common_functions.
rel_to_abs_f
(vector, cell)[source]¶ Converts a position vector in internal coordinates to absolute coordinates in Angstrom for a film structure (2D).
-
masci_tools.io.common_functions.
skipHeader
(seq, n)[source]¶ Iterate over a sequence skipping the first n elements
- Args:
seq (iterable): Iterable sequence n (int): Number of Elements to skip in the beginning of the sequence
- Yields:
item: Elements in seq after the first n elements
-
masci_tools.io.common_functions.
vec_to_angles
(vec)[source]¶ converts vector (x,y,z) to (magnitude, theta, phi)
Small utility functions for inspecting hdf files and converting the complete file structure into a python dictionary
-
masci_tools.io.hdf5_util.
h5dump
(file, group='/')[source]¶ Shows the overall filestructure of an hdf file Goes through all groups and subgroups and prints the attributes or the shape and datatype of the datasets
- Parameters
filepath – path to the hdf file
-
masci_tools.io.hdf5_util.
hdfList
(name, obj)[source]¶ Print the name of the current object (indented to create a nice tree structure)
Also prints attribute values and dataset shapes and datatypes
-
masci_tools.io.hdf5_util.
read_groups
(hdfdata, flatten=False)[source]¶ Recursive function to read a hdf datastructure and extract the datasets and attributes
- Parameters
hdfdata – current hdf group to process
flatten – bool, if True the dictionary will be flattened (does not check for lost information)
- Returns
two dictionaries, one with the datasets the other with the attributes in the file
-
masci_tools.io.hdf5_util.
read_hdf_simple
(file, flatten=False)[source]¶ Reads in an hdf file and returns its context in a nested dictionary
- Parameters
filepath – path or filehandle to the hdf file
flatten – bool, if True the dictionary will be flattened (does not check for lost information)
- Returns
two dictionaries, one with the datasets the other with the attributes in the file
Non unique group attribute or dataset names will be overwritten in the return dict
Logging Utility¶
This module defines useful utility for logging related functionality
-
class
masci_tools.util.logging_util.
DictHandler
(log_dict, ignore_unknown_levels=False, **kwargs)[source]¶ Custom Handler for the logging module inserting logging messages into a given dictionary.
Messages are grouped into list under the names of the error categories. Keyword arguments can be used to modify the keys for the different levels
-
class
masci_tools.util.logging_util.
OutParserLogAdapter
(logger, extra)[source]¶ This adapter expects the passed in dict-like object to have a ‘iteration’ key, whose value is prepended as [Iteration i] to the message
-
process
(msg, kwargs)[source]¶ Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.
Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.
-
Fleur parser utility¶
This module contains helper functions for extracting information easily from the schema_dicts defined for the Fleur input/output
Also provides convienient functions to use just a attribute name for extracting the attribute from the right place in the given etree
-
masci_tools.util.schema_dict_util.
attrib_exists
(node, schema_dict, name, logger=None, **kwargs)[source]¶ Evaluates whether the attribute exists in the xmltree based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- Returns
bool, True if any tag with the attribute exists
-
masci_tools.util.schema_dict_util.
eval_simple_xpath
(node, schema_dict, name, logger=None, **kwargs)[source]¶ Evaluates a simple xpath expression of the tag in the xmltree based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param list_return
bool, if True a list is always returned
- Returns
etree Elements obtained via the simple xpath expression
-
masci_tools.util.schema_dict_util.
evaluate_attribute
(node, schema_dict, name, constants=None, logger=None, **kwargs)[source]¶ Evaluates the value of the attribute based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the attribute
constants – dict, contains the defined constants
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param tag_name
str, name of the tag where the attribute should be parsed
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param exclude
list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
- param list_return
if True, the returned quantity is always a list even if only one element is in it
- param optional
bool, if True and no logger given none or an empty list is returned
- Returns
list or single value, converted in convert_xml_attribute
-
masci_tools.util.schema_dict_util.
evaluate_parent_tag
(node, schema_dict, name, constants=None, logger=None, **kwargs)[source]¶ Evaluates all attributes of the parent tag based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
constants – dict, contains the defined constants
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param only_required
bool (optional, default False), if True only required attributes are parsed
- param ignore
list of str (optional), attributes not to parse
- param list_return
if True, the returned quantity is always a list even if only one element is in it
- param strict_missing_error
if True, and no logger is given an error is raised if any attribute is not found
- Returns
dict, with attribute values converted via convert_xml_attribute
-
masci_tools.util.schema_dict_util.
evaluate_single_value_tag
(node, schema_dict, name, constants=None, logger=None, **kwargs)[source]¶ Evaluates the value and unit attribute of the tag based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
constants – dict, contains the defined constants
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param only_required
bool (optional, default False), if True only required attributes are parsed
- param ignore
list of str (optional), attributes not to parse
- param list_return
if True, the returned quantity is always a list even if only one element is in it
- param strict_missing_error
if True, and no logger is given an error is raised if any attribute is not found
- Returns
value and unit, both converted in convert_xml_attribute
-
masci_tools.util.schema_dict_util.
evaluate_tag
(node, schema_dict, name, constants=None, logger=None, **kwargs)[source]¶ Evaluates all attributes of the tag based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
constants – dict, contains the defined constants
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param only_required
bool (optional, default False), if True only required attributes are parsed
- param ignore
list of str (optional), attributes not to parse
- param list_return
if True, the returned quantity is always a list even if only one element is in it
- param strict_missing_error
if True, and no logger is given an error is raised if any attribute is not found
- Returns
dict, with attribute values converted via convert_xml_attribute
-
masci_tools.util.schema_dict_util.
evaluate_text
(node, schema_dict, name, constants, logger=None, **kwargs)[source]¶ Evaluates the text of the tag based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
constants – dict, contains the defined constants
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- param list_return
if True, the returned quantity is always a list even if only one element is in it
- param optional
bool, if True and no logger given none or an empty list is returned
- Returns
list or single value, converted in convert_xml_text
-
masci_tools.util.schema_dict_util.
get_attrib_xpath
(schema_dict, name, contains=None, not_contains=None, exclude=None, tag_name=None)[source]¶ Tries to find a unique path from the schema_dict based on the given name of the attribute and additional further specifications
- Parameters
schema_dict – dict, containing all the path information and more
name – str, name of the attribute
root_tag – str, name of the tag from which the path should be relative
contains – str or list of str, this string has to be in the final path
not_contains – str or list of str, this string has to NOT be in the final path
exclude – list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
tag_name – str, if given this name will be used to find a path to a tag with the same name in
get_tag_xpath()
- Returns
str, xpath to the tag with the given attribute
- Raises
ValueError – If no unique path could be found
-
masci_tools.util.schema_dict_util.
get_number_of_nodes
(node, schema_dict, name, logger=None, **kwargs)[source]¶ Evaluates the number of occurences of the tag in the xmltree based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
bool, True if any nodes with the path exist
-
masci_tools.util.schema_dict_util.
get_relative_attrib_xpath
(schema_dict, name, root_tag, contains=None, not_contains=None, exclude=None, tag_name=None)[source]¶ Tries to find a unique relative path from the schema_dict based on the given name of the attribute name of the root, from which the path should be relative and additional further specifications
- Parameters
schema_dict – dict, containing all the path information and more
name – str, name of the attribute
contains – str or list of str, this string has to be in the final path
not_contains – str or list of str, this string has to NOT be in the final path
exclude – list of str, here specific types of attributes can be excluded valid values are: settable, settable_contains, other
tag_name – str, if given this name will be used to find a path to a tag with the same name in
get_relative_tag_xpath()
- Returns
str, xpath for the given tag
- Raises
ValueError – If no unique path could be found
-
masci_tools.util.schema_dict_util.
get_relative_tag_xpath
(schema_dict, name, root_tag, contains=None, not_contains=None)[source]¶ Tries to find a unique relative path from the schema_dict based on the given name of the tag name of the root, from which the path should be relative and additional further specifications
- Parameters
schema_dict – dict, containing all the path information and more
name – str, name of the tag
root_tag – str, name of the tag from which the path should be relative
contains – str or list of str, this string has to be in the final path
not_contains – str or list of str, this string has to NOT be in the final path
- Returns
str, xpath for the given tag
- Raises
ValueError – If no unique path could be found
-
masci_tools.util.schema_dict_util.
get_tag_info
(schema_dict, name, contains=None, not_contains=None, path_return=True, convert_to_builtin=False, multiple_paths=False, parent=False)[source]¶ Tries to find a unique path from the schema_dict based on the given name of the tag and additional further specifications and returns the tag_info entry for this tag
- Parameters
schema_dict – dict, containing all the path information and more
name – str, name of the tag
contains – str or list of str, this string has to be in the final path
not_contains – str or list of str, this string has to NOT be in the final path
path_return – bool, if True the found path will be returned alongside the tag_info
convert_to_builtin – bool, if True the CaseInsensitiveFrozenSets are converetd to normal sets with the rigth case of the attributes
multiple_paths – bool, if True mulitple paths are allowed to match as long as they have the same tag_info
parent – bool, if True the tag_info for the parent of the tag is returned
- Returns
dict, tag_info for the found xpath
- Returns
str, xpath to the tag if path_return=True
-
masci_tools.util.schema_dict_util.
get_tag_xpath
(schema_dict, name, contains=None, not_contains=None)[source]¶ Tries to find a unique path from the schema_dict based on the given name of the tag and additional further specifications
- Parameters
schema_dict – dict, containing all the path information and more
name – str, name of the tag
contains – str or list of str, this string has to be in the final path
not_contains – str or list of str, this string has to NOT be in the final path
- Returns
str, xpath for the given tag
- Raises
ValueError – If no unique path could be found
-
masci_tools.util.schema_dict_util.
read_constants
(root, schema_dict, logger=None)[source]¶ Reads in the constants defined in the inp.xml and returns them combined with the predefined constants from fleur as a dictionary
- Parameters
root – root of the etree of the inp.xml file
schema_dict – schema_dictionary of the version of the file to read (inp.xml or out.xml)
logger – logger object for logging warnings, errors
- Returns
a python dictionary with all defined constants
-
masci_tools.util.schema_dict_util.
tag_exists
(node, schema_dict, name, logger=None, **kwargs)[source]¶ Evaluates whether the tag exists in the xmltree based on the given name and additional further specifications with the available type information
- Parameters
node – etree Element, on which to execute the xpath evaluations
schema_dict – dict, containing all the path information and more
name – str, name of the tag
logger – logger object for logging warnings, errors, if not provided all errors will be raised
- Kwargs:
- param contains
str, this string has to be in the final path
- param not_contains
str, this string has to NOT be in the final path
- Returns
bool, True if any nodes with the path exist
This module contains the functions necessary to parse mathematical expressions with predefined constants given in the inp.xml file of Fleur
-
masci_tools.util.fleur_calculate_expression.
calculate_expression
(expression, constants, prevCommand=None, exp_return=False)[source]¶ Recursively evaluates the given expression string with the given defined constants
- Parameters
expression – str containing the expression to be parsed
constants – dict with all defined constants (predefined in the Fleur code or defined in the inp.xml)
prevCommand – str, which gives the command before the beginning of the current block if it is given the calculation is stopped, when a command is encountered, which should be exectuted after prevCommand (order of operations)
exp_return – bool, determines whether to return the remaining string of the expression
- Returns
float value of the given expression string
-
masci_tools.util.fleur_calculate_expression.
evaluate_bracket
(expression, constants)[source]¶ Evaluates the bracket opened at the start of the expression
- Parameters
expression – expression to be parsed
constants – dict with defined constants
- Returns
value of the expression inside the brackets and remaining string of the expression after the corresponding closed bracket
-
masci_tools.util.fleur_calculate_expression.
get_first_number
(expression)[source]¶ Reads the number in the beginning of the expression string. This number can begin with a sign +-, a number or the decimal point
- Parameters
expression – str of the expression
- Returns
float value of the number in the beginning and the string of the remaining expression
-
masci_tools.util.fleur_calculate_expression.
get_first_string
(expression)[source]¶ Reads the letter string in the beginning of the expression string.
- Parameters
expression – str of the expression
- Returns
letter string in the beginning and the string of the remaining expression
This module contains a class which organizes the known parsing tasks for outxml files and provides fuctionality for adding custom tasks easily
-
class
masci_tools.util.parse_tasks.
ParseTasks
(version, task_file=None, validate_defaults=False)[source]¶ Representation of all known parsing tasks for the out.xml file
When set up it will initialize the known default tasks and check if they work for the given output version
Accesing definition of task example
from masci_tools.io.parsers.fleur import ParseTasks p = ParseTasks('0.33') totE_definition = p.tasks['total_energy']
-
add_task
(task_name, task_definition, **kwargs)[source]¶ Add a new task definition to the tasks dictionary
Will first check if the definition has all the required keys
- Parameters
task_name – str, key in the tasks dict
task_definition – dict with the defined tasks
overwrite – bool (optional), if True and the key is present in the dictionary it will be overwritten with the new definition
append – bool (optional), if True and the key is present in the dictionary the new defintions will be inserted into this dictionary (inner keys WILL BE OVERWRITTEN). Additionally if an inner key is overwritten with an empty dict the inner key will be removed
- The following keys are expected in each entry of the task_definition dictionary:
- param parse_type
str, defines which methods to use when extracting the information
- param path_spec
dict with all the arguments that should be passed to get_tag_xpath or get_attrib_xpath to get the correct path
- param subdict
str, if present the parsed values are put into this key in the output dictionary
- param overwrite_last
bool, if True no list is inserted and each entry overwrites the last
- For the allAttribs parse_type there are more keys that can appear:
- param base_value
str, optional. If given the attribute with this name will be inserted into the key from the task_definition all other keys are formatted as {task_key}_{attribute_name}
- param ignore
list of str, these attributes will be ignored
- param overwrite
list of str, these attributes will not create a list and overwrite any value that might be there
- param flat
bool, if False the dict parsed from the tag is inserted as a dict into the correspondin key if True the values will be extracted and put into the output dictionary with the format {task_key}_{attribute_name}
-
determine_tasks
(fleurmodes, minimal=False)[source]¶ Determine, which tasks to perform based on the fleur_modes
- Parameters
fleurmodes – dict with the calculation modes
minimal – bool, whether to only perform minimal tasks
-
property
general_tasks
¶ Tasks to perform for the root node
-
property
iteration_tasks
¶ Tasks to perform for each iteration
-
perform_task
(task_name, node, out_dict, schema_dict, constants, logger=None, use_lists=True)[source]¶ Evaluates the task given in the tasks_definition dict
- Parameters
task_name – str, specifies the task to perform
node – etree.Element, the xpath expressions are evaluated from this node
out_dict – dict, output will be put in this dictionary
schema_dict – dict, here all paths and attributes are stored according to the outputschema
constants – dict with all the defined mathematical constants
logger – logger object for logging warnings, errors
root_tag – str, this string will be appended in front of any xpath before it is evaluated
use_lists – bool, if True lists are created for each key if not otherwise specified
-
-
masci_tools.util.parse_tasks.
find_migration
(start, target, migrations)[source]¶ Tries to find a migration path from the start to the target version via the defined migration functions
- Parameters
start – str of the starting version
target – str of the target version
migrations – dict of funcs registered via the register_migration_function decorator
- Returns
list of migration functions to be called to go from start to target
This module defines decorators for the ParseTasks class to make extending/modifying the parser more convenient
- Up till now 3 decorators are defined:
`register_migration`
marks a function of making backwards incompatible changes to the parsing tasks`register_parsing_function`
gives a mappimg between available parsing functions and the keywords in the parsing tasks`conversion_function`
makes the decorated function available to be called easily after a certain parsing task has occured
-
masci_tools.util.parse_tasks_decorators.
conversion_function
(func)[source]¶ Marks a function as a conversion function, which can be called after performing a parsing task. The function can be specified via the _conversions control key in the task definitions.
- A conversion function has to have the following arguments:
- param out_dict
dict with the previously parsed information
- param parser_info_out
dict, with warnings, info, errors, …
and return only the modified output dict
-
masci_tools.util.parse_tasks_decorators.
register_migration
(base_version, target_version)[source]¶ Decorator to add migration for task definition dictionary to the ParseTasks class The function should only take the dict of task definitions as an argument
- Parameters
base_version – str of the version, from which the migration starts
target_version – str or list of str with the versions that work after the migration has been performed
-
masci_tools.util.parse_tasks_decorators.
register_parsing_function
(parse_type_name, all_attribs_keys=False)[source]¶ Decorator to add parse type for task definition dictionary.
- Parameters
parse_type_name – str, the function can be selected in task defintions via this string
all_attribs_keys – bool, if True the arguments for parsing multiple attributes are valid
- The decorated function has to have the following arguments:
- param node
etree Element, on which to execute the xpath evaluations
- param schema_dict
dict, containing all the path information and more
- param name
str, name of the tag/attribute
- param parser_info_out
dict, with warnings, info, errors, …
- param kwargs
here all other keyword arguments are collected
This module contains custom conversion functions for the outxml_parser, which cannot be handled by the standard parsing framework
-
masci_tools.io.parsers.fleur.outxml_conversions.
calculate_total_magnetic_moment
(out_dict, logger)[source]¶ Calculate the the total magnetic moment per cell
- Parameters
out_dict – dict with the already parsed information
-
masci_tools.io.parsers.fleur.outxml_conversions.
calculate_walltime
(out_dict, logger)[source]¶ Calculate the walltime from start and end time
- Parameters
out_dict – dict with the already parsed information
logger – logger object for logging warnings, errors, if not provided all errors will be raised
-
masci_tools.io.parsers.fleur.outxml_conversions.
convert_forces
(out_dict, logger)[source]¶ Convert the parsed forces from a iteration
- Parameters
out_dict – dict with the already parsed information
-
masci_tools.io.parsers.fleur.outxml_conversions.
convert_ldau_definitions
(out_dict, logger)[source]¶ Convert the parsed information from LDA+U into a more readable dict
ldau_info has keys for each species with LDA+U ({species_name}/{atom_number}) and this in turn contains a dict with the LDA+U definition for the given orbital (spdf)
- Parameters
out_dict – dict with the already parsed information
Basic Fleur Schema parser functions¶
Load all fleur schema related functions
-
class
masci_tools.io.parsers.fleur.fleur_schema.
InputSchemaDict
(*args, xmlschema=None, **kwargs)[source]¶ This class contains information parsed from the FleurInputSchema.xsd
The keys contain the following information:
- inp_version
Version string of the input schema represented in this object
- tag_paths
simple xpath expressions to all valid tag names Multiple paths or ambiguous tag names are parsed as a list
- _basic_types
Parsed definitions of all simple Types with their respective base type (int, float, …) and evtl. length restrictions (Only used in the schema construction itself)
- attrib_types
All possible base types for all valid attributes. If multiple are possible a list, with ‘string’ always last (if possible)
- simple_elements
All elements with simple types and their type definition with the additional attributes
- unique_attribs
All attributes and their paths, which occur only once and have a unique path
- unique_path_attribs
All attributes and their paths, which have a unique path but occur in multiple places
- other_attribs
All attributes and their paths, which are not in ‘unique_attribs’ or ‘unique_path_attribs’
- omitt_contained_tags
All tags, which only contain a list of one other tag
- tag_info
For each tag (path), the valid attributes and tags (optional, several, order, simple, text)
-
classmethod
fromPath
(path)[source]¶ load the FleurInputSchema dict for the specified FleurInputSchema file
- Parameters
path – path to the input schema file
- Returns
InputSchemaDict object with the information for the provided file
-
classmethod
fromVersion
(version, logger=None, no_cache=False)[source]¶ load the FleurInputSchema dict for the specified version
- Parameters
version – str with the desired version, e.g. ‘0.33’
logger – logger object for warnings, errors and information, …
- Returns
InputSchemaDict object with the information for the provided version
-
property
inp_version
¶ Returns the input version as an integer for comparisons (> or <)
-
class
masci_tools.io.parsers.fleur.fleur_schema.
OutputSchemaDict
(*args, xmlschema=None, **kwargs)[source]¶ This object contains information parsed from the FleurOutputSchema.xsd
The keys contain the following information:
- out_version
Version string of the output schema represented in this class
- input_tag
Name of the element containing the fleur input
- tag_paths
simple xpath expressions to all valid tag names not in an iteration Multiple paths or ambiguous tag names are parsed as a list
- iteration_tag_paths
simple relative xpath expressions to all valid tag names inside an iteration. Multiple paths or ambiguous tag names are parsed as a list
- _basic_types
Parsed definitions of all simple Types with their respective base type (int, float, …) and evtl. length restrictions (Only used in the schema construction itself)
- _input_basic_types
Part of the parsed definitions of all simple Types with their respective base type (int, float, …) and evtl. length restrictions from the input schema (Only used in the schema construction itself)
- attrib_types
All possible base types for all valid attributes. If multiple are possible a list, with ‘string’ always last (if possible)
- simple_elements
All elements with simple types and their type definition with the additional attributes
- unique_attribs
All attributes and their paths, which occur only once and have a unique path outside of an iteration
- unique_path_attribs
All attributes and their paths, which have a unique path but occur in multiple places outside of an iteration
- other_attribs
All attributes and their paths, which are not in ‘unique_attribs’ or ‘unique_path_attribs’ outside of an iteration
- iteration_unique_attribs
All attributes and their relative paths, which occur only once and have a unique path inside of an iteration
- iteration_unique_path_attribs
All attributes and their relative paths, which have a unique path but occur in multiple places inside of an iteration
- iteration_other_attribs
All attributes and their relative paths, which are not in ‘unique_attribs’ or ‘unique_path_attribs’ inside of an iteration
- omitt_contained_tags
All tags, which only contain a list of one other tag
- tag_info
For each tag outside of an iteration (path), the valid attributes and tags (optional, several, order, simple, text)
- iteration_tag_info
For each tag inside of an iteration (relative path), the valid attributes and tags (optional, several, order, simple, text)
-
classmethod
fromPath
(path, inp_path=None, inpschema_dict=None)[source]¶ load the FleurOutputSchema dict for the specified paths
- Parameters
path – str path to the FleurOutputSchema file
inp_path – str path to the FleurInputSchema file (defaults to same folder as path)
- Returns
OutputSchemaDict object with the information for the provided files
-
classmethod
fromVersion
(version, inp_version=None, logger=None, no_cache=False)[source]¶ load the FleurOutputSchema dict for the specified version
- Parameters
version – str with the desired version, e.g. ‘0.33’
inp_version – str with the desired input version, e.g. ‘0.33’ (defaults to version)
logger – logger object for warnings, errors and information, …
- Returns
OutputSchemaDict object with the information for the provided versions
-
property
inp_version
¶ Returns the input version as an integer for comparisons (> or <)
-
property
out_version
¶ Returns the output version as an integer for comparisons (> or <)
-
masci_tools.io.parsers.fleur.fleur_schema.
add_fleur_schema
(path, overwrite=False)[source]¶ Adds the FleurInput/OutputSchema from the specified path (folder containing the Schemas) to the folder with the correct version number and creates the schema_dicts
- Parameters
path – path to the folder containing the schema files
overwrite – bool, if True and the schema with the same version exists it will be overwritten. Otherwise an error is raised
-
masci_tools.io.parsers.fleur.fleur_schema.
create_inpschema_dict
(path)[source]¶ Creates dictionary with information about the FleurInputSchema.xsd. The functions, whose results are added to the schema_dict and the corresponding keys are defined in schema_actions
- Parameters
path – str path to the folder containing the FleurInputSchema.xsd file
-
masci_tools.io.parsers.fleur.fleur_schema.
create_outschema_dict
(path, inp_path=None, inpschema_dict=None)[source]¶ Creates dictionary with information about the FleurOutputSchema.xsd. The functions, whose results are added to the schema_dict and the corresponding keys are defined in schema_actions
- Parameters
path – str path to the folder containing the FleurOutputSchema.xsd file
inp_path – str path to the FleurInputSchema.xsd file (defaults to the same folder as path)
-
masci_tools.io.parsers.fleur.fleur_schema.
schema_dict_version_dispatch
(output_schema=False)[source]¶ Decorator for creating variations of functions based on the inp/out version of the schema_dict. All functions here need to have the signature:
def f(node, schema_dict, *args, **kwargs): pass
So schema_dict is the second positional argument
Inspired by singledispatch in the functools module
functions to extract information about the fleur schema input or output
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
extract_attribute_types
(xmlschema, namespaces, **kwargs)[source]¶ Determine the required type of all attributes
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
possible types of the attributes in a dictionary, if multiple types are possible a list is inserted for the tag
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_basic_elements
(xmlschema, namespaces, **kwargs)[source]¶ find all elements, whose type can be directly trace back to a basic_type
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with tags and their corresponding type_definition meaning a dicationary with possible base types and evtl. length restriction
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_basic_types
(xmlschema, namespaces, **kwargs)[source]¶ find all types, which can be traced back directly to a base_type
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with type names and their corresponding type_definition meaning a dicationary with possible base types and evtl. length restriction
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_input_tag
(xmlschema, namespaces, **kwargs)[source]¶ Returns the tag for the input type element of the outxmlschema
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
name of the element with the type ‘FleurInputType’
find tags with no attributes and, which are only used to mask a list of one other possible tag (e.g. atomSpecies)
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
list of tags, containing only a sequence of one allowed tag
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_other_attribs
(xmlschema, namespaces, **kwargs)[source]¶ Determine all other attributes not contained in settable or settable_contains
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with all attributes and the corresponding list of paths to the tag
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_root_tag
(xmlschema, namespaces, **kwargs)[source]¶ Returns the tag for the root element of the xmlschema
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
name of the single element defined in the first level of the schema
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_tag_info
(xmlschema, namespaces, **kwargs)[source]¶ - Get all important information about the tags
allowed attributes
contained tags (simple (only attributes), optional (with default values), several, order, text tags)
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with the tag information
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_tag_paths
(xmlschema, namespaces, **kwargs)[source]¶ Determine simple xpaths to all possible tags
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
possible paths of all tags in a dictionary, if multiple paths are possible a list is inserted for the tag
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_unique_attribs
(xmlschema, namespaces, **kwargs)[source]¶ Determine all attributes, which can be set through set_inpchanges in aiida_fleur Meaning ONE possible path and no tags in the path with maxOccurs!=1
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with all settable attributes and the corresponding path to the tag
-
masci_tools.io.parsers.fleur.fleur_schema.fleur_schema_parser_functions.
get_unique_path_attribs
(xmlschema, namespaces, **kwargs)[source]¶ Determine all attributes, with multiple possible path that do have at least one path with all contained tags maxOccurs!=1
- Parameters
xmlschema – xmltree representing the schema
namespaces – dictionary with the defined namespaces
- Returns
dictionary with all attributes and the corresponding list of paths to the tag
Defined constants¶
Here we collect physical constants which are used throughout the code that way we ensure consistency
Note
For masci-tools versions after 0.4.6
the constants used in the KKR functions are replaced
by the NIST values by default. If you still want to use the old values
you can set the environment variable MASCI_TOOLS_USE_OLD_CONSTANTS to True
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | import numpy as np
import os
# NIST https://physics.nist.gov/cgi-bin/cuu/Value?hrev
HTR_TO_EV = 27.211386245988 #(53)
RY_TO_EV = 13.605693122994 #(26)
BOHR_A = 0.5291772108
HTR_TO_KELVIN = 315_775.02480407
#Scipy bohr 5.29177210903e-11 m
#Scipy htr 27.211386245988 eV
# NIST BOHR 0.529177210903 #(80)
#https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0
#KKR constants
if os.environ.get('MASCI_TOOLS_USE_OLD_CONSTANTS', False) == 'True':
ANG_BOHR_KKR = 1.8897261254578281
RY_TO_EV_KKR = 13.605693009
else:
#Set the constants to the NIST values
RY_TO_EV_KKR = RY_TO_EV
ANG_BOHR_KKR = 1.8897261246257702
#Fleur
#htr_eV = 27.21138602
#bohr=0.5291772108
#bohrtocm=0.529177e-8
#pymatgen uses scipy.constants
#ase: Bohr 0.5291772105638411
#Hartree 27.211386024367243
#Rydberg 13.605693012183622
#1/Bohr
#1.8897261258369282
#aiida-core units:
#bohr_to_ang = 0.52917720859
#Predefined constants in the Fleur Code (These are accepted in the inp.xml)
FLEUR_DEFINED_CONSTANTS = {
'Pi': np.pi,
'Deg': 2 * np.pi / 360.0,
'Ang': 1.8897261247728981,
'nm': 18.897261247728981,
'pm': 0.018897261247728981,
'Bohr': 1.0,
'Htr': 1.0,
'eV': 1.0 / HTR_TO_EV,
'Ry': 0.5
}
PERIODIC_TABLE_ELEMENTS = {
0: { # This is for empty spheres etc.
'mass': 1.00000,
'name': 'Unknown',
'symbol': 'X'
},
1: {
'mass': 1.00794,
'name': 'Hydrogen',
'symbol': 'H',
'econfig': '1s1',
'fleur_default_econfig': '| 1s1',
'lo': '',
'rmt': 0.65,
'lmax': '',
'jri': 981,
'soc': False,
'mag': False
},
2: {
'mass': 4.002602,
'name': 'Helium',
'symbol': 'He',
'econfig': '1s2',
'fleur_default_econfig': '| 1s2',
'lo': '',
'rmt': 1.2,
'lmax': '',
'jri': 981
},
3: {
'mass': 6.941,
'name': 'Lithium',
'symbol': 'Li',
'econfig': '1s2 | 2s1',
'fleur_default_econfig': '1s2 | 2s1',
'lo': '',
'rmt': 2.13,
'lmax': '',
'jri': 981
},
4: {
'mass': 9.012182,
'name': 'Beryllium',
'symbol': 'Be',
'econfig': '1s2 | 2s2',
'fleur_default_econfig': '1s2 | 2s2',
'lo': '',
'rmt': 1.87,
'lmax': '',
'jri': 981
},
5: {
'mass': 10.811,
'name': 'Boron',
'symbol': 'B',
'econfig': '1s2 | 2s2 2p1',
'fleur_default_econfig': '1s2 | 2s2 2p1',
'lo': '',
'rmt': 1.4,
'lmax': '',
'jri': 981
},
6: {
'mass': 12.0107,
'name': 'Carbon',
'symbol': 'C',
'econfig': '[He] 2s2 | 2p2',
'fleur_default_econfig': '[He] 2s2 | 2p2',
'lo': '',
'rmt': 1.2,
'lmax': '',
'jri': 981
},
7: {
'mass': 14.0067,
'name': 'Nitrogen',
'symbol': 'N',
'econfig': '[He] 2s2 | 2p3',
'fleur_default_econfig': '[He] 2s2 | 2p3',
'lo': '',
'rmt': 1.0,
'lmax': '',
'jri': 981
},
8: {
'mass': 15.9994,
'name': 'Oxygen',
'symbol': 'O',
'econfig': '[He] 2s2 | 2p4',
'fleur_default_econfig': '[He] 2s2 | 2p4',
'lo': '',
'rmt': 1.1,
'lmax': '',
'jri': 981
},
9: {
'mass': 18.9984032,
'name': 'Fluorine',
'symbol': 'F',
'econfig': '[He] 2s2 | 2p5',
'fleur_default_econfig': '[He] 2s2 | 2p5',
'lo': '',
'rmt': 1.2,
'lmax': '',
'jri': 981
},
10: {
'mass': 20.1797,
'name': 'Neon',
'symbol': 'Ne',
'econfig': '[He] 2s2 | 2p6',
'fleur_default_econfig': '[He] 2s2 | 2p6',
'lo': '',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
11: {
'mass': 22.98977,
'name': 'Sodium',
'symbol': 'Na',
'econfig': '[He] 2s2 | 2p6 3s1',
'fleur_default_econfig': '[He] | 2s2 2p6 3s1',
'lo': '2s 2p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
12: {
'mass': 24.305,
'name': 'Magnesium',
'symbol': 'Mg',
'econfig': '[He] 2s2 | 2p6 3s2',
'fleur_default_econfig': '[He] 2s2 | 2p6 3s2',
'lo': '2p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
13: {
'mass': 26.981538,
'name': 'Aluminium',
'symbol': 'Al',
'econfig': '[He] 2s2 2p6 | 3s2 3p1',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p1',
'lo': '',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
14: {
'mass': 28.0855,
'name': 'Silicon',
'symbol': 'Si',
'econfig': '[He] 2s2 2p6 | 3s2 3p2',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p2',
'lo': '',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
15: {
'mass': 30.973761,
'name': 'Phosphorus',
'symbol': 'P',
'econfig': '[He] 2s2 2p6 | 3s2 3p3',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p3',
'lo': '',
'rmt': 1.9,
'lmax': '',
'jri': 981
},
16: {
'mass': 32.065,
'name': 'Sulfur',
'symbol': 'S',
'econfig': '[He] 2s2 2p6 | 3s2 3p4',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p4',
'lo': '',
'rmt': 1.7,
'lmax': '',
'jri': 981
},
17: {
'mass': 35.453,
'name': 'Chlorine',
'symbol': 'Cl',
'econfig': '[He] 2s2 2p6 | 3s2 3p5',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p5',
'lo': '',
'rmt': 1.7,
'lmax': '',
'jri': 981
},
18: {
'mass': 39.948,
'name': 'Argon',
'symbol': 'Ar',
'econfig': '[He] 2s2 2p6 | 3s2 3p6',
'fleur_default_econfig': '[He] 2s2 2p6 | 3s2 3p6',
'lo': '',
'rmt': 1.8,
'lmax': '',
'jri': 981
},
19: {
'mass': 39.0983,
'name': 'Potassium',
'symbol': 'K',
'econfig': '[Ne] 3s2 | 3p6 4s1',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s1',
'lo': '3s 3p',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
20: {
'mass': 40.078,
'name': 'Calcium',
'symbol': 'Ca',
'econfig': '[Ne] 3s2 | 3p6 4s2',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2',
'lo': '3s 3p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
21: {
'mass': 44.955912,
'name': 'Scandium',
'symbol': 'Sc',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d1',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2 3d1',
'lo': '3s 3p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
22: {
'mass': 47.867,
'name': 'Titanium',
'symbol': 'Ti',
'econfig': '[Ne] | 3s2 3p6 4s2 3d2',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2 3d2',
'lo': '3s 3p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
23: {
'mass': 50.9415,
'name': 'Vanadium',
'symbol': 'V',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d3',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2 3d3',
'lo': '3s 3p',
'rmt': 1.9,
'lmax': '',
'jri': 981
},
24: {
'mass': 51.9961,
'name': 'Chromium',
'symbol': 'Cr',
'econfig': '[Ne] 3s2 3p6 | 4s1 3d5',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s1 3d5',
'lo': '3s 3p',
'rmt': 1.8,
'lmax': '',
'jri': 981
},
25: {
'mass': 54.938045,
'name': 'Manganese',
'symbol': 'Mn',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d5',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2 3d5',
'lo': '3s 3p',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
26: {
'mass': 55.845,
'name': 'Iron',
'symbol': 'Fe',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d6',
'fleur_default_econfig': '[Ne] | 3s2 3p6 4s2 3d6',
'lo': '3s 3p',
'rmt': 2.00,
'lmax': '',
'jri': 981
},
27: {
'mass': 58.933195,
'name': 'Cobalt',
'symbol': 'Co',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d7',
'fleur_default_econfig': '[Ne] 3s2 | 3p6 4s2 3d7',
'lo': '3p',
'rmt': 1.9,
'lmax': '',
'jri': 981
},
28: {
'mass': 58.6934,
'name': 'Nickel',
'symbol': 'Ni',
'econfig': '[Ne] 3s2 3p6 | 4s2 3d8',
'fleur_default_econfig': '[Ne] 3s2 | 3p6 4s2 3d8',
'lo': '3p',
'rmt': 1.9,
'lmax': '',
'jri': 981
},
29: {
'mass': 63.546,
'name': 'Copper',
'symbol': 'Cu',
'econfig': '[Ne] 3s2 3p6 |4s1 3d10',
'fleur_default_econfig': '[Ne] 3s2 | 3p6 4s1 3d10',
'lo': '3p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
30: {
'mass': 65.38,
'name': 'Zinc',
'symbol': 'Zn',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2',
'lo': '3d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
31: {
'mass': 69.723,
'name': 'Gallium',
'symbol': 'Ga',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p1',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p1',
'lo': '3d',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
32: {
'mass': 72.64,
'name': 'Germanium',
'symbol': 'Ge',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p2',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p2',
'lo': '3d',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
33: {
'mass': 74.9216,
'name': 'Arsenic',
'symbol': 'As',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p3',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p3',
'lo': '3d',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
34: {
'mass': 78.96,
'name': 'Selenium',
'symbol': 'Se',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p4',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p4',
'lo': '3d',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
35: {
'mass': 79.904,
'name': 'Bromine',
'symbol': 'Br',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p5',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p5',
'lo': '3d',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
36: {
'mass': 83.798,
'name': 'Krypton',
'symbol': 'Kr',
'econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p6',
'fleur_default_econfig': '[Ne] 3s2 3p6 | 3d10 4s2 4p6',
'lo': '3d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
37: {
'mass': 85.4678,
'name': 'Rubidium',
'symbol': 'Rb',
'econfig': '[Ar] 3d10 4s2 | 4p6 5s1',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s1',
'lo': '4s 4p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
38: {
'mass': 87.62,
'name': 'Strontium',
'symbol': 'Sr',
'econfig': '[Ar] 3d10 4s2 | 4p6 5s2',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s2',
'lo': '4s 4p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
39: {
'mass': 88.90585,
'name': 'Yttrium',
'symbol': 'Y',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s2 4d1',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s2 4d1',
'lo': '4s 4p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
40: {
'mass': 91.224,
'name': 'Zirconium',
'symbol': 'Zr',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s2 4d2',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s2 4d2',
'lo': '4s 4p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
41: {
'mass': 92.90638,
'name': 'Niobium',
'symbol': 'Nb',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s1 4d4',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s1 4d4',
'lo': '4s 4p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
42: {
'mass': 95.96,
'name': 'Molybdenum',
'symbol': 'Mo',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s1 4d5',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s1 4d5',
'lo': '4s 4p',
'rmt': 2.0,
'lmax': '',
'jri': 981
},
43: {
'mass': 98.0,
'name': 'Technetium',
'symbol': 'Tc',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s2 4d5',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s2 4d5',
'lo': '4s 4p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
44: {
'mass': 101.07,
'name': 'Ruthenium',
'symbol': 'Ru',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s1 4d7',
'fleur_default_econfig': '[Ar] 4s2 3d10 | 4p6 5s1 4d7',
'lo': '4p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
45: {
'mass': 102.9055,
'name': 'Rhodium',
'symbol': 'Rh',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s1 4d8',
'fleur_default_econfig': '[Ar] 4s2 3d10 | 4p6 5s1 4d8',
'lo': '4p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
46: {
'mass': 106.42,
'name': 'Palladium',
'symbol': 'Pd',
'econfig': '[Ar] 4s2 3d10 4p6 | 4d10',
'fleur_default_econfig': '[Ar] 4s2 3d10 | 4p6 4d10',
'lo': '4p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
47: {
'mass': 107.8682,
'name': 'Silver',
'symbol': 'Ag',
'econfig': '[Ar] 4s2 3d10 4p6 | 5s1 4d10',
'fleur_default_econfig': '[Ar] 3d10 | 4s2 4p6 5s1 4d10',
'lo': '4s 4p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
48: {
'mass': 112.411,
'name': 'Cadmium',
'symbol': 'Cd',
'econfig': '[Ar] 4s2 3d10 4p6 | 4d10 5s2',
'fleur_default_econfig': '[Ar] 4s2 3d10 4p6 | 4d10 5s2',
'lo': '4d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
49: {
'mass': 114.818,
'name': 'Indium',
'symbol': 'In',
'econfig': '[Ar] 4s2 3d10 4p6 | 4d10 5s2 5p1',
'fleur_default_econfig': '[Ar] 4s2 3d10 4p6 | 4d10 5s2 5p1',
'lo': '4d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
50: {
'mass': 118.71,
'name': 'Tin',
'symbol': 'Sn',
'econfig': '[Kr] 4d10 | 5s2 5p2',
'fleur_default_econfig': '[Kr] | 4d10 5s2 5p2',
'lo': '4d',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
51: {
'mass': 121.76,
'name': 'Antimony',
'symbol': 'Sb',
'econfig': '[Kr] 4d10 | 5s2 5p3',
'fleur_default_econfig': '[Kr] | 4d10 5s2 5p3',
'lo': '4d',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
52: {
'mass': 127.6,
'name': 'Tellurium',
'symbol': 'Te',
'econfig': '[Kr] 4d10 | 5s2 5p4',
'fleur_default_econfig': '[Kr] | 4d10 5s2 5p4',
'lo': '4d',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
53: {
'mass': 126.90447,
'name': 'Iodine',
'symbol': 'I',
'econfig': '[Kr] 4d10 | 5s2 5p5',
'fleur_default_econfig': '[Kr] | 4d10 5s2 5p5',
'lo': '4d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
54: {
'mass': 131.293,
'name': 'Xenon',
'symbol': 'Xe',
'econfig': '[Kr] 4d10 | 5s2 5p6',
'fleur_default_econfig': '[Kr] | 4d10 5s2 5p6',
'lo': '4d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
55: {
'mass': 132.9054519,
'name': 'Caesium',
'symbol': 'Cs',
'econfig': '[Kr] 4d10 5s2 | 5p6 6s1',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s1',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
56: {
'mass': 137.327,
'name': 'Barium',
'symbol': 'Ba',
'econfig': '[Kr] 4d10 5s2 | 5p6 6s2',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
57: {
'mass': 138.90547,
'name': 'Lanthanum',
'symbol': 'La',
'econfig': '[Kr] 4d10 5s2 | 5p6 6s2 5d1',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 5d1',
'lo': '5s 5p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
58: {
'mass': 140.116,
'name': 'Cerium',
'symbol': 'Ce',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f1 5d1',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f1 5d1',
'lo': '5s 5p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
59: {
'mass': 140.90765,
'name': 'Praseodymium',
'symbol': 'Pr',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f3',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f3',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
60: {
'mass': 144.242,
'name': 'Neodymium',
'symbol': 'Nd',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f4',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f4',
'lo': '5s 5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
61: {
'mass': 145.0,
'name': 'Promethium',
'symbol': 'Pm',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f5',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f5',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
62: {
'mass': 150.36,
'name': 'Samarium',
'symbol': 'Sm',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f6',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f6',
'lo': '5s 5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
63: {
'mass': 151.964,
'name': 'Europium',
'symbol': 'Eu',
'econfig': '[Kr] 4d10 | 4f7 5s2 5p6 6s2',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 4f7 6s2',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
64: {
'mass': 157.25,
'name': 'Gadolinium',
'symbol': 'Gd',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f7 5d1',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f7 5d1',
'lo': '5s 5p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
65: {
'mass': 158.92535,
'name': 'Terbium',
'symbol': 'Tb',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f9',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f8 5d1',
'lo': '5s 5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
66: {
'mass': 162.5,
'name': 'Dysprosium',
'symbol': 'Dy',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f10',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f9 5d1',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
67: {
'mass': 164.93032,
'name': 'Holmium',
'symbol': 'Ho',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f11',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f10 5d1',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
68: {
'mass': 167.259,
'name': 'Erbium',
'symbol': 'Er',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f12',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f11 5d1',
'lo': '5s 5p',
'rmt': 2.5,
'lmax': '',
'jri': 981
},
69: {
'mass': 168.93421,
'name': 'Thulium',
'symbol': 'Tm',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f13',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f12 5d1',
'lo': '5s 5p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
70: {
'mass': 173.054,
'name': 'Ytterbium',
'symbol': 'Yb',
'econfig': '[Kr] 4d10 5s2 5p6 | 6s2 4f14',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 6s2 4f13 5d1',
'lo': '5s 5p',
'rmt': 2.6,
'lmax': '',
'jri': 981
},
71: {
'mass': 174.9668,
'name': 'Lutetium',
'symbol': 'Lu',
'econfig': '[Kr] 4d10 | 4f14 5s2 5p6 5d1 6s2',
'fleur_default_econfig': '[Kr] 4d10 | 5s2 5p6 4f14 6s2 5d1',
'lo': '5s 5p',
'rmt': 2.5,
'lmax': '',
'jri': 981
},
72: {
'mass': 178.49,
'name': 'Hafnium',
'symbol': 'Hf',
'econfig': '[Kr] 4d10 | 4f14 5s2 5p6 5d2 6s2',
'fleur_default_econfig': '[Kr] 4d10 4f14 | 5s2 5p6 6s2 5d2',
'lo': '5s 5p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
73: {
'mass': 180.94788,
'name': 'Tantalum',
'symbol': 'Ta',
'econfig': '[Kr] 4d10 4f14 | 5s2 5p6 5d3 6s2',
'fleur_default_econfig': '[Kr] 4d10 4f14 | 5s2 5p6 6s2 5d3',
'lo': '5s 5p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
74: {
'mass': 183.84,
'name': 'Tungsten',
'symbol': 'W',
'econfig': '[Kr] 5s2 4d10 4f14 | 5p6 6s2 5d4',
'fleur_default_econfig': '[Kr] 4d10 4f14 | 5s2 5p6 6s2 5d4',
'lo': '5s 5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
75: {
'mass': 186.207,
'name': 'Rhenium',
'symbol': 'Re',
'econfig': '[Kr] 4d10 4f14 5p6 | 5s2 6s2 5d5',
'fleur_default_econfig': '[Kr] 4d10 4f14 | 5s2 5p6 6s2 5d5',
'lo': '5s 5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
76: {
'mass': 190.23,
'name': 'Osmium',
'symbol': 'Os',
'econfig': '[Kr] 4d10 4f14 5p6 | 5s2 6s2 5d6',
'fleur_default_econfig': '[Kr] 5s2 4d10 4f14 | 5p6 6s2 5d6',
'lo': '5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
77: {
'mass': 192.217,
'name': 'Iridium',
'symbol': 'Ir',
'econfig': '[Kr] 4d10 4f14 5p6 | 5s2 6s2 5d7',
'fleur_default_econfig': '[Kr] 5s2 4d10 4f14 | 5p6 6s2 5d7',
'lo': '5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
78: {
'mass': 195.084,
'name': 'Platinum',
'symbol': 'Pt',
'econfig': '[Kr] 4d10 4f14 5p6 | 5s2 6s2 5d8',
'fleur_default_econfig': '[Kr] 5s2 4d10 4f14 | 5p6 6s2 5d8',
'lo': '5p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
79: {
'mass': 196.966569,
'name': 'Gold',
'symbol': 'Au',
'econfig': '[Kr] 4d10 4f14 5p6 | 5s2 6s2 5d9',
'fleur_default_econfig': '[Kr] 4d10 4f14 | 5s2 5p6 6s2 5d9',
'lo': '5s 5p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
80: {
'mass': 200.59,
'name': 'Mercury',
'symbol': 'Hg',
'econfig': '[Kr] 5s2 4d10 4f14 | 5p6 5d10 6s2',
'fleur_default_econfig': '[Kr] 5s2 4d10 4f14 5p6 | 5d10 6s2',
'lo': '5d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
81: {
'mass': 204.3833,
'name': 'Thallium',
'symbol': 'Tl',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p1',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p1',
'lo': '5d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
82: {
'mass': 207.2,
'name': 'Lead',
'symbol': 'Pb',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p2',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p2',
'lo': '5d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
83: {
'mass': 208.9804,
'name': 'Bismuth',
'symbol': 'Bi',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p3',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p3',
'lo': '5d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
84: {
'mass': 209.0,
'name': 'Polonium',
'symbol': 'Po',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p4',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p4',
'lo': '5d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
85: {
'mass': 210.0,
'name': 'Astatine',
'symbol': 'At',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p5',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p5',
'lo': '5d',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
86: {
'mass': 222.0,
'name': 'Radon',
'symbol': 'Rn',
'econfig': '[Xe] 4f14 | 5d10 6s2 6p6',
'fleur_default_econfig': '[Xe] 4f14 | 5d10 6s2 6p6',
'lo': '5d',
'rmt': 2.2,
'lmax': '',
'jri': 981
}, # TODO: after wards not rigth
87: {
'mass': 223.0,
'name': 'Francium',
'symbol': 'Fr',
'econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s1',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s1',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
88: {
'mass': 226.0,
'name': 'Radium',
'symbol': 'Ra',
'econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
89: {
'mass': 227.0,
'name': 'Actinium',
'symbol': 'Ac',
'econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2 6d1',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 6d1',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
90: {
'mass': 232.03806,
'name': 'Thorium',
'symbol': 'Th',
'econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2 6d1 5f1',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 6d1 5f1',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
91: {
'mass': 231.03588,
'name': 'Protactinium',
'symbol': 'Pa',
'econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2 6d1 5f2',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 6d1 5f2',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
92: {
'mass': 238.02891,
'name': 'Uranium',
'symbol': 'U',
'econfig': '[Xe] 4f14 5d10 6s2 6p6| 7s2 5f4',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f4',
'lo': '6s 6p',
'rmt': 2.3,
'lmax': '',
'jri': 981
},
93: {
'mass': 237.0,
'name': 'Neptunium',
'symbol': 'Np',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f5',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f5',
'lo': '6s 6p',
'rmt': 2.1,
'lmax': '',
'jri': 981
},
94: {
'mass': 244.0,
'name': 'Plutonium',
'symbol': 'Pu',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f6',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f6',
'lo': '6s 6p',
'rmt': 2.2,
'lmax': '',
'jri': 981
},
95: {
'mass': 243.0,
'name': 'Americium',
'symbol': 'Am',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f7',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f7',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
96: {
'mass': 247.0,
'name': 'Curium',
'symbol': 'Cm',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f8',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f8',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
97: {
'mass': 247.0,
'name': 'Berkelium',
'symbol': 'Bk',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f9',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f9',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
98: {
'mass': 251.0,
'name': 'Californium',
'symbol': 'Cf',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f10',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f10',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
99: {
'mass': 252.0,
'name': 'Einsteinium',
'symbol': 'Es',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f11',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f11',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
100: {
'mass': 257.0,
'name': 'Fermium',
'symbol': 'Fm',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f12',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f12',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
101: {
'mass': 258.0,
'name': 'Mendelevium',
'symbol': 'Md',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f13',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f13',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
102: {
'mass': 259.0,
'name': 'Nobelium',
'symbol': 'No',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f14',
'lo': '6s 6p',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
103: {
'mass': 262.0,
'name': 'Lawrencium',
'symbol': 'Lr',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14 6d1',
'fleur_default_econfig': '[Xe] 4f14 5d10 | 6s2 6p6 7s2 5f14 6d1',
'lo': '6s 6p 5f',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
104: {
'mass': 267.0,
'name': 'Rutherfordium',
'symbol': 'Rf',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14 6d2',
'fleur_default_econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14 6d2',
'lo': '6p 5f',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
105: {
'mass': 268.0,
'name': 'Dubnium',
'symbol': 'Db',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14 6d3',
'fleur_default_econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2 5f14 6d3',
'lo': '6p 5f',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
106: {
'mass': 271.0,
'name': 'Seaborgium',
'symbol': 'Sg',
'econfig': '[Xe] 4f14 5d10 6s2 6p6 | 7s2 5f14 6d4',
'fleur_default_econfig': '[Xe] 4f14 5d10 6s2 | 6p6 7s2 5f14 6d4',
'lo': '6p 5f',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
107: {
'mass': 272.0,
'name': 'Bohrium',
'symbol': 'Bh',
'econfig': '[Rn] 7s2 5f14 | 6d5',
'fleur_default_econfig': '[Xe] 4f14 5d10 6s2 6p6 5f14 | 7s2 6d5',
'lo': '',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
108: {
'mass': 270.0,
'name': 'Hassium',
'symbol': 'Hs',
'econfig': '[Rn] 7s2 5f14 | 6d6',
'fleur_default_econfig': '[Rn] 5f14 | 7s2 6d6',
'lo': '',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
109: {
'mass': 276.0,
'name': 'Meitnerium',
'symbol': 'Mt',
'econfig': '[Rn] 7s2 5f14 | 6d7',
'fleur_default_econfig': '[Rn] 5f14 | 7s2 6d7',
'lo': '',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
110: {
'mass': 281.0,
'name': 'Darmstadtium',
'symbol': 'Ds',
'econfig': '[Rn] 7s2 5f14 | 6d8',
'fleur_default_econfig': '[Rn] 5f14 | 7s2 6d8',
'lo': '',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
111: {
'mass': 280.0,
'name': 'Roentgenium',
'symbol': 'Rg',
'econfig': '[Rn] 7s2 5f14 | 6d9',
'fleur_default_econfig': '[Rn] 5f14 | 7s2 6d9',
'lo': '',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
112: {
'mass': 285.0,
'name': 'Copernicium',
'symbol': 'Cn',
'econfig': '[Rn] 7s2 5f14 | 6d10',
'fleur_default_econfig': '[Rn] 5f14 | 7s2 6d10',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
113: {
'mass': 285.0,
'name': 'Nihomium',
'symbol': 'Nh',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p1',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p1',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
114: {
'mass': 289.0,
'name': 'Flerovium',
'symbol': 'Fl',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p2',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p2',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
115: {
'mass': 0.0,
'name': 'Mascovium',
'symbol': 'Mc',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p3',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p3',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
116: {
'mass': 293.0,
'name': 'Livermorium',
'symbol': 'Lv',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p4',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p4',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
117: {
'mass': 0.0,
'name': 'Tennessine',
'symbol': 'Ts',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p5',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p5',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
},
118: {
'mass': 0.0,
'name': 'Oganesson',
'symbol': 'Og',
'econfig': '[Rn] 7s2 5f14 | 6d10 7p6',
'fleur_default_econfig': '[Rn] 7s2 5f14 | 6d10 7p6',
'lo': '6d',
'rmt': 2.4,
'lmax': '',
'jri': 981
}
}
|