Visualisation and Plotting

Fleur specific Plotting

Plotting routine for fleur density of states and bandstructures

masci_tools.vis.fleur.plot_fleur_bands(bandsdata, bandsattributes, spinpol=True, only_spin=None, backend=None, weight=None, **kwargs)[source]

Plot the bandstructure previously extracted from a banddos.hdf via the HDF5Reader

This routine expects datasets and attributes read in with a FleurBands recipe from recipes or something producing equivalent data

Parameters:
  • bandsdata – dataset dict produced by the FleurBands recipe

  • attributes – attributes dict produced by the FleurBands recipe

  • spinpol – bool, if True (default) use the plot for spin-polarized bands if the data is spin-polarized

  • only_spin – optional str, if given only the specified spin components are plotted

  • backend – specify which plotting library to use (‘matplotlib’ or ‘bokeh’)

  • weight – str, name of the weight (without spin suffix _up or _dn) you want to emphasize

All other Kwargs are passed on to the underlying plot routines
masci_tools.vis.fleur.plot_fleur_bands_characterize(bandsdata, bandsattributes, weight_names, weight_colors, spinpol=True, only_spin=None, backend=None, **kwargs)[source]

Plot the bandstructure previously extracted from a banddos.hdf via the HDF5Reader with points colored according to the maximum weight from a selection of weights. Can be used to show what character dominates each band

This routine expects datasets and attributes read in with a FleurBands recipe from recipes or something producing equivalent data

Parameters:
  • bandsdata – dataset dict produced by the FleurBands recipe

  • attributes – attributes dict produced by the FleurBands recipe

  • weight_names – list of str with the names of the weights that should be considered in the characterization

  • weight_color – list of colors associated with each weight. If spin-polarized bandstructures should be shown with different colors the list should be twice as long as the weights

  • spinpol – bool, if True (default) use the plot for spin-polarized bands if the data is spin-polarized

  • only_spin – optional str, if given only the specified spin components are plotted

  • backend – specify which plotting library to use (‘matplotlib’ or ‘bokeh’)

All other Kwargs are passed on to plot_fleur_bands()

masci_tools.vis.fleur.plot_fleur_dos(dosdata, attributes, spinpol=True, only_spin=None, multiply_by_equiv_atoms=True, plot_keys=None, show_total=True, show_interstitial=True, show_sym=False, show_atoms='all', show_lresolved=None, key_mask=None, backend=None, **kwargs)[source]

Plot the density of states previously extracted from a banddos.hdf via the HDF5Reader

This routine expects datasets and attributes read in with the FleurDOS (Or related DOS modes) recipe from recipes or something producing equivalent data

The limits for the axes can be specified either with x and y or energy and dos. Mixing the two options is not possible

Parameters:
  • dosdata – dataset dict produced by the FleurDOS recipe

  • attributes – attributes dict produced by the FleurDOS recipe

  • spinpol – bool, if True (default) use the plot for spin-polarized dos if the data is spin-polarized

  • only_spin – optional str, if given only the specified spin components are plotted

  • backend – specify which plotting library to use (‘matplotlib’ or ‘bokeh’)

Arguments for selecting the DOS components to plot: :type plot_keys:

param plot_keys:

optional str list of str, defines the labels you want to plot

All other Kwargs are passed on to the underlying plot routines
masci_tools.vis.fleur.sum_weights_over_atoms(data, attributes, atoms_to_sum, entry_name)[source]

Create sums of atom components over specified atoms. They are entered with the same suffixes as in the original data, but with the given entry_name as prefix

Parameters:
  • data – datasets dict produced by the HDF5Reader with a recipe for DOS or bandstructure

  • attributes – attributes dict produced by the HDF5Reader with a recipe for DOS or bandstructure

  • atoms_to_sum – list of ints for the atoms, which should be summed

  • entry_name – str prefix to be entered for the summed entries

Returns:

dict with the summed entries

KKR specific Plotting

Tool to plot a Fermi surface calculated with the qdos mode of KKR

masci_tools.vis.kkr_plot_FS_qdos.FSqdos2D(p0='./', s=20, reload_data=False, clrbar=True, atoms=None, ax=None, nosave=False, noalat=False, cmap=<matplotlib.colors.LinearSegmentedColormap object>, noplot=False, return_data=False, pclrmesh=False, logscale=True, ef=None)[source]

plotting routine for dos files

dispersionplot function for plotting KKR bandstructures (i.e. qdos) files

masci_tools.vis.kkr_plot_bandstruc_qdos.dispersionplot(p0='./', data_all=None, totonly=True, s=20, ls_ef=':', lw_ef=1, units='eV_rel', noefline=False, color='', reload_data=False, clrbar=True, logscale=True, nosave=False, atoms=None, ratios=False, atoms2=None, noscale=False, newfig=False, cmap=None, alpha=1.0, qcomponent=-2, clims=None, xscale=1.0, raster=True, atoms3=None, alpha_reverse=False, return_data=False, xshift=0.0, yshift=0.0, plotmode='pcolor', ptitle=None, ef=None, as_e_dimension=None, scale_alpha_data=False, shading='gouraud', verbose=False)[source]

plotting routine for qdos files - dispersion (E vs. q)

masci_tools.vis.kkr_plot_bandstruc_qdos.load_data(p0='./', reload_data=False, nosave=False, atoms=None, ratios=False, atoms2=None, atoms3=None, ef=None, verbose=False)[source]

load the qdos data

Plotting function for KKR dos from files

masci_tools.vis.kkr_plot_dos.dosplot(p0='./', totonly=True, color='', label='', marker='', lw=2, ms=5, ls='-', ls_ef=':', lw_ef=1, units='Ry', noefline=False, interpol=False, allatoms=False, onespin=False, atoms=None, lmdos=False, lm=None, nofig=False, scale=1.0, shift=0, normalized=False, xyswitch=False, efcolor='', return_data=False, xscale=1.0, xshift=0.0, yshift=0.0, filled=False, spins=2)[source]

plotting routine for dos files

Tool to visualize the KKR shapefunctions

masci_tools.vis.kkr_plot_shapefun.change_zoom(ax, zoom_range, center=None)[source]

Change the zoom of a 3d plot

Author:

Philipp Ruessmann

Parameters:
  • ax – axis which is zoomed

  • zoom_range (float) – range to which the image is zoomed, total range from center-zoom_range to center+zoom_range

  • center (Optional[list]) – center of the zoomed region (optional, defaults to origin)

Return type:

None

masci_tools.vis.kkr_plot_shapefun.plot_shapefun(pos, out, mode)[source]

Creates a simple matplotlib image to show the shapefunctions given it’s positions in the unit cell, the atoms’s vertices in ut and the plotting mode

Author:

Philipp Ruessmann

Parameters:
  • pos – positions of the centers of the cells

  • verts – array of vertices of the shapefunction (outlines of shapes)

  • mode – ‘all’ or ‘single’ determines whether or not all shapes are combined in a single figure or plotted as individual figures

Returns ax:

return the axis in which the plot was done (useful to pass to ‘change_zoom’ and ‘zoom_in’ functions of this module

masci_tools.vis.kkr_plot_shapefun.zoom_in(ax, atm, pos, zoom_range=10)[source]

Zoom into shapefun of a single atom

Author:

Philipp Ruessmann

Parameters:
  • ax – axis in which shapefun plot is found

  • atm – atom index whose shapefunction is zoomed

  • pos – array of positions of centers of the shapes (needed to shift center of zommed region to correct atom

  • zoom_range – range of the zoomed region (optional, defaults to 10)

General Plotting

Here basic functionality is provided for setting default parameters for plotting and ensuring consistent values for these

masci_tools.vis.parameters.F

Generic Callable type

alias of TypeVar(‘F’, bound=Callable[[…], Any])

masci_tools.vis.parameters.NestedPlotParameters(plotter_object)[source]

Contextmanager for nested plot function calls Will reset function defaults and parameters to previous values after exiting

Parameters:

plotter_object (Plotter) – Plotter instance

Return type:

Generator[None, None, None]

class masci_tools.vis.parameters.Plotter(default_parameters, general_keys=None, key_descriptions=None, type_kwargs_mapping=None, kwargs_postprocess_rename=None, **kwargs)[source]

Base class for handling parameters for plotting methods. For different plotting backends a subclass can be created to represent the specific parameters of the backend.

Parameters:
  • default_parameters (dict[str, Any]) – dict with hardcoded default parameters

  • general_keys (Optional[set[str]]) – set of str optional, defines parameters which are not allowed to change for each entry in the plot data

Kwargs in the __init__ method are forwarded to Plotter.set_defaults() to change the current defaults away from the hardcoded parameters.

The Plotter class creates a hierarchy of dictionaries for lookups on this object utilizing the ChainMap from the collections module.

The hierarchy is as follows (First entries take precedence over later entries):
  • parameters: set by set_parameters() (usually arguments passed into function)

  • user defaults: set by set_defaults()

  • function defaults: set by set_defaults() with default_type=’function’

  • global defaults: Hardcoded as fallback

Only the parameters can represent parameters for multiple sets of plot calls. All others are used as fallback for specifying non-specified values for single plots

The current parameters can be accessed by bracket indexing the class. A example of this is shown below.

parameter_dict = {'fontsize': 16, 'linestyle': '-'}

params = Plotter(parameter_dict)

#Accessing a parameter
print(params['fontsize']) # 16

#Modifying a parameter
params['fontsize'] = 20
print(params['fontsize']) # 20

#Creating a parameter set for multiple plots

#1. Set the properties to the correct values
params.single_plot = False
params.num_plots = 3

#2. Now we can set a property either by providing a list or a integer indexed dict
#   Both of the following examples set the linestyle of the second and third plot to '--'
params['linestyle'] = [None, '--', '--']
params['linestyle'] = {1: '--', 2: '--'}

# Not specified values are replaced with the default value for a single plot
print(params['linestyle']) # ['-', '--', '--']

#In lists properties can also be indexed via tuples
print(params[('linestyle', 0)]) # '-'
print(params[('linestyle', 1)]) # '--'

#Changes to the parameters and properties are reset
params.reset_parameters()

print(params['linestyle']) # '-'
add_parameter(name, default_from=None, default_val=None)[source]

Add a new parameter to the parameters dictionary.

Parameters:
  • name (str) – str name of the parameter

  • default_from (Optional[str]) – str (optional), if given a entry is created in the current defaults with the name and the default value of the key default_from

Return type:

None

static convert_to_complete_list(given_value, single_plot, num_plots, default=None, key='')[source]

Converts given value to list with length num_plots with None for the non-specified values

Parameters:
  • given_value (Any) – value passed in, for multiple plots either list or dict with integer keys

  • single_plot (bool) – bool, if True only a single parameter is allowed

  • num_plots (int) – int, if single_plot is False this defines the number of plots

  • default (Optional[Any]) – default value for unspecified entries

  • key (str) – str of the key to process

Return type:

Any

static dict_of_lists_to_list_of_dicts(dict_of_lists, single_plot, num_plots, repeat_after=None, ignore_repeat=None)[source]

Converts dict of lists and single values to list of length num_plots or single dict for single_plot=True

Parameters:
  • dict_of_lists (dict[str, list[Any]]) – dict to be converted

  • single_plot (bool) – boolean, if True only a single parameter set is allowed

  • num_plots (int) – int of the number of allowed plots

Return type:

list[dict[str, Any]]

Returns:

list of dicts

expand_parameters(original_length, **kwargs)[source]

Expand parameters to a bigger number of plots. New length has to be a multiple of original length. Only lists of length <= orginal_length are expanded. Also expands function defaults

Parameters:
  • orginal_length – int of the old length

  • kwargs (Any) – arguments to expand

Return type:

dict[str, Any]

Returns:

expanded kwargs

get_description(key)[source]

Get the description of the given key

Parameters:

key (str) – str of the key, for which the description should be printed

Return type:

None

get_dict()[source]

Return the dictionary of the current defaults. For use of printing

Return type:

dict[str, Any]

get_multiple_kwargs(keys, ignore=None)[source]

Get multiple parameters and return them in a dictionary

Parameters:
  • keys (set[str]) – set of keys to process

  • ignore (Union[str, list[str], None]) – str or list of str (optional), defines keys to ignore in the creation of the dict

Return type:

dict[str, Any]

is_general(key)[source]

Return, whether the key is general (meaning only related to the whole plots)

Parameters:

key (str) – str of the key to check

Return type:

bool

Returns:

bool, whether the key is general

load_defaults(filename='plot_defaults.json')[source]

Load defaults from a json file.

Parameters:

filename (Union[str, bytes, Path, PathLike, IO[Any]]) – filename,from where the defaults should be taken

Return type:

None

property num_plots: int

Integer property for number of plots produced

plot_kwargs(plot_type='default', ignore=None, extra_keys=None, post_process=True, list_of_dicts=True, **kwargs)[source]

Creates a dict or list of dicts (for multiple plots) with the defined parameters for the plotting calls of different types

Parameters:
  • plot_type (str) – type of plot

  • ignore (Union[str, list[str], None]) – str or list of str (optional), defines keys to ignore in the creation of the dict

  • extra_keys (Optional[set[str]]) – optional set for additional keys to retrieve

  • post_process (bool) – bool, if True the parameters are cleaned up for inserting them directly into bokeh plotting functions

Return type:

Any

Kwargs are used to replace values by custom parameters:

Example for using a custom markersize:

p = Plotter(type_kwargs_mapping={'default': {'marker'}})
p.add_parameter('marker_custom', default_from='marker')
p.plot_kwargs(marker='marker_custom')

This code snippet will return the standard parameters for a plot, but the value for the marker will be taken from the key marker_custom

remove_added_parameters()[source]

Remove the parameters added via Plotter.add_parameter()

Return type:

None

reset_defaults()[source]

Resets the defaults to the hardcoded defaults in _PLOT_DEFAULTS.

Return type:

None

reset_parameters()[source]

Reset the parameters to the current defaults. The properties single_plot and num_plots are also set to default values

Return type:

None

save_defaults(filename='plot_defaults.json', save_complete=False)[source]

Save the current defaults to a json file.

Parameters:
  • filename (Union[str, bytes, Path, PathLike, IO[Any]]) – filename, where the defaults should be stored

  • save_complete (bool) – bool if True not only the overwritten user defaults but also the unmodified hardcoded defaults are stored

Return type:

None

set_defaults(continue_on_error=False, default_type='global', **kwargs)[source]

Set the current defaults. This method will only work if the parameters are not changed from the defaults. Otherwise a error is raised. This is because after changing the defaults the changes will be propagated to the parameters to ensure consistency.

Parameters:

continue_on_error (bool) – bool, if True unknown key are simply skipped

Default_type:

either ‘global’ or ‘function’. Specifies, whether to set the global defaults (not reset after function) or the function defaults

Return type:

dict[str, Any]

Kwargs are used to set the defaults.

set_parameters(continue_on_error=False, **kwargs)[source]

Set the current parameters.

Parameters:

continue_on_error (bool) – bool, if True unknown key are simply skipped and returned

Return type:

dict[str, Any]

Kwargs are used to set the defaults.

set_single_default(key, value, default_type='global')[source]

Set default value for a single key/value pair

Parameters:
  • key (str) – str of the key to set

  • value (Any) – value to set the key to

Default_type:

either ‘global’ or ‘function’. Specifies, whether to set the global defaults (not reset after function) or the function defaults

Return type:

None

property single_plot: bool

Boolean property if True only a single Plot parameter set is allowed

masci_tools.vis.parameters.ensure_plotter_consistency(plotter_object)[source]

Decorator for plot functions to ensure that the Parameters are reset even if an error occurs in the function Additionally checks are performed that the parameters are reset after execution and the defaults are never changed in a plot function

Parameters:

plotter_object (Plotter) – Plotter instance to be checked for consistency

Return type:

Callable[[TypeVar(F, bound= Callable[..., Any])], TypeVar(F, bound= Callable[..., Any])]

This module contains classes and functions to make plotting functions more flexible with respect to the used data. This way plotting functions can both allow the flexible usage of lists, arrays directly or dataframes together with the keys that should be used

class masci_tools.vis.data.ColumnDataSourceWrapper(wrapped)[source]

Wrapper around bokeh.models.ColumnDataSource to give it a __getitem__ and __setitem__ method

Used in the PlotDataIterator for easier handling of these types

class masci_tools.vis.data.PlotData(data, use_column_source=False, same_length=False, strict_data_keys=False, copy_data=False, **kwargs)[source]

Class for iterating over the data in a dict or dataframe with automatic filling in of single defined keys to get a list of keys to extract.

The iteration allows for implicit definition of data for multiple plot sets, without excessive copying of the given data

Usage Example

from masci_tools.vis.data import PlotData
import numpy as np

#Let's say we have one energy grid and a couple of functions
#defined on this energy grid.
#We collect these in a dict

x = np.linspace(-10,10,100)
data = {'x': x, 'y1': np.sin(x), 'y2':np.cos(x), 'y3', x**2}

p = PlotData(data, x='x', y=['y1', 'y2', 'y3'])

#If we now iterate over this object it will result in the data
#for y being returned together with the x data (The same would work the other way around)
for entry in p:
   print(entry.x) #'x' entry
   print(entry.y) #'y1' then 'y2' and finally 'y3'

#Additionally data for z, color and size can be defined
Parameters:

data – object or list of objects which can be bracket indexed with the given keys e.g. dicts, pandas dataframes, …

Same_length:

bool if True and any sources are dicts it will be checked for same dimensions in (ALL) entries (not only for keys plotted against each other)

Strict_data_keys:

bool if True no new data keys are allowed to be entered via copy_data()

Kwargs are used to specify the columns in a namedtuple If a list is given for any of the keys the data will be expanded to a list of namedtuple with the same length

add_data_key(data_key, keys=None)[source]

Add a new column of data keys

Parameters:
  • data_key – string of the new data key to add

  • keys – None, Index into data or list of index into the data to initialize the values to

apply(data_key, lambda_func, apply_to_whole_array=True, **kwargs)[source]

Apply a function to a given data column for all entries

Warning

This operation is done in-place. Meaning if there are multiple data entries pointing to the same data set and only one should be modified by this method, the data needs to be copied beforehand using copy_data()

Parameters:
  • data_key – name of the data key to apply the function

  • lambda_func – function to apply to the data

copy_data(data_key_from, data_key_to, prefix=None, rename_original=False, force=False)[source]

Copy the data for a given data key to another one

Parameters:
  • data_key_from – data key to copy from

  • data_key_to – data key to copy to

  • prefix – optional prefix to use for the renamed data entries. Can be used to avoid name clashes. If not given the data keys are used

  • rename_original – optional bool (default False). If True the original entries are renamed instead of the ones under data_key_to

property data_keys

Return the registered data keys for this instance

distinct_datasets(data_key)[source]

Return how many different data sets are present for the given data key

Parameters:

data_key – The data key to analyse

Returns:

int of the number of different datasets

get_function_result(data_key, func, list_return=False, as_numpy_array=False, **kwargs)[source]

Apply a function to a given data column for all entries and return the results

Parameters:
  • data_key – name of the data key to apply the function to

  • func – function to apply to the data to get the results if func is a string then it will be used to get the attribute with the corresponding name from the source and call it

get_keys(data_key)[source]

Get the keys for a given data column for all entries

Parameters:

data_key – name of the data key to return the keys

Returns:

list of keys, corresponding to the entries for the given data in the sources

get_mask(mask, data_key=None)[source]

Get mask list for use with the Data in this instance

Parameters:
  • mask – either list of callable, if it is callable it is used in get_function_result() together with the data_key argument

  • data_key – str to be used for the data key if mask is a callable

:param

get_values(data_key)[source]

Get the values for a given data column for all entries

Parameters:

data_key – name of the data key to return the values

Returns:

list of values, corresponding to the entries for the given data in the sources

group_data(by, **kwargs)[source]

Group the data by the given data_key(s) or other arguments for groupby

Note

This function will convert the data arguments to pd.Dataframe objects

Parameters:

by – str or list of str of the data_keys to sort by or other valid arguments for by in pd.Dataframe.groupby()

Kwargs are passed on to pd.Dataframe.groupby()

items(first=False, mappable=False)[source]

Iterate over PlotData items. Returns the key and corresponding source for the data

Parameters:
  • first – bool, if True only the first entry is returned

  • mappable – bool, if True only the data ColumnDataSources are wrapped to be mappable

keys(first=False)[source]

Iterate over PlotData keys. Returns the keys for the corresponding sources

Parameters:

first – bool, if True only the first entry is returned

mask_data(mask, data_key=None, replace_value=None)[source]

Apply a given mask to the data inplace.

Note

This function will convert the data arguments to pd.Dataframe objects

Parameters:
max(data_key, separate=False, mask=None, mask_data_key=None)[source]

Get the maximum value for a given data column for all entries

Parameters:
  • data_key – name of the data key to determine the maximum

  • separate – bool if True the maximum will be determined and returned for all entries separately

  • mask – optional mask to select specific rows from the data entries

  • mask_data_key – optional data key to be used when mask is a function

Returns:

maximum value for all entries either combined or as a list

min(data_key, separate=False, mask=None, mask_data_key=None)[source]

Get the minimum value for a given data column for all entries

Parameters:
  • data_key – name of the data key to determine the minimum

  • separate – bool if True the minimum will be determined and returned for all entries separately

  • mask – optional mask to select specific rows from the data entries

  • mask_data_key – optional data key to be used when mask is a function

Returns:

minimum value for all entries either combined or as a list

shift_data(data_key, shifts, shifted_data_key=None, separate_data=True, negative=False)[source]

Apply shifts to a given data column for all entries

Parameters:
  • data_key – name of the data key to shift

  • shifts – float or array of floats with the shifts to apply

  • shifted_data_key – optional string, if given the data will be copied to this data key

  • separate_data – bool, if True and shifted_data_key is not given the data will be copied to itself (This separates the data for all columns)

  • negative – bool if True the shifts are applied with a minus sign

sort_data(by_data_keys, **kwargs)[source]

Sort the data by the given data_key(s)

Note

This function will convert the data arguments to pd.Dataframe objects

Note

If there are multiple plot sets and only one data source. This function will expand the data to be one data source sorted according to the data_keys for each plot

Parameters:

by_data_keys – str or list of str of the data_keys to sort by

Kwargs are passed on to pd.Dataframe.sort_values()

values(first=False)[source]

Iterate over PlotData values. Returns the values for the data

Parameters:

first – bool, if True only the first entry is returned

class masci_tools.vis.data.PlotDataIterator(plot_data, mode='values', mappable=False)[source]

Class containing the iteration behaviour over the PlotData class. Can be used in three modes:

  • keys: Returns the keys to be entered in the corresponding data sources for each entry

  • values: Returns the data for each entry

  • items: Returns the keys and the data sources in a tuple

The keys and values are always returned in a namedtuple with fields corresponding to the set data keys

masci_tools.vis.data.normalize_list_or_array(data, key, out_data, flatten_np=False, forbid_split_up=False)[source]

Split up a given list/numpy array or pd.Series to be used in the plotting methods

Parameters:
  • data – The (array-like) data to be normalized

  • key – key under which to enter the new data

  • out_data – dict containing previously normalized data

  • flatten_np – bool, if True multidimensional numpy arrays are flattened

  • forbid_split_up – bool, if True multidimensional arrays are not split up

The rules are the following:
  • if data is a multidimensional array (list of lists, etc.) and it is not forbidden by the given argument the first dimension of the array is iterated over and interpreted as separate entries (if the data was previously split up into multiple sets a length check is performed)

  • if data is a one-dimensional array and of a different length than the number of defined data sets it is added to all previously existing entries

  • if data is a one-dimensional array and of the same length as the number of defined data sets each entry is added to the corresponding data set

Returns:

list of dicts or dict containing the nomralized data

masci_tools.vis.data.process_data_arguments(data=None, single_plot=False, use_column_source=False, flatten_np=False, forbid_split_up=None, same_length=False, copy_data=False, **kwargs)[source]

Initialize PlotData from np.arrays or lists of np.arrays or lists or a already given data argument, i.e. mapping

Parameters:
  • data – either None or Mapping to be used as the data in the PlotData class

  • single_plot – bool, if True only a single dataset is allowed

  • use_column_source – bool, if True all data arguments are converted to ColumnDataSource of bokeh

  • flatten_np – bool, if True multidimensional numpy arrays are flattened (Only if data not given)

  • forbid_split_up – set of keys for which not to split up multidimensional arrays

  • same_length – bool if True and any sources are dicts it will be checked for same dimensions in (ALL) entries (not only for keys plotted against each other)

  • copy_data – bool, if True the data argument will be copied

Kwargs define which keys belong to which data entries if data is given or they contain the data to be normalized

The following two example calls will both create a PlotData object with the same two plot data sets with the entries x and y:

import numpy as np

x = np.linspace(-10,10,100)
y1 = y**2
y2 = np.sin(x)

#Use a predefined data argument (a dict in this case) and the keys in the kwargs
p = process_data_arguments({'x': x, 'y1': y1, 'y2': y2}, x='x', y=['y1','y2'])

#Let the function normalize the given arrays
p = process_data_arguments=(x=x,y=[y1, y2])
Returns:

A PlotData object corresponding to the given data

Collection of routines to be reused in plotting routines

masci_tools.vis.helpers.exclude_points(plot_data, *data_keys, limits, padding=0.1)[source]

Exclude points outside the given limits

Parameters:
  • plot_data (PlotData) – PlotData instance containing all the data for plots

  • data_keys (str) – str of the keys to consider for excluding points

  • limits (Optional[dict[str, tuple[float, float]]]) – dict of the set plot limits

  • padding (float) – float, determines how far beyond the plot limits a point has to lie to be excluded (default 10%)

Return type:

None

masci_tools.vis.helpers.get_special_kpoint_ticks(kpoints, math_mode='$')[source]

Process the high symmetry kpoints and ggf. replace with appropiate latex symbol

  • Gamma/G is replaced with $Gamma$

Parameters:
  • kpoints (list[tuple[str, float]]) – list of tuples with label and position of the points

  • math_mode (str) – Determines the symbol to enter math mode in latex

Return type:

tuple[list[float], list[str]]

Returns:

Ticks and their respective labels

masci_tools.vis.helpers.mpl_single_line_or_area(axis, entry, source, area=False, area_vertical=False, area_enclosing_line=True, advance_color_cycle=False, area_line_alpha=1.0, **kwargs)[source]

Create a scatterplot, lineplot or area plot for the given entry on the matplotlib axis

Parameters:
  • axis – Axes to plot on

  • entry – namedtuple of the entries to plot

  • source – mapping containing the data to plot

  • area – bool, if True fill_betweenx/y will be used to create an area plot

  • area_vertical – bool, if True fill_betweeny will be used

  • area_enclosing_line – bool if True the area plot will have another line plot around the edge

  • advance_color_cycle – bool, if True the matplotlib color cycle will be advanced no matter what else is specified

  • area_line_alpha – if an area plot is done this is the alpha parameter (transparency)

Kwargs are passed to the respective plotting routines

This modules provides common plotting functions dispatching to different plotting backends. At the moment the following backends are used:

  • matplotlib (‘mpl’, ‘matplotlib’)

  • bokeh (‘bokeh’)

The underlying plotting routines collected here should have the same signature for the data arguments; keyword arguments can be different.

class masci_tools.vis.common.PlotBackend(value)[source]

Enumeration containing the possible names for each plotting backend Initialize using the from_str() method

At the moment the following are supported (case-insensitive)

  • matplotlib: either ‘mpl’ or ‘matplotlib’

  • bokeh: ‘bokeh’

static default()[source]

Return a PlotBackend instance corresponding to the current default backend

static from_str(label)[source]

Initialize the PlotBackend from a given string

Parameters:

label – str to use to initialize the backend if it is None the default is returned

Returns:

PlotBackend instance corresponding to the label

masci_tools.vis.common.bands(kpath, eigenvalues, backend=None, data=None, **kwargs)[source]

Plot the provided data for a bandstructure (non spin-polarized) Non-weighted, weighted, as a line plot or scatter plot, color-mapped or fixed colors are all possible options

Parameters:
  • kpath – data for the kpoints path (flattened to 1D)

  • eigenvalues – data for the eigenvalues

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

masci_tools.vis.common.dos(energy_grid, dos_data, backend=None, data=None, **kwargs)[source]

Plot the provided data as a density of states (not spin-polarized). Can be done horizontally or vertical via the switch xyswitch

Parameters:
  • energy_grid – data for the energy grid of the DOS

  • dos_data – data for all the DOS components to plot

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

masci_tools.vis.common.get_help(key, backend=None)[source]

Get a help string for a given parameter.

Parameters:
  • key – name of the parameter to get the parameter for

  • backend – For which backend to get the description of the parameter

masci_tools.vis.common.get_plotter(backend=None)[source]

Get the instance of the Plotter subclass used for the given plotting backend

Parameters:

backend – For which backend to get the Plotter instance

masci_tools.vis.common.line(xdata, ydata, backend=None, data=None, **kwargs)[source]

Plot the provided data as a line plot. Multiple data sets are possible

Parameters:
  • xdata – data for the x-axis

  • xdata – data for the y-axis

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

masci_tools.vis.common.load_defaults(backend=None, filename='plot_defaults.json')[source]

Load defaults for the plot parameters from a file and set the contained defaults.

Parameters:
  • backend – For which backend to save the parameters

  • filename – str of the filename to load the defaults from

masci_tools.vis.common.reset_defaults(backend=None)[source]

Reset the defaults for theplot parameters to the original state.

Parameters:

backend – For which backend to reset the parameters

masci_tools.vis.common.save_defaults(backend=None, filename='plot_defaults.json', save_complete=False)[source]

Save the defaults for the plot parameters.

Parameters:
  • backend – For which backend to save the parameters

  • filename – str of the filename to save the defaults to

  • save_complete – bool, if True also the hardcoded defaults are included

masci_tools.vis.common.scatter(xdata, ydata, backend=None, data=None, **kwargs)[source]

Plot the provided data as a scatter plot. Varying size and color are possible. Multiple data sets are possible

Parameters:
  • xdata – data for the x-axis

  • xdata – data for the y-axis

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

masci_tools.vis.common.set_default_backend(backend)[source]

Sets the default backend used when no explicit backend is specified.

Parameters:

backend – Name of the backend to use

masci_tools.vis.common.set_defaults(backend=None, **kwargs)[source]

Sets defaults for the plot parameters.

Parameters:

backend – For which backend to set the parameters

The Kwargs are used to set the parameters of the specified backend

masci_tools.vis.common.show_defaults(backend=None)[source]

Show the current set defaults for the plot parameters.

Parameters:

backend – For which backend to show the parameters

masci_tools.vis.common.spinpol_bands(kpath, eigenvalues_up, eigenvalues_dn, backend=None, data=None, **kwargs)[source]

Plot the provided data for a bandstructure (spin-polarized) Non-weighted, weighted, as a line plot or scatter plot, color-mapped or fixed colors are all possible options

Parameters:
  • kpath – data for the kpoints path (flattened to 1D)

  • eigenvalues_up – data for the eigenvalues for spin-up

  • eigenvalues_dn – data for the eigenvalues for spin-down

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

masci_tools.vis.common.spinpol_dos(energy_grid, dos_data_up, dos_data_dn, backend=None, data=None, **kwargs)[source]

Plot the provided data as a density of states (spin-polarized). Can be done horizontally or vertical via the switch xyswitch

Parameters:
  • energy_grid – data for the energy grid of the DOS

  • dos_data_up – data for all the DOS components to plot for spin-up

  • dos_data_dn – data for all the DOS components to plot for spin-down

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • backend – name of the backend to use (uses a default if None is given)

Kwargs are passed on to the backend plotting functions:

Returns:

Figure object for the used plotting backend

Matplotlib

This module contains a subclass of Plotter for the matplotlib library

class masci_tools.vis.matplotlib_plotter.MatplotlibPlotter(**kwargs)[source]

Class for plotting parameters and standard code snippets for plotting with the matplotlib backend.

Kwargs in the __init__ method are forwarded to setting default values for the instance

For specific documentation about the parameter/defaults handling refer to Plotter.

Below the current defined default values are shown:

Plot Parameters

Name

Description

Default value

title_fontsize

Fontsize for the title of the figure

16

figure_kwargs

Arguments passed to plt.figure when creating the figure. Includes things like figsize, dpi, background color, …

{'figsize': (8, 6),
'dpi': 100,
'facecolor': 'w',
'edgecolor': 'k',
'constrained_layout': True}

alpha

Float specifying the transparency of the title

1

axis_linewidth

Linewidth of the lines for the axis

1.5

use_axis_formatter

If True the labels will always not be formatted with an additive constant at the top

False

set_powerlimits

If True the threshold for switching to scientific notation is adjusted to 0,3

True

xticks

Positions of the ticks on the x axis

No Default

xticklabels

Labels for the ticks on the x-axis

No Default

yticks

Positions for the ticks on the y-axis

No Default

yticklabels

Labels for the ticks on the y-axis

No Default

invert_xaxis

If True the direction of the x-axis is inverted

False

invert_yaxis

If True the direction of the y-axis is inverted

False

color_cycle

If set this will override the default color cycle of matplotlib. Can be given as name of a colormap cycle or list of colors

No Default

color_cycle_always_advance

Always advance the color cycle even if the color was specified

False

sub_colormap

If a colormap is used this can be used to cut out a part of the colormap. For example (0.5,1.0) will only use the upper half of the colormap

No Default

linewidth

Linewidth for the plot(s)

2.0

linestyle

Linestyle for the plot(s)

-

marker

Shape of the marker to use for the plot(s)

o

markersize

Size of the markers to use in the plot(s)

4.0

color

Color to use in the plot(s)

No Default

zorder

z-position to use for the plot(s) (Is used to define fore- and background)

No Default

repeat_parameters

If set as integer the parameters for single plots (except labels) will be repeated after the given number of plots. Only implemented for multiple_scatterplots

No Default

edgecolor

Edgecolor to use in the plot(s)

No Default

facecolor

Facecolor to use in the plot(s)

No Default

plot_label

Label to use in the plot(s) for the legend

No Default

area_plot

If True fill_between(x) will be used to produce the plot(s)

False

area_vertical

Determines, whether to use fill_between or fill_betweenx for area plots

False

area_enclosing_line

If True a enclosing line will be drawn around the area

True

area_alpha

Transparency to use for the area in the area plot(s)

1.0

area_linecolor

Color for the enclosing line in the area plot(s)

No Default

plot_alpha

Transparency to use for the plot(s)

1.0

cmap

Colormap to use for scatter/pcolormesh or 3D plots

viridis

norm

If set this norm will be used to normalize data for the colormapping

No Default

shading

Shading to use for pcolormesh plots

gouraud

rasterized

Rasterize the pcolormesh when drawing vector graphics.

True

scale

Dict specifying the scales of the axis, e.g {'y': 'log'} will create a logarithmic scale on the y-axis

No Default

limits

Dict specifying the limits of the axis, e.g {'x': (-5,5)}

No Default

labelfontsize

Fontsize for the labels on the axis

15

lines

Dict specifying straight help-lines to draw. For example {'vertical': 0, 'horizontal': [-1,1]} will draw a vertical line at 0 and two horizontal at -1 and 1

No Default

line_options

Color, width, and more options for the help-lines

{'linestyle': '--',
'color': 'k',
'linewidth': 1.0}

font_options

Default font options that can be used for text annotations

{'family': 'serif',
'color': 'black',
'weight': 'normal',
'size': 16}

tick_paramsx

Parameters for major ticks on the x-axis (Size, fontsize, …)

{'size': 4.0,
'width': 1.0,
'labelsize': 14,
'length': 5,
'labelrotation': 0}

tick_paramsy

Parameters for major ticks on the y-axis (Size, fontsize, …)

{'size': 4.0,
'width': 1.0,
'labelsize': 14,
'length': 5,
'labelrotation': 0}

tick_paramsx_minor

Parameters for minor ticks on the x-axis (Size, fontsize, …)

{'size': 2.0,
'width': 1.0,
'labelsize': 0,
'length': 2.5}

tick_paramsy_minor

Parameters for minor ticks on the y-axis (Size, fontsize, …)

{'size': 2.0,
'width': 1.0,
'labelsize': 0,
'length': 2.5}

colorbar

If True and the function implements color mapping, a colorbar is shown

True

colorbar_options

Parameters for displaying the colorbar (Fontsize, …)

{'pad': 0.05}

legend

If True a legend for the plot is shown

False

legend_show_data_labels

If True the column names from the data argument are shown if not overwritten

False

legend_remove_duplicates

If True duplicate legend labels are removed

False

legend_options

Parameters for displaying the legend (Fontsize, location, …)

{'fontsize': 'large',
'linewidth': 3.0,
'loc': 'best',
'fancybox': True}

save_plots

if True the plots will be saved to file

False

save_format

Formats to save the plots to, can be single or list of formats

png

save_options

Additional options for saving the plots to file

{'transparent': True}

tightlayout

If True the tight layout will be used (NOT IMPLEMENTED)

False

show

If True plt.show will be called at the end of the routine

True

save_raw_plot_data

If True the data for the plot is saved to file (NOT IMPLEMENTED)

False

raw_plot_data_format

Format in which to save the data for the plot (NOT IMPLEMENTED)

txt

draw_lines(ax)[source]

Draw horizontal and vertical lines specified in the lines argument

Parameters:

ax – Axes object on which to perform the operation

plot_kwargs(plot_type='default', ignore=None, extra_keys=None, post_process=True, list_of_dicts=True, **kwargs)[source]

Creates a dict or list of dicts (for multiple plots) with the defined parameters for the plotting calls of matplotlib

Parameters:
  • ignore – str or list of str (optional), defines keys to ignore in the creation of the dict

  • extra_keys – optional set for additional keys to retrieve

  • post_process – bool, if True the parameters are cleaned up for inserting them directly into matplotlib plitting functions

Kwargs are used to replace values by custom parameters:

Example for using a custom markersize:

p = MatplotlibPlotter()
p.add_parameter('marker_custom', default_from='marker')
p.plot_kwargs(marker='marker_custom')

This code snippet will return the standard parameters for a plot, but the value for the marker will be taken from the key marker_custom

prepare_plot(title=None, xlabel=None, ylabel=None, zlabel=None, axis=None, minor=False, projection=None)[source]

Prepares the figure of a matplotlib plot, setting the labels/titles, ticks, …

Parameters:
  • title – str for the title of the figure

  • xlabel – str for the label on the x-axis

  • ylabel – str for the label on the y-axis

  • zlabel – str for the label on the z-axis

  • axis – matplotlib axes object, optional, if given the operations are performed on the object otherwise a new figure and subplot are created

  • minor – bool, if True minor tick parameters are set

  • projection – str, passed on to the add_subplot call

Returns:

the created or modified axis object

save_plot(saveas)[source]

Save the current figure or show the current figure

Parameters:

saveas – str, filename for the resulting file

set_limits(ax)[source]

Set limits of the axis

Parameters:

ax – Axes object on which to perform the operation

set_scale(ax)[source]

Set scale of the axis (for example ‘log’)

Parameters:

ax – Axes object on which to perform the operation

show_colorbar(ax)[source]

Print a colorbar for the plot

Parameters:

ax – Axes object on which to perform the operation

show_legend(ax, leg_elems=None)[source]

Print a legend for the plot

Parameters:

ax – Axes object on which to perform the operation

static truncate_colormap(cmap, minval=0.0, maxval=1.0, n=256)[source]

Cut off parts of colormap

Parameters:
  • cmap – cmap to truncate

  • minval – minimum value of new colormap

  • maxval – maximum value of new colormap

  • n – number of colors in new colormap

Returns:

colormap truncated to only hold colors between minval and maxval from old colormap

In this module are plot routines collected to create default plots out of certain output nodes from certain workflows with matplot lib.

Comment: Do not use any aiida methods, otherwise the methods in here can become tricky to use inside a virtual environment. Make the user extract thing out of aiida objects before hand or write something on top. Since usually parameter nodes, or files are plotted, parse a dict or filepath.

Each of the plot_methods can take keyword arguments to modify parameters of the plots There are keywords that are handled by a special class for defaults. All other arguments will be passed on to the matplotlib plotting calls

For the definition of the defaults refer to MatplotlibPlotter

masci_tools.vis.plot_methods.CDF_voigt_profile(x, fwhm_g, fwhm_l, mu)[source]

Cumulative distribution function of a voigt profile implementation of formula found here: https://en.wikipedia.org/wiki/Voigt_profile # TODO: is there an other way then to calc 2F2? # or is there an other way to calc the integral of wofz directly, or use different error functions.

class masci_tools.vis.plot_methods.PDF(pdf, size=(200, 200))[source]

Display a PDF file inside a Jupyter notebook.

masci_tools.vis.plot_methods.asymmetric_lorentz(x, fwhm, mu, alpha=1.0, beta=1.5)[source]

asymmetric lorentz function

L^alpha for x<=mu L^beta for x>mu See casexps LA

masci_tools.vis.plot_methods.asymmetric_lorentz_gauss_conv(x, mu, fwhm_l, fwhm_g, alpha=1.0, beta=1.5)[source]

asymmetric Lorentzian with Gauss convoluted

masci_tools.vis.plot_methods.asymmetric_lorentz_gauss_sum(x, mu, fwhm_l, fwhm_g, alpha=1.0, beta=1.5)[source]

asymmetric Lorentzian with Gauss convoluted

masci_tools.vis.plot_methods.barchart(positions, heights, *, width=0.35, xlabel='x', ylabel='y', title='', bottom=None, alignment='vertical', saveas='barchart', bar_type='stacked', axis=None, xerr=None, yerr=None, data=None, copy_data=False, **kwargs)[source]

Create a standard bar chart plot (this should be flexible enough) to do all the basic bar chart plots.

Parameters:
  • positions – arraylike data for the positions of the bars

  • heights – arraylike data for the heights of the bars

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • width – float determines the width of the bars

  • axis – Axes object where to add the plot

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • xerr – optional data for errorbar in x-direction

  • yerr – optional data for errorbar in y-direction

  • bottom – bottom values for the lowest end of the bars

  • bar_type – type of the barchart plot. Either stacked, grouped or independent

  • alignment – which direction the bars should be plotted (horizontal or vertical)

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function bar

TODO: grouped barchart (meaning not stacked)

masci_tools.vis.plot_methods.colormesh_plot(xdata, ydata, cdata, *, xlabel='', ylabel='', title='', data=None, saveas='colormesh', axis=None, copy_data=False, **kwargs)[source]

Create plot with pcolormesh

Parameters:
  • xdata – arraylike, data for the x coordinate

  • ydata – arraylike, data for the y coordinate

  • cdata – arraylike, data for the color values with a colormap

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • title – str, title of the figure

  • saveas – str specifying the filename (without file format)

  • axis – Axes object, if given the plot will be applied to this object

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function pcolormesh

masci_tools.vis.plot_methods.construct_corelevel_spectrum(coreleveldict, natom_typesdict, exp_references=None, scale_to=-1, fwhm_g=0.6, fwhm_l=0.1, energy_range=None, xspec=None, energy_grid=0.2, peakfunction='voigt', alpha_l=1.0, beta_l=1.5)[source]

Constructrs a corelevel spectrum from a given corelevel dict

Params:

Returns:

list: [xdata_spec, ydata_spec, ydata_single_all, xdata_all, ydata_all, xdatalabel]

masci_tools.vis.plot_methods.default_histogram(*args, **kwargs)[source]

Create a standard looking histogram (DEPRECATED)

masci_tools.vis.plot_methods.doniach_sunjic(x, scale=1.0, E_0=0, gamma=1.0, alpha=0.0)[source]

Doniach Sunjic asymmetric peak function. tail to higher binding energies.

param x: list values to evaluate this function param scale: multiply the function with this factor param E_0: position of the peak param gamma, ‘lifetime’ broadening param alpha: ‘asymmetry’ parametera

See Doniach S. and Sunjic M., J. Phys. 4C31, 285 (1970) or http://www.casaxps.com/help_manual/line_shapes.htm

masci_tools.vis.plot_methods.gauss_one(x, fwhm, mu)[source]

Returns a Lorentzian line shape at x with FWHM fwhm and mean mu

masci_tools.vis.plot_methods.gaussian(x, fwhm, mu)[source]

Returns Gaussian line shape at x with FWHM fwhm and mean mu

masci_tools.vis.plot_methods.get_mpl_help(key)[source]

Print the description of the given key in the matplotlib backend

Available defaults can be seen in MatplotlibPlotter

masci_tools.vis.plot_methods.histogram(xdata, density=False, histtype='bar', align='mid', orientation='vertical', log=False, axis=None, title='hist', xlabel='bins', ylabel='counts', saveas='histogram', return_hist_output=False, data=None, copy_data=False, **kwargs)[source]

Create a standard looking histogram

Parameters:
  • xdata – arraylike, Data for the histogram

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • density – bool, if True the histogram is normed and a normal distribution is plotted with the same mu and sigma as the data

  • histtype – str, type of the histogram

  • align – str, defines where the bars for the bins are aligned

  • orientation – str, is the histogram vertical or horizontal

  • log – bool, if True a logarithmic scale is used for the counts

  • axis – Axes object where to add the plot

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • return_hist_output – bool, if True the data output from hist will be returned

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function hist

masci_tools.vis.plot_methods.hyp2f2(a, b, z)[source]

Calculation of the 2F2() hypergeometric function, since it is not part of scipy with the identity 2. from here: https://en.wikipedia.org/wiki/Generalized_hypergeometric_function a, b,z array like inputs TODO: not clear to me how to do this… the identity is only useful if we mange the adjust the arguments in a way that we can use them… also maybe go for the special case we need first: 1,1,3/2;2;-z2

masci_tools.vis.plot_methods.load_mpl_defaults(filename='plot_mpl_defaults.json')[source]

Load defaults for the matplotlib backend from a json file.

Parameters:

filename – filename,from where the defaults should be taken

masci_tools.vis.plot_methods.lorentzian(x, fwhm, mu)[source]

Returns a Lorentzian line shape at x with FWHM fwhm and mean mu

masci_tools.vis.plot_methods.lorentzian_one(x, fwhm, mu)[source]

Returns a Lorentzian line shape at x with FWHM fwhm and mean mu

masci_tools.vis.plot_methods.multi_scatter_plot(xdata, ydata, *, size_data=None, color_data=None, xlabel='', ylabel='', title='', data=None, saveas='mscatterplot', axis=None, copy_data=False, exclude_points_outside_plot_area=False, **kwargs)[source]

Create a scatter plot with varying marker size Info: x, y, size and color data must have the same dimensions.

Parameters:
  • xdata – str or arraylike, data for the x coordinate

  • ydata – str or arraylike, data for the y coordinate

  • size_data – str or arraylike, data for the markersizes (optional)

  • color_data – str or arraylike, data for the color values with a colormap (optional)

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • title – str, title of the figure

  • data – Mapping giving the data for the plots (required if data arguments are str)

  • saveas – str specifying the filename (without file format)

  • axis – Axes object, if given the plot will be applied to this object

  • xerr – optional data for errorbar in x-direction

  • yerr – optional data for errorbar in y-direction

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function scatter

masci_tools.vis.plot_methods.multiaxis_scatterplot(xdata, ydata, *, axes_loc, xlabel='', ylabel='', title='', num_cols=1, num_rows=1, saveas='mscatterplot', **kwargs)[source]

Create a scatter plot with multiple axes.

Parameters:
  • xdata – list of arraylikes, passed on to the plotting functions for each axis (x-axis)

  • ydata – list of arraylikes, passed on to the plotting functions for each axis (y-axis)

  • axes_loc – list of tuples of two integers, location of each axis

  • xlabel – str or list of str, labels for the x axis

  • ylabel – str or list of str, labels for the y-axis

  • title – str or list of str, titles for the subplots

  • num_rows – int, how many rows of axis are created

  • num_cols – int, how many columns of axis are created

  • saveas – str filename of the saved file

Special Kwargs:
param subplot_params:

dict with integer keys, can contain all valid kwargs for multiple_scatterplots() with the integer key denoting to which subplot the changes are applied

param axes_kwargs:

dict with integer keys, additional arguments to pass on to subplot2grid for the creation of each axis (e.g colspan, rowspan)

Other Kwargs will be passed on to all multiple_scatterplots() calls (If they are not overwritten by parameters in subplot_params).

masci_tools.vis.plot_methods.multiple_scatterplots(xdata, ydata, *, xlabel='', ylabel='', title='', data=None, saveas='mscatterplot', axis=None, xerr=None, yerr=None, area_curve=0, copy_data=False, exclude_points_outside_plot_area=False, **kwargs)[source]

Create a standard scatter plot with multiple sets of data (this should be flexible enough) to do all the basic plots.

Parameters:
  • xdata – str or arraylike, data for the x coordinate

  • ydata – str or arraylike, data for the y coordinate

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, title of the figure

  • data – Mapping giving the data for the plots (required if xdata and ydata are str)

  • saveas – str specifying the filename (without file format)

  • axis – Axes object, if given the plot will be applied to this object

  • xerr – optional data for errorbar in x-direction

  • yerr – optional data for errorbar in y-direction

  • area_curve – if an area plot is made this arguments defines the other enclosing line defaults to 0

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib functions (errorbar or fill_between)

masci_tools.vis.plot_methods.multiplot_moved(xdata, ydata, *, xlabel='', ylabel='', title='', data=None, scale_move=1.0, min_add=0, saveas='mscatterplot', copy_data=False, **kwargs)[source]

Plots all the scatter plots above each other. It adds an arbitrary offset to the ydata to do this and calls multiple_scatterplots. Therefore you might not want to show the yaxis ticks

Parameters:
  • xdata – arraylike, data for the x coordinate

  • ydata – arraylike, data for the y coordinate

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • title – str, title of the figure

  • scale_move – float, max*scale_move determines size of the shift

  • min_add – float, minimum shift

  • saveas – str specifying the filename (without file format)

  • copy_data – bool, if True the data argument will be copied

Kwargs are passed on to the multiple_scatterplots() call

masci_tools.vis.plot_methods.plot_bands(kpath, bands, *, data=None, size_data=None, color_data=None, special_kpoints=None, e_fermi=0, xlabel='', ylabel='$E-E_F$ [eV]', title='', saveas='bandstructure', markersize_min=0.5, markersize_scaling=5.0, scale_color=True, separate_bands=False, line_plot=False, band_index=None, copy_data=False, **kwargs)[source]

Plot the provided data for a bandstrucuture (non spin-polarized). Can be used to illustrate weights on bands via size_data

Parameters:
  • kpath – arraylike data for the kpoint data

  • bands – arraylike data for the eigenvalues

  • size_data – arraylike data the weights to emphasize (optional)

  • color_data – str or arraylike, data for the color values with a colormap (optional)

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • markersize_min – minimum value used in scaling points for weight

  • markersize_scaling – factor used in scaling points for weight

  • scale_color – bool, if True (default) the weight will be additionally shown via a colormapping

  • line_plot – bool, if True the bandstructure will be plotted with lines Here no weights are supported

  • separate_bands – bool, if True the bandstructure will be separately plotted for each band allows more specific parametrization

  • band_index – data for which eigenvalue belongs to which band (needed for line_plot and separate_bands)

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the multi_scatter_plot() call

masci_tools.vis.plot_methods.plot_colortable(colors, title, sort_colors=False, emptycols=0)[source]

Plot a legend of named colors.

Reference: https://matplotlib.org/3.1.0/gallery/color/named_colors.html

Parameters:
  • colors (Dict) – a dict color_name : color_value (hex str, rgb tuple, …)

  • title (str) – plot title

  • sort_colors (bool) – True: sort legend entries not by dict position, but by color hue, staturation, value.

  • emptycols (int) –

Returns:

figure

masci_tools.vis.plot_methods.plot_convergence(iteration, distance, total_energy, *, data=None, saveas_energy='energy_convergence', saveas_distance='distance_convergence', axis_energy=None, axis_distance=None, xlabel='Iteration', ylabel_energy='Total energy difference [Htr]', ylabel_distance='Distance [me/bohr^3]', title_energy='Total energy difference over scf-Iterations', title_distance='Convergence (log)', copy_data=False, drop_last_iteration=False, **kwargs)[source]

Plot the total energy differences versus the scf iteration and plot the distance of the density versus iterations.

Parameters:
  • iteration – data for the number of iterations

  • distance – data of distances

  • total_energy – data of total energies

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label for the x-axis of both plots

  • saveas_energy – str, filename for the energy convergence plot

  • axis_energy – Axes object for the energy convergence plot

  • title_energy – str, title for the energy convergence plot

  • ylabel_energy – str, label for the y-axis for the energy convergence plot

  • saveas_distance – str, filename for the distance plot

  • axis_distance – Axes object for the distance plot

  • title_distance – str, title for the distance plot

  • ylabel_distance – str, label for the y-axis for the distance plot

  • copy_data – bool if True the data argument is copied

  • drop_last_iteration – bool if True the last iteration is dropped for the distance plot

Other Kwargs will be passed on to all multiple_scatterplots() calls

masci_tools.vis.plot_methods.plot_convergence_results(iteration, distance, total_energy, *, saveas1='t_energy_convergence', axis1=None, saveas2='distance_convergence', axis2=None, **kwargs)[source]

DEPRECATED Plot the total energy versus the scf iteration and plot the distance of the density versus iterations.

Parameters:
  • iteration – array for the number of iterations

  • distance – array of distances

  • total_energy – array of total energies

  • saveas1 – str, filename for the energy convergence plot

  • axis1 – Axes object for the energy convergence plot

  • saveas2 – str, filename for the distance plot

  • axis2 – Axes object for the distance plot

Other Kwargs will be passed on to all single_scatterplot() calls

masci_tools.vis.plot_methods.plot_convergence_results_m(iterations, distances, total_energies, *, modes, nodes=None, saveas1='t_energy_convergence', saveas2='distance_convergence', axis1=None, axis2=None, **kwargs)[source]

DEPRECATED Plot the total energy versus the scf iteration and plot the distance of the density versus iterations.

Parameters:
  • iterations – array for the number of iterations

  • distances – array of distances

  • total_energies – array of total energies

  • modes – list of convergence modes (if ‘force’ is in the list the last distance is removed)

  • saveas1 – str, filename for the energy convergence plot

  • axis1 – Axes object for the energy convergence plot

  • saveas2 – str, filename for the distance plot

  • axis2 – Axes object for the distance plot

Other Kwargs will be passed on to all multiple_scatterplots() calls

masci_tools.vis.plot_methods.plot_convex_hull2d(hull, *, title='Convex Hull', xlabel='Atomic Percentage', ylabel='Formation energy / atom [eV]', saveas='convex_hull', axis=None, **kwargs)[source]

Plot method for a 2d convex hull diagram

Parameters:
  • hull – pyhull.Convexhull #scipy.spatial.ConvexHull

  • axis – Axes object where to add the plot

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

Function specific parameters:
param marker_hull:

defaults to marker, marker type for the hull plot

param markersize_hull:

defaults to markersize, markersize for the hull plot

param color_hull:

defaults to color, color for the hull plot

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib functions plot

masci_tools.vis.plot_methods.plot_corelevel_spectra(coreleveldict, natom_typesdict, exp_references=None, scale_to=-1, show_single=True, show_ref=True, energy_range=None, title='', fwhm_g=0.6, fwhm_l=0.1, energy_grid=0.2, peakfunction='voigt', linestyle_spec='-', marker_spec='o', color_spec='k', color_single='g', xlabel='Binding energy [eV]', ylabel='Intensity [arb] (natoms*nelectrons)', saveas=None, xspec=None, alpha_l=1.0, beta_l=1.0, **kwargs)[source]

Plotting function of corelevel in the form of a spectrum.

Convention: Binding energies are positive!

Args:

coreleveldict: dict of corelevels with a list of corelevel energy of atomstypes # (The given corelevel accounts for a weight (number of electrons for full occupied corelevel) in the plot.) natom_typesdict: dict with number of atom types for each entry

Kwargs:

exp_references: dict with experimental references, will be ploted as vertical lines show_single (bool): plot all single peaks. scale_to float: the maximum ‘intensity’ will be scaled to this value (useful for experimental comparisons) title (string): something for labeling fwhm (float): full width half maximum of peaks (gauss, lorentz or voigt_profile) energy_grid (float): energy resolution linetyp_spec : linetype for spectrum peakfunction (string): what the peakfunction should be {‘voigt’, ‘pseudo-voigt’, ‘lorentz’, ‘gaus’}

example:

coreleveldict = {u’Be’: {‘1s1/2’ : [-1.0220669053033051, -0.3185614920138805,-0.7924091040092139]}} n_atom_types_Be12Ti = {‘Be’ : [4,4,4]}

masci_tools.vis.plot_methods.plot_corelevels(coreleveldict, compound='', axis=None, saveas='scatterplot', **kwargs)[source]

Plotting function to visualize corelevels and corelevel shifts

masci_tools.vis.plot_methods.plot_dos(energy_grid, dos_data, *, data=None, saveas='dos_plot', energy_label='$E-E_F$ [eV]', dos_label='DOS [1/eV]', title='Density of states', xyswitch=False, e_fermi=0, copy_data=False, **kwargs)[source]

Plot the provided data for a density of states (not spin-polarized). Can be done horizontally or vertical via the switch xyswitch

Parameters:
  • energy_grid – arraylike data for the energy grid of the DOS

  • dos_data – arraylike data for all the DOS components to plot

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • energy_label – str, label for the energy-axis

  • dos_label – str, label for the DOS-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • xyswitch – bool if True, the enrgy axis will be plotted vertically

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the multiple_scatterplots() call

masci_tools.vis.plot_methods.plot_lattice_constant(scaling, total_energy, *, fit_data=None, data=None, relative=True, ref_const=None, title='Equation of states', saveas='lattice_constant', axis=None, copy_data=False, **kwargs)[source]

Plot a lattice constant versus Total energy Plot also the fit. On the x axis is the scaling, it

Parameters:
  • scaling – arraylike, data for the scaling factor

  • total_energy – arraylike, data for the total energy

  • fit_data – arraylike, optional data of fitted data

  • relative – bool, scaling factor given (True), or lattice constants given?

  • ref_const – float (optional), or list of floats, lattice constant for scaling 1.0

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • copy_data – bool if True the data argument will be copied

Function specific parameters:
param marker_fit:

defaults to marker, marker type for the fit data

param markersize_fit:

defaults to markersize, markersize for the fit data

param linewidth_fit:

defaults to linewidth, linewidth for the fit data

param plotlabel_fit:

str label for the fit data

Other Kwargs will be passed on to multiple_scatterplots()

masci_tools.vis.plot_methods.plot_one_element_corelv(corelevel_dict, element, compound='', axis=None, saveas='scatterplot', **kwargs)[source]

This routine creates a plot which visualizes all the binding energies of one element (and currently one corelevel) for different atomtypes.

example:

corelevels = {‘W’ : {‘4f7/2’ : [123, 123.3, 123.4 ,123.1], ‘4f5/2’ : [103, 103.3, 103.4, 103.1]}, ‘Be’ : {‘1s’: [118, 118.2, 118.4, 118.1, 118.3]}}

masci_tools.vis.plot_methods.plot_relaxation_results()[source]

Plot from the result node of a relaxation workflow, All forces of every atom type versus relaxation cycle. Average force of all atom types versus relaxation cycle. Absolute relaxation in Angstroem of every atom type. Relative realxation of every atom type to a reference structure. (if none given use the structure from first relaxation cycle as reference)

masci_tools.vis.plot_methods.plot_residuen(xdata, fitdata, realdata, *, errors=None, xlabel='Energy [eV]', ylabel='cts/s [arb]', title='Residuen', saveas='residuen', hist=True, return_residuen_data=True, **kwargs)[source]

Calculates and plots the residuen for given xdata fit results and the real data.

If hist=True also the normed residual distribution is ploted with a normal distribution.

Parameters:
  • xdata – arraylike data for the x-coordinate

  • fitdata – arraylike fitted data for the y-coordinate

  • realdata – arraylike data to plot residuen against the fit

  • errors – dict, can be used to provide errordata for the x and y direction

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • title – str, title for the plot

  • saveas – str, filename for the saved plot

  • hist – bool, if True a normed residual distribution is ploted with a normal distribution.

  • return_residuen_data – bool, if True in addition to the produced axis object also the residuen data is returned

Special Kwargs:
param hist_kwargs:

dict, these arguments will be passed on to the histogram() call (if hist=True)

Other Kwargs will be passed on to all single_scatterplot() call

masci_tools.vis.plot_methods.plot_spectral_function(kpath, energy_grid, spectral_function, *, data=None, special_kpoints=None, e_fermi=0, xlabel='', ylabel='$E-E_F$ [eV]', title='', saveas='spectral_function', copy_data=False, **kwargs)[source]

Create a colormesh plot of a spectral function

Parameters:
  • kpath – data for the kpoint coordinates

  • energy_grid – data for the energy grid

  • spectral_function – 2D data for the spectral function

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the colormesh_plot() call

masci_tools.vis.plot_methods.plot_spinpol_bands(kpath, bands_up, bands_dn, *, size_data=None, color_data=None, data=None, show_spin_pol=True, special_kpoints=None, e_fermi=0, xlabel='', ylabel='$E-E_F$ [eV]', title='', saveas='bandstructure', markersize_min=0.5, markersize_scaling=5.0, scale_color=True, line_plot=False, separate_bands=False, band_index=None, copy_data=False, **kwargs)[source]

Plot the provided data for a bandstrucuture (spin-polarized). Can be used to illustrate weights on bands via size_data

Parameters:
  • kpath – arraylike data for the kpoint data

  • bands_up – arraylike data for the eigenvalues (spin-up)

  • bands_dn – arraylike data for the eigenvalues (spin-dn)

  • size_data – arraylike data the weights to emphasize BOTH SPINS (optional)

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • markersize_min – minimum value used in scaling points for weight

  • markersize_scaling – factor used in scaling points for weight

  • show_spin_pol – bool, if True (default) the two different spin channels will be shown in blue and red by default

  • scale_color – bool, if True (default) the weight will be additionally shown via a colormapping

  • line_plot – bool, if True the bandstructure will be plotted with lines Here no weights are supported

  • separate_bands – bool, if True the bandstructure will be separately plotted for each band allows more specific parametrization

  • band_index – data for which eigenvalue belongs to which band (needed for line_plot and separate_bands)

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the multi_scatter_plot() call

masci_tools.vis.plot_methods.plot_spinpol_dos(energy_grid, spin_up_data, spin_dn_data, *, data=None, saveas='spinpol_dos_plot', energy_label='$E-E_F$ [eV]', dos_label='DOS [1/eV]', title='Density of states', xyswitch=False, e_fermi=0, spin_dn_negative=True, spin_arrows=True, copy_data=False, **kwargs)[source]

Plot the provided data for a density of states (spin-polarized). Can be done horizontally or vertical via the switch xyswitch

Parameters:
  • energy_grid – arraylike data for the energy grid of the DOS

  • spin_up_data – arraylike data for all the DOS spin-up components to plot

  • spin_dn_data – arraylike data for all the DOS spin-down components to plot

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • energy_label – str, label for the energy-axis

  • dos_label – str, label for the DOS-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • xyswitch – bool if True, the enrgy axis will be plotted vertically

  • energy_grid_dn – arraylike data for the energy grid of the DOS of the spin-down component (optional)

  • spin_dn_negative – bool, if True (default) the spin-down components are plotted downwards

  • spin_arrows – bool, if True (default) small arrows will be plotted on the left side of the plot indicating the spin directions (if spin_dn_negative is True)

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the multiple_scatterplots() call

masci_tools.vis.plot_methods.pseudo_voigt_profile(x, fwhm_g, fwhm_l, mu, mix=0.5)[source]

Linear combination of gaussian and loretzian instead of convolution

Args:

x: array of floats fwhm_g: FWHM of gaussian fwhm_l: FWHM of Lorentzian mu: Mean mix: ratio of gauss to lorentz, mix* gauss, (1-mix)*Lorentz

masci_tools.vis.plot_methods.reset_mpl_plot_defaults()[source]

Reset the defaults for matplotib backend to the hardcoded defaults

Available defaults can be seen in MatplotlibPlotter

masci_tools.vis.plot_methods.save_mpl_defaults(filename='plot_mpl_defaults.json', save_complete=False)[source]

Save the current defaults for the matplotlib backend to a json file.

Parameters:
  • filename – filename, where the defaults should be stored

  • save_complete – bool if True not only the overwritten user defaults but also the unmodified hardcoded defaults are stored

masci_tools.vis.plot_methods.set_mpl_plot_defaults(**kwargs)[source]

Set defaults for matplotib backend according to the given keyword arguments

Available defaults can be seen in MatplotlibPlotter

masci_tools.vis.plot_methods.show_mpl_plot_defaults()[source]

Show the currently set defaults for matplotib backend to the hardcoded defaults

Available defaults can be seen in MatplotlibPlotter

masci_tools.vis.plot_methods.single_scatterplot(xdata, ydata, *, xlabel='', ylabel='', title='', data=None, saveas='scatterplot', axis=None, xerr=None, yerr=None, area_curve=0, copy_data=False, **kwargs)[source]

Create a standard scatter plot (this should be flexible enough) to do all the basic plots.

Parameters:
  • xdata – str or arraylike, data for the x coordinate

  • ydata – str or arraylike, data for the y coordinate

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • title – str, title of the figure

  • data – Mapping giving the data for the plot (required if xdata and ydata are str)

  • saveas – str specifying the filename (without file format)

  • axis – Axes object, if given the plot will be applied to this object

  • xerr – optional data for errorbar in x-direction

  • yerr – optional data for errorbar in y-direction

  • area_curve – if an area plot is made this arguments defines the other enclosing line defaults to 0

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib functions (errorbar or fill_between)

masci_tools.vis.plot_methods.surface_plot(xdata, ydata, zdata, *, xlabel='', ylabel='', zlabel='', title='', data=None, saveas='surface_plot', axis=None, copy_data=False, **kwargs)[source]

Create a standard surface plot

Parameters:
  • xdata – arraylike, data for the x coordinate

  • ydata – arraylike, data for the y coordinate

  • zdata – arraylike, data for the z coordinate

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • zlabel – str, label written on the z axis

  • title – str, title of the figure

  • axis – Axes object, if given the plot will be applied to this object

  • saveas – str specifying the filename (without file format)

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function plot_surface

masci_tools.vis.plot_methods.voigt_profile(x, fwhm_g, fwhm_l, mu)[source]

Return the Voigt line shape at x with Lorentzian component FWHM fwhm_l and Gaussian component FWHM fwhm_g and mean mu. There is no closed form for the Voigt profile, but it is related to the real part of the Faddeeva function (wofz), which is used here.

masci_tools.vis.plot_methods.waterfall_plot(xdata, ydata, zdata, *, xlabel='', ylabel='', zlabel='', title='', data=None, saveas='waterfallplot', axis=None, copy_data=False, **kwargs)[source]

Create a standard waterfall plot

Parameters:
  • xdata – arraylike, data for the x coordinate

  • ydata – arraylike, data for the y coordinate

  • zdata – arraylike, data for the z coordinate

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label written on the x axis

  • ylabel – str, label written on the y axis

  • zlabel – str, label written on the z axis

  • title – str, title of the figure

  • axis – Axes object, if given the plot will be applied to this object

  • saveas – str specifying the filename (without file format)

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.matplotlib_plotter.MatplotlibPlotter. If the arguments are not recognized they are passed on to the matplotlib function scatter3D

Bokeh

Here the masci_tools.vis.parameters.Plotter subclass for the bokeh plotting backend is defined with default values and many helper methods

class masci_tools.vis.bokeh_plotter.BokehPlotter(**kwargs)[source]

Class for plotting parameters and standard code snippets for plotting with the bokeh backend.

Kwargs in the __init__ method are forwarded to setting default values for the instance

For specific documentation about the parameter/defaults handling refer to Plotter.

Below the current defined default values are shown:

Plot Parameters

Name

Description

Default value

figure_kwargs

Parameters for creating the bokeh figure. Includes things like axis type (x and y), tools plot width/height

{'tools': 'pan,poly_select,tap,wheel_zoom,box_zoom,redo,undo,reset,save,crosshair,zoom_out,zoom_in',
'y_axis_type': 'linear',
'x_axis_type': 'linear',
'active_inspect': None,
'toolbar_location': 'right'}

additional_tools

tools to add to the tools already specified in figure_kwargs (Has to be in the same format)

No Default

show_tooltips

Switch whether to add hover tooltips

True

global_tooltips

Switch whether to add individual (for each renderer) or global hover tooltips.

False

format_tooltips

Switch whether to enable the processing of formatted strings in tooltips.

True

tooltips

List of tuples specifying the tooltips. For more information refer to the bokeh documentation. Strings can contain format specifiers with the data keys of the function e.g. '@ ``{x}. Here the `` ``{x} `` will be replaced by the entry for x. If there are formatting specifications for bokeh they need to be escaped with double curly braces or format_tooltips=False.

[('X', '@{x}'), ('Y', '@{y}')]

additional_tooltips

Tooltips to add to the already defined tooltips (See above)

No Default

axis_linewidth

Linewidth for the lines of the axis

2

label_fontsize

Fontsize for the labels of the axis

18pt

tick_label_fontsize

fontsize for the ticks on the axis

16pt

background_fill_color

Color of the background of the plot

#ffffff

x_axis_formatter

If set this formatter will be used for the ticks on the x-axis

No Default

y_axis_formatter

If set this formatter will be used for the ticks on the y-axis

No Default

x_ticks

Tick specification for the x-axis

No Default

x_ticklabels_overwrite

Overrides the labels for the ticks on the x-axis

No Default

y_ticks

Tick specification for the y-axis

No Default

y_ticklabels_overwrite

Overrides the labels for the ticks on the y-axis

No Default

x_range_padding

Specifies the amount of padding on the edges of the x-axis

No Default

y_range_padding

Specifies the amount of padding on the edges of the y-axis

No Default

limits

Dict specifying the limits of the axis, e.g {'x': (-5,5)}

No Default

legend_location

Location of the legend inside the plot area

top_right

legend_click_policy

Policy for what happens when labels are clicked in the legend

hide

legend_orientation

Orientation of the legend

vertical

legend_font_size

Fontsize for the labels inside the legend

14pt

legend_outside_plot_area

If True the legend will be placed outside of the plot area

False

color_palette

Color palette to use for the plot(s)

No Default

color

Specific colors to use for the plot(s)

No Default

legend_label

Labels to use for the legend of the plot(s)

No Default

alpha

Transparency to use for the plot(s)

1.0

name

Name used for identifying elements in the plot (not shown only internally)

No Default

line_color

Color to use for line plot(s)

No Default

line_alpha

Transparency to use for line plot(s)

1.0

line_dash

Dash styles to use for line plot(s)

No Default

line_width

Line width to use for line plot(s)

2.0

marker

Type of marker to use for scatter plot(s)

circle

marker_size

Marker size to use for scatter plot(s)

6

area_plot

If True h(v)area will be used to produce the plot(s)

False

area_vertical

Determines, whether to use harea (False) or varea (True) for area plots

False

fill_alpha

Transparency to use for the area in area plot(s)

1.0

fill_color

Color to use for the area in area plot(s)

No Default

level

Can be used to specified, which elements are fore- or background

No Default

straight_lines

Dict specifying straight help-lines to draw. For example {'vertical': 0, 'horizontal': [-1,1]} will draw a vertical line at 0 and two horizontal at -1 and 1

No Default

straight_line_options

Color, width, and more options for the help-lines

{'line_color': 'black',
'line_width': 1.0,
'line_dash': 'dashed'}

text_font_size

fontsize for the text glyphs in the plot

10pt

text_font_style

fontstyle for the text glyphs in the plot

normal

text_color

text color for the text glyphs in the plot

black

text_align

text alignment for the text glyphs in the plot

left

text_baseline

text baseline for the text glyphs in the plot

middle

save_plots

If True plots will be saved to file (Configuration beforehand is needed)

False

save_format

Formats to save the plots to, can be single or list of formats (html, png or svg)

html

show

If True bokeh.io.show will be called after the plotting routine

True

add_tooltips(fig, renderers, columns=None, toggleable=False)[source]

Add Hover tooltips to the given renderers and figure

Parameters:
  • fig – bokeh figure to apply changes to

  • renderers – bokeh renderers to activate the tooltips for

  • columns – namedtuple containing the data keys used for evtl. formatting

  • toggleable – bool, if True these tooltips will be toggleable in the toolbar

draw_straight_lines(fig)[source]

Draw horizontal and vertical lines specified in the lines argument

Parameters:

fig – bokeh figure on which to perform the operation

prepare_figure(title, xlabel, ylabel, figure=None)[source]

Create a bokeh figure according to the set parameters or modify an existing one

Parameters:
  • title – title of the figure

  • xlabel – label on the x-axis

  • ylabel – label on the y-axis

  • figure – bokeh figure, optional, if given the operations are performed on the object otherwise a new figure is created

Returns:

the created or modified bokeh figure

save_plot(figure, saveas)[source]

Show/save the bokeh figure

Parameters:

figure – bokeh figure on which to perform the operation

set_color_palette_by_num_plots()[source]

Set the colormap for the configured number of plots according to the set colormap or color

copied from https://github.com/PatrikHlobil/Pandas-Bokeh/blob/master/pandas_bokeh/plot.py credits to PatrikHlobil modified for use in this Plotter class

set_legend(fig)[source]

Set legend options for the figure

Parameters:

fig – bokeh figure on which to perform the operation

set_limits(fig)[source]

Set limits of the figure

Parameters:

fig – bokeh figure on which to perform the operation

Here are general and special bokeh plots to use

masci_tools.vis.bokeh_plots.bokeh_bands(kpath, bands=None, *, data=None, size_data=None, color_data=None, xlabel='', ylabel='$$E-E_F [eV]$$', title='', special_kpoints=None, markersize_min=3.0, markersize_scaling=10.0, saveas='bands_plot', scale_color=True, separate_bands=False, line_plot=False, band_index=None, copy_data=False, **kwargs)[source]

Create an interactive bandstructure plot (non-spinpolarized) with bokeh Can make a simple plot or weight the size and color of the points against a given weight

Parameters:
  • kpath – arraylike or key data for the kpoint data

  • bands – arraylike or key data for the eigenvalues

  • size_data – arraylike or key data the weights to emphasize (optional)

  • color_data – str or arraylike, data for the color values with a colormap (optional)

  • data – source for the bands data (optional) of the plot (pandas Dataframe for example)

  • xlabel – label for the x-axis (default no label)

  • ylabel – label for the y-axis

  • title – title of the figure

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • e_fermi – float, determines, where to put the line for the fermi energy

  • markersize_min – minimum value used in scaling points for weight

  • markersize_scaling – factor used in scaling points for weight

  • outfilename – filename of the output file

  • scale_color – bool, if True (default) the weight will be additionally shown via a colormapping

  • line_plot – bool, if True the bandstructure will be plotted with lines Here no weights are supported

  • separate_bands – bool, if True the bandstructure will be separately plotted for each band allows more specific parametrization

  • band_index – data for which eigenvalue belongs to which band (needed for line_plot and separate_bands)

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to bokeh_multi_scatter() or bokeh_line()

masci_tools.vis.bokeh_plots.bokeh_dos(energy_grid, dos_data=None, *, data=None, energy_label='$$E-E_F [eV]$$', dos_label='DOS [1/eV]', title='Density of states', xyswitch=False, e_fermi=0, saveas='dos_plot', copy_data=False, **kwargs)[source]

Create an interactive dos plot (non-spinpolarized) with bokeh Both horizontal or vertical orientation are possible

Parameters:
  • energy_grid – arraylike or key data for the energy grid

  • spin_up_data – arraylike or key data for the DOS

  • data – source for the DOS data (optional) of the plot (pandas Dataframe for example)

  • energy_label – label for the energy-axis

  • dos_label – label for the dos-axis

  • title – title of the figure

  • xyswitch – bool if True, the energy will be plotted along the y-direction

  • e_fermi – float, determines, where to put the line for the fermi energy

  • outfilename – filename of the output file

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to bokeh_line()

masci_tools.vis.bokeh_plots.bokeh_line(x, y=None, *, data=None, figure=None, xlabel='x', ylabel='y', title='', saveas='line', plot_points=False, area_curve=0, copy_data=False, set_default_legend=True, **kwargs)[source]

Create an interactive multi-line plot with bokeh

Parameters:
  • x – arraylike or key for data for the x-axis

  • y – arraylike or key for data for the y-axis

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – label for the x-axis

  • ylabel – label for the y-axis

  • title – title of the figure

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

  • outfilename – filename of the output file

  • plot_points – bool, if True also plot the points with a scatterplot on top

  • copy_data – bool, if True the data argument will be copied

  • set_default_legend – bool if True the data names are used to generate default legend labels

Kwargs will be passed on to masci_tools.vis.bokeh_plotter.BokehPlotter. If the arguments are not recognized they are passed on to the bokeh function line

masci_tools.vis.bokeh_plots.bokeh_multi_scatter(x, y=None, *, data=None, figure=None, xlabel='x', ylabel='y', title='', saveas='scatter', copy_data=False, set_default_legend=True, **kwargs)[source]

Create an interactive scatter (muliple data sets possible) plot with bokeh

Parameters:
  • x – arraylike or key for data for the x-axis

  • y – arraylike or key for data for the y-axis

  • data – source for the data of the plot (pandas Dataframe for example)

  • xlabel – label for the x-axis

  • ylabel – label for the y-axis

  • title – title of the figure

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

  • outfilename – filename of the output file

  • copy_data – bool, if True the data argument will be copied

  • set_default_legend – bool if True the data names are used to generate default legend labels

Kwargs will be passed on to masci_tools.vis.bokeh_plotter.BokehPlotter. If the arguments are not recognized they are passed on to the bokeh function scatter

masci_tools.vis.bokeh_plots.bokeh_scatter(x, y=None, *, xlabel='x', ylabel='y', title='', figure=None, data=None, saveas='scatter', copy_data=False, **kwargs)[source]

Create an interactive scatter plot with bokeh

Parameters:
  • x – arraylike or key for data for the x-axis

  • y – arraylike or key for data for the y-axis

  • data – source for the data of the plot (pandas Dataframe for example)

  • xlabel – label for the x-axis

  • ylabel – label for the y-axis

  • title – title of the figure

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

  • outfilename – filename of the output file

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to masci_tools.vis.bokeh_plotter.BokehPlotter. If the arguments are not recognized they are passed on to the bokeh function scatter

masci_tools.vis.bokeh_plots.bokeh_spectral_function(kpath, energy_grid, spectral_function, *, data=None, special_kpoints=None, e_fermi=0, xlabel='', ylabel='$$E-E_F [eV]$$', title='', saveas='spectral_function', copy_data=False, figure=None, **kwargs)[source]

Create a colormesh plot of a spectral function

Parameters:
  • kpath – data for the kpoint coordinates

  • energy_grid – data for the energy grid

  • spectral_function – 2D data for the spectral function

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • xlabel – str, label for the x-axis

  • ylabel – str, label for the y-axis

  • saveas – str, filename for the saved plot

  • e_fermi – float (default 0), place the line for the fermi energy at this value

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • copy_data – bool, if True the data argument will be copied

All other Kwargs are passed on to the image call of bokeh

masci_tools.vis.bokeh_plots.bokeh_spinpol_bands(kpath, bands_up=None, bands_dn=None, *, size_data=None, color_data=None, data=None, xlabel='', ylabel='$$E-E_F [eV]$$', title='', special_kpoints=None, markersize_min=3.0, markersize_scaling=10.0, saveas='bands_plot', scale_color=True, line_plot=False, separate_bands=False, band_index=None, copy_data=False, **kwargs)[source]

Create an interactive bandstructure plot (spinpolarized) with bokeh Can make a simple plot or weight the size and color of the points against a given weight

Parameters:
  • kpath – arraylike or key data for the kpoint data

  • bands_up – arraylike or key data for the eigenvalues spin-up

  • bands_dn – arraylike or key data for the eigenvalues spin-dn

  • size_data – arraylike or key data the weights to emphasize (optional)

  • color_data – str or arraylike, data for the color values with a colormap (optional)

  • data – source for the bands data (optional) of the plot (pandas Dataframe for example)

  • xlabel – label for the x-axis (default no label)

  • ylabel – label for the y-axis

  • title – title of the figure

  • special_kpoints – list of tuples (str, float), place vertical lines at the given values and mark them on the x-axis with the given label

  • e_fermi – float, determines, where to put the line for the fermi energy

  • markersize_min – minimum value used in scaling points for weight

  • markersize_scaling – factor used in scaling points for weight

  • outfilename – filename of the output file

  • scale_color – bool, if True (default) the weight will be additionally shown via a colormapping

  • line_plot – bool, if True the bandstructure will be plotted with lines Here no weights are supported

  • separate_bands – bool, if True the bandstructure will be separately plotted for each band allows more specific parametrization

  • band_index – data for which eigenvalue belongs to which band (needed for line_plot and separate_bands)

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to bokeh_multi_scatter() or bokeh_line()

masci_tools.vis.bokeh_plots.bokeh_spinpol_dos(energy_grid, spin_up_data=None, spin_dn_data=None, *, data=None, spin_dn_negative=True, energy_label='$$E-E_F [eV]$$', dos_label='DOS [1/eV]', title='Density of states', xyswitch=False, e_fermi=0, spin_arrows=True, saveas='dos_plot', copy_data=False, **kwargs)[source]

Create an interactive dos plot (spinpolarized) with bokeh Both horizontal or vertical orientation are possible

Parameters:
  • energy_grid – arraylike or key data for the energy grid

  • spin_up_data – arraylike or key data for the DOS spin-up

  • spin_dn_data – arraylike or key data for the DOS spin-dn

  • data – source for the DOS data (optional) of the plot (pandas Dataframe for example)

  • spin_dn_negative – bool, if True (default), the spin down components are plotted downwards

  • energy_label – label for the energy-axis

  • dos_label – label for the dos-axis

  • title – title of the figure

  • xyswitch – bool if True, the energy will be plotted along the y-direction

  • e_fermi – float, determines, where to put the line for the fermi energy

  • spin_arrows – bool, if True (default) small arrows will be plotted on the left side of the plot indicating the spin directions (if spin_dn_negative is True)

  • outfilename – filename of the output file

  • copy_data – bool, if True the data argument will be copied

Kwargs will be passed on to bokeh_line()

masci_tools.vis.bokeh_plots.get_bokeh_help(key)[source]

Print the description of the given key in the bokeh backend

Available defaults can be seen in BokehPlotter

masci_tools.vis.bokeh_plots.load_bokeh_defaults(filename='plot_bokeh_defaults.json')[source]

Load defaults for the bokeh backend from a json file.

Parameters:

filename – filename,from where the defaults should be taken

masci_tools.vis.bokeh_plots.matrix_plot(text_values, x_axis_data, y_axis_data, positions=None, *, color_data=None, secondary_color_data=None, x_offset=-0.47, log_scale=False, color_map=None, data=None, copy_data=False, title='', xlabel='x', ylabel='y', saveas='matrix_plot.html', blank_outsiders='both', blank_color='#c4c4c4', figure=None, categorical_axis=False, categorical_sort_key=None, block_size=0.95, block_size_pixel=100, **kwargs)[source]

Plot function for an interactive periodic table plot. Heat map and hover tool. source must be a pandas dataframe containing, atom period and group, atomic number and symbol

Parameters:
  • values – data for the text inside each elements box

  • positions – y positions relative to the middle of the box for each value

  • color_data – data to display as a heatmap

  • color_map – color palette to use for the heatmap (default matplotlib plasma)

  • log_scale – bool, if True the heatmap is done logarithmically

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • saveas – str, filename for the saved plot

  • blank_outsiders – either ‘both’, ‘min’, ‘max’ or None, determines, which points outside the color range to color with a default blank color

  • blank_color – color to replace values outside the color range by

  • include_legend – if True an additional entry with labels explaing each value entry is added

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

Additional kwargs are passed on to the label creation for the element box The kwargs legend_options and colorbar_options can be used to overwrite default values for these regions of the plot

masci_tools.vis.bokeh_plots.periodic_table_plot(values, positions=None, *, color_data=None, log_scale=False, color_map=None, data=None, copy_data=False, title='', saveas='periodictable.html', blank_outsiders='both', blank_color='#c4c4c4', include_legend=True, figure=None, **kwargs)[source]

Plot function for an interactive periodic table plot. Heat map and hover tool. source must be a pandas dataframe containing, atom period and group, atomic number and symbol

Parameters:
  • values – data for the text inside each elements box

  • positions – y positions relative to the middle of the box for each value

  • color_data – data to display as a heatmap

  • color_map – color palette to use for the heatmap (default matplotlib plasma)

  • log_scale – bool, if True the heatmap is done logarithmically

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • title – str, Title of the plot

  • saveas – str, filename for the saved plot

  • blank_outsiders – either ‘both’, ‘min’, ‘max’ or None, determines, which points outside the color range to color with a default blank color

  • blank_color – color to replace values outside the color range by

  • include_legend – if True an additional entry with labels explaing each value entry is added

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

Additional kwargs are passed on to the label creation for the element box The kwargs legend_options and colorbar_options can be used to overwrite default values for these regions of the plot

masci_tools.vis.bokeh_plots.plot_convergence(iteration, distance, total_energy, *, data=None, saveas_energy='energy_convergence', saveas_distance='distance_convergence', figure_energy=None, figure_distance=None, xlabel='Iteration', ylabel_energy='Total energy difference [Htr]', ylabel_distance='Distance [me/bohr^3]', title_energy='Total energy difference over scf-Iterations', title_distance='Convergence (log)', copy_data=False, drop_last_iteration=False, **kwargs)[source]

Plot the total energy differences versus the scf iteration and plot the distance of the density versus iterations.

Parameters:
  • iteration – data for the number of iterations

  • distance – data of distances

  • total_energy – data of total energies

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • xlabel – str, label for the x-axis of both plots

  • saveas_energy – str, filename for the energy convergence plot

  • figure_energy – Axes object for the energy convergence plot

  • title_energy – str, title for the energy convergence plot

  • ylabel_energy – str, label for the y-axis for the energy convergence plot

  • saveas_distance – str, filename for the distance plot

  • figure_distance – Axes object for the distance plot

  • title_distance – str, title for the distance plot

  • ylabel_distance – str, label for the y-axis for the distance plot

  • copy_data – bool if True the data argument is copied

  • drop_last_iteration – bool if True the last iteration is dropped for the distance plot

Other Kwargs will be passed on to all bokeh_line() calls

masci_tools.vis.bokeh_plots.plot_convergence_results(iteration, distance, total_energy, *, saveas='convergence', **kwargs)[source]

Plot the total energy versus the scf iteration and plot the distance of the density versus iterations. Uses bokeh_line and bokeh_scatter

Parameters:
  • iteration – list of Int

  • distance – list of floats

  • show – bool, if True call show

Total_energy:

list of floats

Kwargs will be passed on to bokeh_line()

Returns grid:

bokeh grid with figures

masci_tools.vis.bokeh_plots.plot_convergence_results_m(iterations, distances, total_energies, *, link=False, nodes=None, modes=None, plot_label=None, saveas='convergence', **kwargs)[source]

Plot the total energy versus the scf iteration and plot the distance of the density versus iterations in a bokeh grid for several SCF results.

Parameters:
  • distances – list of lists of floats

  • iterations – list of lists of Int

  • link – bool, optional default=False:

  • nodes – list of node uuids or pks important for links

  • saveas1 – str, optional default=’t_energy_convergence’, save first figure as

  • saveas2 – str, optional default=’distance_convergence’, save second figure as

  • figure_kwargs – dict, optional default={‘width’: 600, ‘height’: 450}, gets parsed to bokeh_line

  • kwargs – further key-word arguments for bokeh_line

Total_energies:

list of lists of floats

Returns grid:

bokeh grid with figures

masci_tools.vis.bokeh_plots.plot_lattice_constant(scaling, total_energy, *, fit_data=None, data=None, figure=None, relative=True, ref_const=None, title='Equation of states', saveas='lattice_constant', copy_data=False, **kwargs)[source]

Plot a lattice constant versus Total energy Plot also the fit. On the x axis is the scaling, it

Parameters:
  • scaling – arraylike, data for the scaling factor

  • total_energy – arraylike, data for the total energy

  • fit_data – arraylike, optional data of fitted data

  • relative – bool, scaling factor given (True), or lattice constants given?

  • ref_const – float (optional), or list of floats, lattice constant for scaling 1.0

  • data – source for the data of the plot (optional) (pandas Dataframe for example)

  • copy_data – bool if True the data argument will be copied

  • figure – bokeh figure (optional), if provided the plot will be added to this figure

Function specific parameters:
param marker_fit:

defaults to marker, marker type for the fit data

param marker_size_fit:

defaults to marker_size, markersize for the fit data

param line_width_fit:

defaults to line_width, linewidth for the fit data

param legend_label_fit:

str label for the fit data

Other Kwargs will be passed on to bokeh_line()

masci_tools.vis.bokeh_plots.reset_bokeh_plot_defaults()[source]

Reset the defaults for bokeh backend to the hardcoded defaults

Available defaults can be seen in BokehPlotter

masci_tools.vis.bokeh_plots.save_bokeh_defaults(filename='plot_bokeh_defaults.json', save_complete=False)[source]

Save the current defaults for the matplotlib backend to a json file.

Parameters:
  • filename – filename, where the defaults should be stored

  • save_complete – bool if True not only the overwritten user defaults but also the unmodified hardcoded defaults are stored

masci_tools.vis.bokeh_plots.set_bokeh_plot_defaults(**kwargs)[source]

Set defaults for bokeh backend according to the given keyword arguments

Available defaults can be seen in BokehPlotter

masci_tools.vis.bokeh_plots.show_bokeh_plot_defaults()[source]

Show the currently set defaults for bokeh backend

Available defaults can be seen in BokehPlotter

Calculation tools

This file contains a class to compute the crystalfield coefficients from convoluting the charge density with the potential which produces the crystalfield. This is both compatible with the Yttrium-Analogue approximation and self-consitent calculation of the potential

class masci_tools.tools.cf_calculation.CFCalculation(*, radial_points=4000, reference_radius='pot', coefficient_cutoff=0.001, **kwargs)[source]

Class for calculating Crystal Field coefficients using the procedure described in C.E. Patrick, J.B. Staunton: J. Phys.: Condens. Matter 31, 305901 (2019)

Using the formula:

B_{lm} = \sqrt{\frac{2l+1}{4\pi}} \int^{R_{MT}}\! dr r^2 V_{lm}(r)n_{4f}(r)

The read in quantities are interpolated from logarithmic meshes to equidistant meshes

The function constructs an equidistant mesh between 0 and the muffin tin radius defined in self.reference_radius and with self.radial_points points

Parameters:
  • radial_points (int) – int, number of radial points in the interpolated mesh

  • reference_radius (Union[float, Literal['pot', 'cdn']]) – stror float; Either ‘pot’ or ‘cdn’ or explicit number. Defines which muffin-tin radius is used for the equidistant mesh. IMPORTANT! If txt files are used the muffin-tin radius has to be provided explicitly

  • coefficient_cutoff (Optional[float]) – float Defines minimum value that cf coefficients have to have to be considered non-zero

property denNorm

Returns the density normalization

DEPRECATED: Use density_normalization instead

classmethod from_arrays(charge_density, potentials, radial_mesh, **kwargs)[source]

Create a CFCalculation instance from arrays

Warning

Using this classmethod will not check that the charge density and potential have the same bravais matrix

Parameters:
  • charge_density (ndarray) – Array for the normed charge density

  • potentials (dict[tuple[int, int], ndarray]) – Data for the potentials (dict mapping (l,m) tuples to the corresponding data)

  • radial_mesh (dict[str, ndarray]) – dict for the data for the used radial meshs (keys ‘cdn’ and ‘pot’)

Return type:

CFCalculation

Other Kwargs are passed on to the constructor

get_charge_density(interpolated=True)[source]

Return the charge density and the corresponding radial mesh

Parameters:
  • spin – which spin to return

  • interpolated – bool, if True the interpolated mesh and density are returned

Return type:

tuple[ndarray, ndarray]

get_coefficients(convention='Stevens', table_fmt=None)[source]

Performs the integration to obtain the crystal field coefficients If the data was not already interpolated, the interpolation will be performed beforehand

Parameters: :type convention: Literal['Stevens', 'Wybourne']

param convention:

str of the convention to use (Stevens or Wybourne)

Return type:

list[CFCoefficient]

Returns:

list of CFCoefficient objects (namedtuple), with all the necessary information

get_potentials(spin, interpolated=True, only_nonzero=True, complex_data=True)[source]

Return the potentials and the corresponding radial mesh

Parameters:
  • spin (Literal['up', 'down']) – which spin to return

  • interpolated (bool) – bool, if True the interpolated mesh and potentials are returned

  • only_nonzero (bool) – bool, if True only the potentials corresponding to a non-zero coefficient are returned

  • complex_data (bool) – bool, if False only the real part of the potentials is returned

Return type:

tuple[ndarray, dict[tuple[int, int], ndarray]]

interpolate()[source]

Interpolate all quantities to a common equidistant radial mesh

Return type:

None

property nonzero_coefficients_lm: list[tuple[int, int]]

Return the lm indices of coefficients that are bigger than the set cutoff

performIntegration(convert=True)[source]

DEPRECATED: Use get_coefficients instead

Performs the integration to obtain the crystal field coefficients If the data was not already interpolated, the interpolation will be performed beforehand

Parameters: :type convert:

param convert:

bool, converts to Steven’s coefficients (if True)

Returns:

list of CFCoefficient objects (namedtuple), with all the necessary information

readCDN(*args, **kwargs)[source]

DEPRECATED: Use read_charge_density instead

readPot(*args, **kwargs)[source]

DEPRECATED: Use read_pot

read_charge_density(file, atom_type=None, header=0, atomic_cdn=True)[source]

Reads in the normed charge density for the CF coefficient calculation If hdf files are given also the muffin tin radius is read in

Return type:

None

Parameters: :type file: Union[str, bytes, Path, PathLike, IO[Any], File]

param file:

Expects string filename for the charge density to read in The function expects either HDF files or txt files with the format (rmesh,cdn). The charge density should be given as r^2n(r) and normed to 1

kwargs: :type atom_type: Optional[int]

param atom_type:

int, Defines the atom_type to read in (only for HDF files)

read_potential(*files, lm_indices=None, atom_type=None, header=0, complex_data=True)[source]

Reads in the potentials for the CF coefficient calculation If hdf files are given also the muffin tin radius is read in

Parameters:
  • args – Expects string filenames for the potentials to read in The function expects either HDF files or txt files with the format (rmesh,vlmup,vlmdn)

  • lm_indices (Optional[list[tuple[int, int]]]) – list of tuples, Defines the l and m indices for the given txt files

  • atom_type (Optional[int]) – int, Defines the atomType to read in (only for HDF files)

  • header (int) – int, Define how many lines to skip in the beginning of txt file

  • complex_data (bool) – bool, Define if the data in the text file is complex

Return type:

None

Raises:

ValueError: lm indices list length has to match number of files read in

property spin_polarized: bool

Return whether the potentials have a spin-down component

stevens_prefactor(l, m)[source]

Gives the lm dependent prefactor for conversion between Blm and Alm coefficients

Args: :type l: int

param l:

int; orbital quantum number

Return type:

float

Returns:

float prefactor for conversion to Steven’s Coefficients

validate()[source]

Validate that the object can be used to execute the calculation Checks that the given bravais matrices are equal if given

Return type:

None

class masci_tools.tools.cf_calculation.CFCoefficient(l: int, m: int, spin_up: float | complex, spin_down: float | complex, unit: str, convention: str)[source]

Namedtuple representing an individual crystal field coefficient

convention: str

Alias for field number 5

l: int

Alias for field number 0

m: int

Alias for field number 1

spin_down: float | complex

Alias for field number 3

spin_up: float | complex

Alias for field number 2

unit: str

Alias for field number 4

masci_tools.tools.cf_calculation.plot_crystal_field_calculation(cfcalc, *, saveas='crystal_field_calc', potential_title='Potential', density_title='Density', xlabel='$R$ (Bohr)', potential_ylabel='$Vpot$ (Hartree)', density_ylabel='Density', density_kwargs=None, potential=True, density=True, axis_potential=None, axis_density=None, **kwargs)[source]

Plot the given potentials and charge densities used in the given CFCalculation

Parameters:
  • cfcalc – CFcalculation containing the data to plot

  • saveas – str, Define the filename to save the figure

  • potential_title – Title for the potential subplot

  • density_title – Title for the charge density subplot

  • xlabel – label for the x axis of both subplots

  • potential_ylabel – label for the y axis of the potential subplot

  • density_ylabel – label for the y axis f the charge density subplot

  • density_kwargs – dict with keyword argument passed to the plotting of the density

  • figure – Use this preexisting matplotlib figure to produce the plots

All other Kwargs are passed on to the multiple_scatterplots() calls for plotting the potentials

masci_tools.tools.cf_calculation.plot_crystal_field_potential(cfcoeffs, *, saveas='crystal_field_potential_areaplot', spin='avg', phi=0.0, figure=None, **kwargs)[source]

Plots the angular dependence of the calculated CF potential as well as a plane defined by phi.

Parameters:
  • cfcoeffs – list of CFCoefficients to construct the potential

  • saveas – str, defines the filename to save the figure

  • spin – str; Either ‘up’, ‘dn’ or ‘avg’. Which spin direction to plot (‘avg’-> (‘up’+’dn’)/2.0)

  • phi – float, defines the phi angle of the plane

Raises:
  • AssertionError – When coefficients are provided as wrong types or in the wrong convention

  • ValueError – When coefficients are provided in the wrong convention

This module contains utility and functions to work with Green’s functions calculated and written to greensf.hdf files by fleur

class masci_tools.tools.greensfunction.GreensFunction(element, data, attributes)[source]

Class for working with Green’s functions calculated by the fleur code

Parameters:
  • element (GreensfElement) – GreensfElement namedtuple containing the information about the element

  • data (dict[str, Any]) – datasets dict produced by one of the hdf recipes for reading Green’s functions

  • attributes (dict[str, Any]) – attributes dict produced by one of the hdf recipes for reading Green’s functions

energy_dependence(*, m=None, mp=None, spin=None, imag=True, both_contours=False)[source]

Select data with energy dependence

Parameters:
  • m (Optional[int]) – optional integer magnetic quantum number between -l and l

  • mp (Optional[int]) – optional integer magnetic quantum number between -lp and lp

  • spin (Optional[int]) – optional integer spin between 1 and nspins

  • both_contours (bool) – bool id True the data is not added for both energy contours

  • imag (bool) – bool if True and both_contours is False the imaginary part:math:frac{1}{2i}left[Gleft(zright)-Gleft(z^astright)right] is returned otherwise the real part \frac{1}{2}\left[G\left(z\right)+G\left(z^\ast\right)\right]

Return type:

ndarray

Returns:

numpy array with the selected data

energy_dependence_full_matrix(imag=True, both_contours=False)[source]

Get the full matrix N_{\mathrm{spins}}(2l+1) \times N_{\mathrm{spins}}(2l^\prime+1)

Parameters:
  • both_contours (bool) – bool id True the data is not added for both energy contours

  • imag (bool) – bool if True and both_contours is False the imaginary part \frac{1}{2i}\left[G\left(z\right)-G\left(z^\ast\right)\right] is returned otherwise the real part \frac{1}{2}\left[G\left(z\right)+G\left(z^\ast\right)\right]

Return type:

ndarray

Returns:

numpy array with the selected data

classmethod fromFile(file, index=None, **selection_params)[source]

Classmethod for creating a GreensFunction instance directly from a hdf file

Parameters:
  • file (Any) – path or opened file handle to a greensf.hdf file

  • index (Optional[int]) – optional int index of the element to read in

Return type:

GreensFunction

If index is not given Keyword arguments with the keys being the names of the fields of GreensfElement can be given to select the right Green’s function. The specification has to match only one element in the file

get_coefficient(name, spin=None, radial=False)[source]

Get the coefficient with the given name from the data attribute

Parameters:
  • name (Literal['sphavg', 'uu', 'ud', 'du', 'dd', 'ulou', 'uulo', 'ulod', 'dulo', 'uloulo']) – name of the coefficient

  • radial (bool) – if the Green’s function is stored by coefficient and radial is True it is multiplied by the corresponding radial function otherwise the scalar product is multiplied

  • spin (Optional[int]) – integer index of the spin to retrieve

Return type:

ndarray

Returns:

numpy.ndarray for the given coefficient and spin

moment(n, spin=None)[source]

Calculate the integral

M_n\ =\ -\frac{1}{4\pi i} \mathrm{Im} \int_\mathrm{Contour}\!\mathrm{dz} z^n G(z)

Parameters:
  • n (int) – power of z in the integral

  • spin (Optional[int]) – optional integer spin between 1 and nspins

Return type:

ndarray

property nspins: int

Return the number of spins of the current element. If mperp is True for the element it is 4 otherwise it is determined by the spins attribute

occupation(spin=None)[source]

Calculate the 0-th moment of the green’s function

n\ =\ -\frac{1}{4\pi i} \mathrm{Im} \int_\mathrm{Contour}\!\mathrm{dz} G(z)

Note

Only if the energy contour ends at the fermi energy/is correlty weighted to produce occupations, will this function produce occupations

Parameters:

spin (Optional[int]) – optional integer spin between 1 and nspins

Return type:

ndarray

to_global_frame()[source]

Rotate the Green’s function into the global real space and spin space frame

Return type:

None

to_local_frame()[source]

Rotate the Green’s function into the local real space and spin space frame

Return type:

None

static to_m_index(m)[source]

Convert between magnetic quantum numbers between -l and l to 0 and 2l+1 for easier indexing

Parameters:

m (int) – int magnetic quantum number to convert

Return type:

int

Returns:

converted magnetic quantum number

static to_spin_indices(spin)[source]

Convert between spin index (0 to 3) to the corresponding two spin indices (0 or 1)

Parameters:

spin (int) – int spin index to convert

Return type:

tuple[int, int]

Returns:

tuple of spin indices

trace_energy_dependence(spin=None, imag=True)[source]

Select trace of data with energy dependence

Parameters:
  • spin (Optional[int]) – integer spin between 1 and nspins

  • imag (bool) – bool if True the imaginary part \frac{1}{2i}\left[G\left(z\right)-G\left(z^\ast\right)\right] is returned otherwise the real part \frac{1}{2}\left[G\left(z\right)+G\left(z^\ast\right)\right]

Return type:

ndarray

Returns:

numpy array with the selected and traced over data

class masci_tools.tools.greensfunction.GreensfElement(l: int, lp: int, atomType: int, atomTypep: int, sphavg: bool, onsite: bool, kresolved: bool, contour: int, nLO: int, atomDiff: np.ndarray)[source]

Namedtuple representing the high-level information about the Green’s functions, i.e. what kind, which atoms, which orbitals

atomDiff: ndarray

Alias for field number 9

atomType: int

Alias for field number 2

atomTypep: int

Alias for field number 3

contour: int

Alias for field number 7

kresolved: bool

Alias for field number 6

l: int

Alias for field number 0

lp: int

Alias for field number 1

nLO: int

Alias for field number 8

onsite: bool

Alias for field number 5

sphavg: bool

Alias for field number 4

class masci_tools.tools.greensfunction.colors[source]

Color strings for coloring terminal output

You may need to change color settings in iPython

masci_tools.tools.greensfunction.intersite_shell_indices(elements, reference_atom, show=False, max_shells=None)[source]

Construct the green’s function pairs to calculate the Jij exchange constants for a given reference atom from a list of GreensfElement

Parameters:
  • elements (list[GreensfElement]) – list of GreenfElements to use

  • reference_atom (int) – integer of the atom to calculate the Jij’s for (correspinds to the i)

  • show (bool) – if True the elements belonging to a shell are printed in a shell

  • max_shells (Optional[int]) – optional int, if given only the first max_shells shells are constructed

Return type:

list[tuple[floating[Any], list[tuple[int, int]]]]

Returns:

list of tuples with distance and all indices of pairs in the shell

masci_tools.tools.greensfunction.intersite_shells(greensfunctions, reference_atom, show=False, max_shells=None)[source]

Construct the green’s function pairs to calculate the Jij exchange constants for a given reference atom from a list of given GreensFunction

Parameters:
  • greensfunctions (list[GreensFunction]) – List of Greens Function to use

  • reference_atom (int) – integer of the atom to calculate the Jij’s for (correspinds to the i)

  • show (bool) – if True the elements belonging to a shell are printed in a shell

  • max_shells (Optional[int]) – optional int, if given only the first max_shells shells are constructed

Return type:

Generator[tuple[floating[Any], GreensFunction, GreensFunction], None, None]

Returns:

flat iterator with distance and the two corresponding GreensFunction instances for each Jij calculation

masci_tools.tools.greensfunction.intersite_shells_from_file(hdffile, reference_atom, show=False, max_shells=None)[source]

Construct the green’s function pairs to calculate the Jij exchange constants for a given reference atom from a given greensf.hdf file

Parameters:
  • hdffile (Union[str, bytes, Path, PathLike, IO[Any]]) – filepath or file handle to a greensf.hdf file

  • reference_atom (int) – integer of the atom to calculate the Jij’s for (correspinds to the i)

  • show (bool) – if True the elements belonging to a shell are printed in a shell

  • max_shells (Optional[int]) – optional int, if given only the first max_shells shells are constructed

Return type:

Generator[tuple[floating[Any], GreensFunction, GreensFunction], None, None]

Returns:

flat iterator with distance and the two corresponding GreensFunction instances for each Jij calculation

masci_tools.tools.greensfunction.listElements(hdffile, show=False)[source]

Find the green’s function elements contained in the given greens.hdf file

Parameters:
  • hdffile (Union[str, bytes, Path, PathLike, IO[Any]]) – filepath or file handle to a greensf.hdf file

  • show (bool) – bool if True the found elements are printed in a table

Return type:

list[GreensfElement]

Returns:

list of GreensfElement

masci_tools.tools.greensfunction.printElements(elements, index=None, mark=None)[source]

Print the given list of GreensfElement in a nice table

Parameters:
Return type:

None

masci_tools.tools.greensfunction.select_element_indices(elements, show=False, **selection_params)[source]

Select GreensfElement objects from a list based on constraints on their values

Parameters:

The Keyword arguments correspond to the names of the fields and their desired value

Return type:

list[int]

Returns:

list of the indices matching the criteria

masci_tools.tools.greensfunction.select_elements(greensfunctions, show=False, **selection_params)[source]

Select GreensFunction objects from a list based on constraints on the values of their underlying GreensfElement

Parameters:

The Keyword arguments correspond to the names of the fields and their desired value

Return type:

Generator[GreensFunction, None, None]

Returns:

iterator over the matching GreensFunction

masci_tools.tools.greensfunction.select_elements_from_file(hdffile, show=False, **selection_params)[source]

Construct the green’s function matching specified criteria from a given greensf.hdf file

Parameters:

The Keyword arguments correspond to the names of the fields and their desired value

Return type:

Generator[GreensFunction, None, None]

Returns:

iterator over the matching GreensFunction

This module collects functions for calculating properties with the greens functions calculated by Fleur. At the moment the following are implemented:

  • Calculating Heisenberg J_0 (spin stiffness) from onsite Green’s functions

  • Calculating Heisenberg J_ij exchange constants from intersite Green’s functions

  • Calculating the hybridization function from onsite Greens functions

masci_tools.tools.greensf_calculations.calculate_heisenberg_j0(greensfunction, onsite_delta, show=False)[source]

Calculate spin stiffness J_0 for the given green’s function using the formula

J_{0} = \frac{1}{4\pi} \mathrm{Im}\ \mathrm{Tr_L} \int_{-\infty}^{E_F}\!\mathrm{dz} \Delta\left(G^\uparrow(z)-G^\downarrow(z)\right) + \Delta^2G^\uparrow(z)G^\downarrow(z)

Parameters:
  • greensfunction (GreensFunction) – GreensFunction to use for the calculation

  • onsite_delta (float) – onsite exchange splitting to use for the calculation

  • show (bool) – bool if True additional information about the used Greens functions is printed out

Return type:

float

Returns:

the value of the spin stiffness in meV

masci_tools.tools.greensf_calculations.calculate_heisenberg_jij(hdffileORgreensfunctions, reference_atom, onsite_delta, max_shells=None)[source]

Calculate the Heisenberg exchange constants form Green’s functions using the formula

J_{ij} = \frac{1}{4\pi} \mathrm{Im}\ \mathrm{Tr_L} \int_{-\infty}^{E_F}\!\mathrm{dz} \Delta_iG^\uparrow_{ij}(z)\Delta_jG^\downarrow_{ji}(z)

Parameters:
  • hdffileORgreensfunctions (Union[str, bytes, Path, PathLike, IO[Any], list[GreensFunction]]) – either pat/file-like object for the greensf.hdf file to use or list of GreensFunction

  • reference_atom (int) – integer index of the atom to calculate the Jijs from

  • onsite_delta (ndarray) – List of floats containing the onsite exchange splitting for each atom type and l-channel

  • max_shells (Optional[int]) – optional int, if given only the first max_shells shells are constructed

Return type:

DataFrame

Returns:

pandas DataFrame containing all the Jij constants

masci_tools.tools.greensf_calculations.calculate_heisenberg_tensor(hdffileORgreensfunctions, reference_atom, onsite_delta, max_shells=None)[source]

Calculate the Heisenberg exchange tensor \mathbf{J} from Green’s functions using the formula

J^{\alpha\beta}_{ij} = \frac{1}{4\pi} \mathrm{Im}\ \mathrm{Tr_L} \int_{-\infty}^{E_F}\!\mathrm{dz} \Delta_i\sigma_{\alpha}G_{ij}(z)\Delta_j\sigma_{\beta}G_{ji}(z)

for all \alpha\ \mathrm{and}\ \beta=x,y,z.

Parameters:
  • hdffileORgreensfunctions (Union[str, bytes, Path, PathLike, IO[Any], list[GreensFunction]]) – either pat/file-like object for the greensf.hdf file to use or list of GreensFunction

  • reference_atom (int) – integer index of the atom to calculate the Jijs from

  • onsite_delta (ndarray) – List of floats containing the onsite exchange splitting for each atom type and l-channel

  • max_shells (Optional[int]) – optional int, if given only the first max_shells shells are constructed

Return type:

DataFrame

Returns:

pandas DataFrame containing all the J_xx, J_xy, etc. constants

masci_tools.tools.greensf_calculations.calculate_hybridization(greensfunction)[source]

Calculate the hybridization function as

\Delta(z) = \frac{1}{2*l+1} \mathrm{Tr} G^{-1}(z)

Return type:

ndarray

Returns:

numpy array of the hybridization function

masci_tools.tools.greensf_calculations.decompose_jij_tensor(jij_tensor, moment_direction)[source]

Decompose the Heisenberg tensor as calculated by calculate_heisenberg_tensor() into three parts

  • Isotropic J = \frac{1}{3} \mathrm{Tr}\left[\mathbf{J}\right]

  • Symmetric traceless J_S = \frac{1}{2} \left(\mathbf{J} + \mathbf{J}^T\right) - J

  • Antisymmetric J_A = \frac{1}{2} \left(\mathbf{J} - \mathbf{J}^T\right)

Parameters:

jij_tensor (DataFrame) – Heisenberg tensor

Return type:

DataFrame

Returns:

tuple of the three aforementioned components

masci_tools.tools.greensf_calculations.heisenberg_reciprocal(qpoints, jij_data, entry='J_ij')[source]

Calculate the fourier transform of an entry for interaction constants

Example for J_{ij}

J(\mathbf{q})\ =\ \sum_{ij} J_{ij} e^{i\mathbf{q}\cdot\mathbf{R}_{ij}}

where \mathbf{R}_{ij} is the connecting vector associated with the J_{ij}

Parameters:
  • qpoints (ndarray) – numpy array containing the coordinates of the qpoints

  • jij_data (DataFrame) – DataFrame generated by the above calculation functions

  • entry (str) – str of the entry to calculate

Return type:

ndarray

Returns:

numpy array containing the Fourier transform

IO helper functions and file parsers

KKR related IO

In this module you find the kkrparams class that helps defining the KKR input parameters Also some defaults for the parameters are defined.

class masci_tools.io.kkr_params.kkrparams(**kwargs)[source]

Class for creating and handling the parameter input for a KKR calculation Optional keyword arguments are passed to init and stored in values dictionary.

Example usage: params = kkrparams(LMAX=3, BRAVAIS=array([[1,0,0], [0,1,0], [0,0,1]]))

Alternatively values can be set afterwards either individually with

params.set_value(‘LMAX’, 3)

or multiple keys at once with

params.set_multiple_values(EMIN=-0.5, EMAX=1)

Other useful functions

  • print the description of a keyword: params.get_description([key]) where [key] is a string for a keyword in params.values

  • print a list of mandatory keywords: params.get_all_mandatory()

  • print a list of keywords that are set including their value: params.get_set_values()

change_XC_val_kkrimp(val)[source]

Convert integer value of KKRhost KEXCOR input to KKRimp XC string input.

fill_keywords_to_inputfile(is_voro_calc=False, output='inputcard', no_check=False, verbose=False)[source]

Fill new inputcard with keywords/values automatically check for input consistency (can be disabled by the no_check input) if is_voro_calc==True change mandatory list to match voronoi code, default is KKRcode

classmethod get_KKRcalc_parameter_defaults(silent=False)[source]

set defaults (defined in header of this file) and returns dict, kkrparams_version

get_all_mandatory()[source]

Return a list of mandatory keys

get_description(key=None, search=None)[source]

Returns description of keyword ‘key’ If ‘key’ is None, print all descriptions of all available keywords If ‘search’ is not None, print all keys+descriptions where the search string is found

get_dict(group=None, subgroup=None)[source]

Returns values dictionary.

Prints values belonging to a certain group only if the ‘group’ argument is one of the following: ‘lattice’, ‘chemistry’, ‘accuracy’, ‘external fields’, ‘scf cycle’, ‘other’

Additionally the subgroups argument allows to print only a subset of all keys in a certain group. The following subgroups are available.

  • in ‘lattice’ group ‘2D mode’, ‘shape functions’

  • in ‘chemistry’ group ‘Atom types’, ‘Exchange-correlation’, ‘CPA mode’, ‘2D mode’

  • in ‘accuracy’ group ‘Valence energy contour’, ‘Semicore energy contour’, ‘CPA mode’, ‘Screening clusters’, ‘Radial solver’, ‘Ewald summation’, ‘LLoyd’

get_missing_keys(use_aiida=False)[source]

Find list of mandatory keys that are not yet set

get_set_values()[source]

Return a list of all keys/values that are set (i.e. not None)

get_type(key)[source]

Extract expected type of ‘key’ from format info

get_value(key)[source]

Gets value of keyword ‘key’

is_mandatory(key)[source]

Returns mandatory flag (True/False) for keyword ‘key’

items()[source]

make kkrparams.items() work

read_keywords_from_inputcard(inputcard='inputcard', verbose=False)[source]

Read list of keywords from inputcard and extract values to keywords dict

Example usage:

p = kkrparams(); p.read_keywords_from_inputcard(‘inputcard’)

Note:

converts ‘<RBLEFT>’, ‘<RBRIGHT>’, ‘ZPERIODL’, and ‘ZPERIODR’ automatically to Ang. units!

remove_value(key)[source]

Removes value of keyword ‘key’, i.e. resets to None

set_multiple_values(**kwargs)[source]

Set multiple values (in example value1 and value2 of keywords ‘key1’ and ‘key2’) given as key1=value1, key2=value2

set_value(key, value, silent=False)[source]

Sets value of keyword ‘key’

static split_kkr_options(valtxt)[source]

Split keywords after fixed length of 8 :type valtxt: :param valtxt: list of strings or single string :returns: List of keywords of maximal length 8

update_to_kkrimp()[source]

Update parameter settings to match kkrimp specification. Sets self.__params_type and calls _update_mandatory_kkrimp()

update_to_voronoi()[source]

Update parameter settings to match voronoi specification. Sets self.__params_type and calls _update_mandatory_voronoi()

Reading of shpefun files of KKR

masci_tools.io.kkr_read_shapefun_info.read_shapefun(path='.')[source]

Read vertices of shapefunctions with Zoom into shapefun of a single atom

Author:

Philipp Ruessmann

Parameters:

path – path where voronoi output is found (optional, defaults to ‘./’)

Returns pos:

positions of the centers of the shapefunctions

Returns out:

dictionary of the vertices of the shapefunctions

Here I collect all functions needed to parse the output of a KKR calculation. These functions do not need aiida and are therefore separated from the actual parser file where parse_kkr_outputfile is called

masci_tools.io.parsers.kkrparser_functions.check_error_category(err_cat, err_msg, out_dict)[source]

Check if parser error of the non-critical category (err_cat != 1) are actually consistent and may be discarded.

Parameters:
  • err_cat – the error-category of the error message to be investigated

  • err_msg – the error-message

  • out_dict – the dict of results obtained from the parser function

Returns:

True/False if message is an error or warning

masci_tools.io.parsers.kkrparser_functions.get_kmeshinfo(outfile_0init, outfile_000)[source]

Extract kmesh info from output.0.txt and output.000.txt

masci_tools.io.parsers.kkrparser_functions.get_lattice_vectors(outfile_0init)[source]

read direct and reciprocal lattice vectors in internal units (useful for qdos generation)

masci_tools.io.parsers.kkrparser_functions.get_natom(outfile_0init)[source]

extract NATYP value from output.0.txt

masci_tools.io.parsers.kkrparser_functions.get_noco_rms(outfile, debug=False)[source]

Get average noco rms error

masci_tools.io.parsers.kkrparser_functions.get_nspin(outfile_0init)[source]

extract NSPIN value from output.0.txt

masci_tools.io.parsers.kkrparser_functions.get_orbmom(outfile, natom)[source]

read orbmom info from outfile and return array (iteration, atom)=orbmom

masci_tools.io.parsers.kkrparser_functions.get_rms(outfile, outfile2, debug=False, is_imp_calc=False)[source]

Get rms error per atom (both values for charge and spin) and total (i.e. average) value

masci_tools.io.parsers.kkrparser_functions.get_single_particle_energies(outfile_000)[source]

extracts single particle energies from outfile_000 (output.000.txt) returns the valence contribution of the single particle energies

masci_tools.io.parsers.kkrparser_functions.get_spinmom_per_atom(outfile, natom, nonco_out_file=None)[source]

Extract spin moment information from outfile and nonco_angles_out (if given)

masci_tools.io.parsers.kkrparser_functions.parse_array_float(outfile, searchstring, splitinfo, replacepair=None, debug=False)[source]

Search for keyword searchstring in outfile and extract array of results

Returns: array of results

masci_tools.io.parsers.kkrparser_functions.parse_kkr_outputfile(out_dict, outfile, outfile_0init, outfile_000, timing_file, potfile_out, nonco_out_file, outfile_2='output.2.txt', skip_readin=False, debug=False)[source]

Parser method for the kkr outfile. It returns a dictionary with results

masci_tools.io.parsers.kkrparser_functions.use_BdG(outfile_0init)[source]

extract BdG run info from output.0.txt

masci_tools.io.parsers.kkrparser_functions.use_newsosol(outfile_0init)[source]

extract NEWSOSOL info from output.0.txt

Everything that is needed to parse the output of a voronoi calculation.

masci_tools.io.parsers.voroparser_functions.check_voronoi_output(potfile, outfile, delta_emin_safety=0.1)[source]

Read output from voronoi code and create guess of energy contour

masci_tools.io.parsers.voroparser_functions.get_valence_min(outfile='out_voronoi')[source]

Construct minimum of energy contour (between valence band bottom and core states)

masci_tools.io.parsers.voroparser_functions.parse_voronoi_output(out_dict, outfile, potfile, atominfo, radii, inputfile, debug=False)[source]

Parse output of voronoi calculation and return (success, error_messages_list, out_dict)

Tools for the impurity calculation plugin and its workflows

class masci_tools.io.parsers.kkrimp_parser_functions.KkrimpParserFunctions[source]

Class of parser functions for KKRimp calculation

Usage:

success, msg_list, out_dict = parse_kkrimp_outputfile().parse_kkrimp_outputfile(out_dict, files)

parse_kkrimp_outputfile(out_dict, file_dict, debug=False, ignore_nan=False)[source]

Main parser function for kkrimp, read information from files in file_dict and fills out_dict :type out_dict: :param out_dict: dictionary that is filled with parsed output of the KKRimp calculation :type file_dict: :param file_dict: dictionary of files that are parsed :type debug: :param debug: True/False to activate debug output :type ignore_nan: :param ignore_nan: bool replace NaN by zero with numpy’s nan_to_num function :returns: success (bool), msg_list(list of error/warning messages of parser), out_dict (filled dict of parsed output) :note: file_dict should contain the following keys

  • ‘outfile’, the std_out of the KKRimp calculation

  • ‘out_log’, the out_log.000.txt file

  • ‘out_pot’, the output potential

  • ‘out_enersp_at’, the out_energysp_per_atom_eV file

  • ‘out_enertot_at’, the out_energytotal_per_atom_eV file

  • ‘out_timing’, the timing file

  • ‘kkrflex_llyfac’, the file for the Lloyd factor

  • ‘kkrflex_angles’, the nonco_angles file for the KKRimp calculation

  • ‘out_spinmoms’, the output spin moments file

  • ‘out_orbmoms’, the output orbital moments file

General HDF5 parser

This module contains a generic HDF5 reader

class masci_tools.io.parsers.hdf5.reader.AttribTransformation(name, attrib_name, args, kwargs)[source]
args: tuple[Any, ...]

Alias for field number 2

attrib_name: str

Alias for field number 1

kwargs: dict[str, Any]

Alias for field number 3

name: str

Alias for field number 0

class masci_tools.io.parsers.hdf5.reader.HDF5LimitedTransformation[source]
class masci_tools.io.parsers.hdf5.reader.HDF5Reader(file, move_to_memory=True, filename='UNKNOWN')[source]

Class for reading in data from hdf5 files using a specified recipe

Parameters:
  • file (Union[str, bytes, Path, PathLike, IO[Any]]) – filepath to hdf file or opened file handle (mode ‘rb’)

  • move_to_memory (bool) – bool if True after reading and transforming the data all leftover h5py.Datasets are moved into np.arrays

  • filename (str) – Name of the file. Only used for logging. If not given and the file provides the information extract it from there

The recipe is passed to the HDF5Reader.read() method and consists of a dict specifying which attributes and datasets to read in and how to transform them

Each attribute/dataset entry corresponds to one entry point in the given .hdf file Available transformations can either be found in transforms or can be defined by the user with the hdf5_transformation() decorator

Basic Usage:

from masci_tools.io.parsers.hdf5 import HDF5Reader
import masci_tools.io.parsers.hdf5.recipes as recipes

#This example shows the usage for producing data from a bandstructure calculation
#in Fleur
with HDF5Reader('/path/to/hdf/banddos.hdf') as h5reader:
    data, attributes = h5reader.read(recipe=recipes.FleurBands)
print(data, attributes)
read(recipe=None)[source]

Extracts datasets from HDF5 file, transforms them and puts all into a namedtuple.

Parameters:

recipe (Optional[HDF5Recipe]) – dict with the format given in recipes

Return type:

tuple[dict[str, Any], dict[str, Any]]

Returns:

two dicts with the datasets/attributes read in and transformed according to the recipe

class masci_tools.io.parsers.hdf5.reader.HDF5Recipe[source]
class masci_tools.io.parsers.hdf5.reader.HDF5Transformation[source]
class masci_tools.io.parsers.hdf5.reader.Transformation(name, args, kwargs)[source]
args: tuple[Any, ...]

Alias for field number 1

kwargs: dict[str, Any]

Alias for field number 2

name: str

Alias for field number 0

This module defines commonly used recipes for the HDF5Reader

Available are:
  • Recipe for bandstructure calculations with Fleur

  • Recipes for almost all DOS calculation modes of Fleur

A Recipe is a python dictionary in a specific format.

A Template Example:

from masci_tools.io.parser.hdf5.readers import Transformation, AttribTransformation

RecipeExample = {
    'datasets': {
        'example_dataset': {
            'h5path': '/path/in/hdf/file',
            'transforms': [Transformation(name='get_first_element')]
        },
        'example_attrib_transform': {
            'h5path': '/other/path/in/hdf/file',
            'transforms': [AttribTransformation(name='multiply_by_attribute', attrib_name='example_attribute')]
        }
    },
    'attributes': {
        'example_attribute': {
            'h5path':
            '/path/in/hdf/file',
            'transforms':
            [Transformation(name='get_attribute', args=('attribName',)),
             Transformation(name='get_first_element')]
        }
    }
}

The Recipe consists of two sections ‘datasets’ and ‘attributes’. All data from these two sections will be returned in separate python dictionaries by the HDF5Reader class

Each entry in those sections has to have a h5path entry, which will specify the dataset to initially read from the hdf file. Then each entry can define a entry transforms with a list of the namedtuples imported at the top of the code example. These corresponds to function calls to functions in transforms to transform the read in data

Entries in the attributes section are read and transformed first and can subsequently be used in transformations for the datasets. These correpsond to the transforms created with the AttribTransformation namedtuple instead of Transformation.

masci_tools.io.parsers.hdf5.recipes.bands_recipe_format(group, simple=False)[source]

Format for bandstructure calculations retrieving weights from the given group

Parameters:
  • group (Literal['Local', 'jDOS', 'Orbcomp', 'MCD']) – str of the group the weights should be taken from

  • simple (bool) – bool, if True no additional weights are retrieved with the produced recipe

Return type:

HDF5Recipe

Returns:

dict of the recipe to retrieve a bandstructure calculation

masci_tools.io.parsers.hdf5.recipes.dos_recipe_format(group)[source]

Format for denisty of states calculations retrieving the DOS from the given group

Parameters:

group (Literal['Local', 'jDOS', 'Orbcomp', 'MCD']) – str of the group the DOS should be taken from

Return type:

HDF5Recipe

Returns:

dict of the recipe to retrieve a DOS calculation

masci_tools.io.parsers.hdf5.recipes.get_fleur_bands_specific_weights(weight_name, group='Local')[source]

Recipe for bandstructure calculations only retrieving one additional weight besides the eigenvalues and kpath

Parameters:
  • weight_name (str | list[str]) – key or list of keys of the weight(s) to retrieve

  • group (Literal['Local', 'jDOS', 'Orbcomp', 'MCD']) – optional str (default Local) name of the group from where to take the weights

Return type:

HDF5Recipe

Returns:

dict of the recipe to retrieve a simple bandstructure plus the one specified weight

Collection of predefined transformations for the HDF5Reader class

All Transformation have to be able to handle (or fail gracefully with a clear error) for the following 3 cases:

  1. The dataset is still a h5py.Dataset and might need to be transformed to a numpy array

  2. The dataset is a numpy array

  3. The dataset is a dict. This is needed to read arbitrary child dataset, where not all labels are known. Two options can be chosen apply the transformation to all keys in the dict or throw an error

masci_tools.io.parsers.hdf5.transforms.F

Generic Callable type

alias of TypeVar(‘F’, bound=Callable[[…], Any])

exception masci_tools.io.parsers.hdf5.transforms.HDF5TransformationError[source]
masci_tools.io.parsers.hdf5.transforms.add_partial_sums(dataset, attribute_value, pattern_format, make_set=False, replace_format=None)[source]

Add entries to the dataset dict (Only available for dict datasets) with sums over entries containing a given pattern formatted with a attribute_value

Used for example in the FleurBands recipe to calculate total atom weights with the pattern_format ‘MT:{}’.format and the atomtype as the attribute_value

Parameters:
  • dataset – dataset to transform

  • attribute_value – value to multiply by (attribute value passed in from _transform_dataset)

  • pattern_format – callable returning a formatted string This will be called with every entry in the attribute_value list

  • replace_format – callable returning a formatted string This will be called with every entry in the attribute_value list

Returns:

dataset with new entries containing the sums over entries matching the given pattern

masci_tools.io.parsers.hdf5.transforms.add_partial_sums_fixed(dataset, patterns, replace_entries=None)[source]

Add entries to the dataset dict (Only available for dict datasets) with sums over entries containing a given pattern

Used for example in the FleurBands recipe to calculate total atom weights with the patterns [‘MT:1’, ‘MT:2’, …]

Parameters:
  • dataset – dataset to transform

  • patterns – list of str to sum entries over

  • replace_entries – list of str under which to enter the entries back

Returns:

dataset with new entries containing the sums over entries matching the given pattern

masci_tools.io.parsers.hdf5.transforms.apply_lambda(dataset, lambda_func)[source]
Applies a given lambda function to the dataset

This should be used with care. One possible example is converting to a boolean with lambda x: x==1

Parameters:
  • dataset – dataset to transform

  • lambda_func – lambda function to apply to the dataset

Returns:

return value of the lambda function

masci_tools.io.parsers.hdf5.transforms.attributes(dataset)[source]

Extracts all attributes of the dataset

Parameters:

dataset – dataset to transform

Returns:

dict with all the set attributes on the dataset

masci_tools.io.parsers.hdf5.transforms.calculate_norm(dataset, between_neighbours=False)[source]

Calculate norms on the given dataset. Calculates the norm of each row in the dataset

Parameters:
  • dataset – dataset to transform

  • between_neighbours – bool, if True the distance between subsequent entries in the dataset is calculated

Returns:

norms of the given dataset

masci_tools.io.parsers.hdf5.transforms.convert_to_complex_array(dataset)[source]

Converts the given dataset of real numbers into dataset of complex numbers. This follows the convention of how complex numbers are normally written out by Fleur (last index 0 real part, last index 1 imag part)

Parameters:

dataset – dataset to transform

Returns:

dataset with complex values

masci_tools.io.parsers.hdf5.transforms.convert_to_str(dataset, join=False)[source]

Converts the given dataset to a numpy array of type string

Parameters:
  • dataset – dataset to transform

  • join – bool if True the result will be joined together

Returns:

numpy array of dtype str

masci_tools.io.parsers.hdf5.transforms.cumulative_sum(dataset, beginning_zero=True)[source]

Calculate the cumulative sum of the dataset

Parameters:

dataset – dataset to transform

Returns:

cumulative sum of the dataset

masci_tools.io.parsers.hdf5.transforms.flatten_array(dataset, order='C')[source]

Flattens the given dataset to one dimensional array. Copies the array !!

Parameters:
  • dataset – dataset to transform

  • order – str {C, F, A, K} flatten in column major or row-major order (see numpy.flatten documentation)

Returns:

flattened dataset

masci_tools.io.parsers.hdf5.transforms.get_all_child_datasets(group, ignore=None, contains=None)[source]

Get all datasets contained in the given group

Parameters:
  • group – h5py object to extract from

  • ignore – str or iterable of str (optional). These keys will be ignored

  • contains – str or iterable of str (optional). This phrase has to be in the key

Returns:

a dict with the contained dataset entered with their names as keys

masci_tools.io.parsers.hdf5.transforms.get_attribute(dataset, attribute_name)[source]

Extracts a specified attribute’s value.

Parameters:
  • dataset – dataset to transform

  • attribute_name – str of the attribute to extract from the dataset

Returns:

value of the attribute on the dataset

masci_tools.io.parsers.hdf5.transforms.get_first_element(dataset)[source]

Get the first element of the dataset.

Parameters:

dataset – dataset to transform

Returns:

first element of the dataset

masci_tools.io.parsers.hdf5.transforms.get_name(dataset, full_path=False)[source]

Get the name of the dataset.

Parameters:
  • dataset – dataset to get the shape

  • full_path – bool, if True the full path to the dataset is returned

Returns:

name of the dataset

masci_tools.io.parsers.hdf5.transforms.get_shape(dataset)[source]

Get the shape of the dataset.

Parameters:

dataset – dataset to get the shape

Returns:

shape of the dataset

masci_tools.io.parsers.hdf5.transforms.hdf5_transformation(*, attribute_needed)[source]

Decorator for registering a function as a transformation functions on the HDF5Reader class

Parameters:

attribute_needed (bool) – bool if True this function takes a previously processed attribute value and is therefore only available for the entries in datasets

Return type:

Callable[[TypeVar(F, bound= Callable[..., Any])], TypeVar(F, bound= Callable[..., Any])]

masci_tools.io.parsers.hdf5.transforms.index_dataset(dataset, index)[source]

Get the n-th element of the dataset.

Parameters:

dataset – dataset to transform

Returns:

first element of the dataset

masci_tools.io.parsers.hdf5.transforms.merge_subgroup_datasets(group, ignore=None, contains=None, ignore_group=None, contains_group=None, stack_results=True, sort_key=None)[source]

Get all datasets contained in the given group

Parameters:
  • group – h5py object to extract from

  • ignore_group – str or iterable of str (optional). These keys will be ignored

  • contains_group – str or iterable of str (optional). This phrase has to be in the key

  • ignore – str or iterable of str (optional). These keys of the datasets in the subgroup will be ignored

  • contains – str or iterable of str (optional). This phrase has to be in the key of the datasets in the subgroup

  • stack_results – bool if True the resulting list of datasets will be used to construct one numpy array

Returns:

a dict with the contained dataset of the subgroups of the given group entered with their names as keys

masci_tools.io.parsers.hdf5.transforms.move_to_memory(dataset)[source]

Moves the given dataset to memory, if it’s not already there Creates numpy arrays for each dataset it finds

Parameters:

dataset – dataset to transform

Returns:

dataset with h5py.Datasets converted to numpy arrays

masci_tools.io.parsers.hdf5.transforms.multiply_array(dataset, matrix, transpose=False)[source]

Multiply the given dataset with a matrix

Parameters:
  • dataset – dataset to multiply

  • matrix – matrix to multiply by

  • transpose – bool, if True the given matrix is transposed

Returns:

dataset multiplied with the given matrix

masci_tools.io.parsers.hdf5.transforms.multiply_by_attribute(dataset, attribute_value, transpose=False)[source]

Multiply the given dataset with a previously parsed attribute, either scalar or matrix like

Parameters:
  • dataset – dataset to transform

  • attribute_value – value to multiply by (attribute value passed in from _transform_dataset)

Only relevant for matrix multiplication: :type transpose:

param transpose:

bool if True the Matrix order is transposed before multiplying

Returns:

dataset multiplied with the given attribute_value

masci_tools.io.parsers.hdf5.transforms.multiply_scalar(dataset, scalar_value)[source]

Multiply the given dataset with a scalar_value

Parameters:
  • dataset – dataset to transform

  • scalar_value – value to multiply the dataset by

Returns:

the dataset multiplied by the scalar if it is a dict all entries are multiplied

masci_tools.io.parsers.hdf5.transforms.periodic_elements(dataset)[source]
Converts the given dataset (int or list of ints)

To the atomic symbols corresponding to the atomic number

Parameters:

dataset – dataset to transform

Returns:

str or array of str with the atomic elements

masci_tools.io.parsers.hdf5.transforms.repeat_array(dataset, n_repeats)[source]

Use numpy.repeat to repeat each element in array n-times

Parameters:
  • dataset – dataset to transform

  • n_repeats – int, time to repeat each element

Returns:

dataset with elements repeated n-times

masci_tools.io.parsers.hdf5.transforms.repeat_array_by_attribute(dataset, attribute_value)[source]

Use numpy.repeat to repeat each element in array n-times (given by attribute_value)

Parameters:
  • dataset – dataset to transform

  • attribute_shape – int, time to repeat the elements in the given array

Returns:

dataset with elements repeated n-times

masci_tools.io.parsers.hdf5.transforms.shift_by_attribute(dataset, attribute_value, negative=False)[source]

Shift the dataset by the given value of the attribute

Parameters:
  • dataset – dataset to transform

  • attribute_value – value to shift the dataset by

  • negative – bool, if True the scalar_value will be subtracted

Returns:

the dataset shifted by the scalar if it is a dict all entries are shifted

masci_tools.io.parsers.hdf5.transforms.shift_dataset(dataset, scalar_value, negative=False)[source]

Shift the dataset by the given scalar_value

Parameters:
  • dataset – dataset to transform

  • scalar_value – value to shift the dataset by

  • negative – bool, if True the scalar_value will be subtracted

Returns:

the dataset shifted by the scalar if it is a dict all entries are shifted

masci_tools.io.parsers.hdf5.transforms.slice_dataset(dataset, slice_arg)[source]

Slice the dataset with the given slice argument.

Parameters:
  • dataset – dataset to transform

  • slice_arg – slice to apply to the dataset

Returns:

first element of the dataset

masci_tools.io.parsers.hdf5.transforms.split_array(dataset, suffixes=None, name=None)[source]

Split the arrays in a dataset into multiple entries by their first index

If the dataset is a dict the entries will be split up. If the dataset is not a dict a dict is created with the dataset entered under name and this will be split up

Parameters:
  • dataset – dataset to transform

  • suffix – Optional list of str to use for suffixes for the split up entries. by default it is the value of the first index of the original array

  • name – str for the case of the dataset not being a dict. Key for the entry in the new dict for the original dataset. The returned dataset will only contain the split up entries

  • dataset – dict with the entries split up

masci_tools.io.parsers.hdf5.transforms.stack_datasets(dataset, axis=0, sort_key=None)[source]

Stack the entries in the given dict dataset along the given axis

Parameters:
  • dataset – dict dataset to transform

  • axis – int along which axis should be stacked

Returns:

the array resulting from stacking all entries in the dictionary

masci_tools.io.parsers.hdf5.transforms.sum_over_dict_entries(dataset, overwrite_dict=False, entries=None, dict_entry='sum', entry_format=None)[source]

Sum the datasets contained in the given dict dataset

Parameters:
  • dataset – dataset to transform

  • overwrite_dict – bool if True, the result will overwrite the dictionary if False it is entered under sum in the dict

Returns:

dataset with summed entries

masci_tools.io.parsers.hdf5.transforms.tile_array(dataset, n_repeats)[source]

Use numpy.tile to repeat array n-times

Parameters:
  • dataset – dataset to transform

  • attribute_shape – int, time sto repeat the given array

Returns:

dataset repeated n-times

masci_tools.io.parsers.hdf5.transforms.tile_array_by_attribute(dataset, attribute_value)[source]

Use numpy.tile to repeat array n-times (given by attribute_value)

Parameters:
  • dataset – dataset to transform

  • attribute_shape – int, time sto repeat the given array

Returns:

dataset repeated n-times

Definition of default parsing tasks for fleur out.xml

This module contains the dictionary with all defined tasks for the outxml_parser. The entries in the TASK_DEFINITION dict specify how to parse specific attributes tags.

This needs to be maintained if the specifications do not work for a new schema version because of changed attribute names for example.

Each entry in the TASK_DEFINITION dict can contain a series of keys, which by default correspond to the keys in the output dictionary

The following keys are expected in each entry:
param parse_type:

str, defines which methods to use when extracting the information

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

If parse_type is not equal to xmlGetter the following key is required:
param path_spec:

dict with all the arguments that should be passed to tag_xpath or attrib_xpath to get the correct path

param kwargs:

additional arguments to pass to the parsing function

In the case of xmlGetter the following keys are allowed:
param name:

name of the function in masci_tools.util.xml.xml_getters (required)

param result_names:

list of str defining the keys under which to enter the outputs of the function

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 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}

Each task entry can have additional keys to specify, when to perform the task. These are denoted with underscores in their names and are all optional:

param _general:

bool, default False. If True the parsing is not performed for each iteration on the iteration node but beforehand and on the root node

param _modes:

list of tuples, sets conditions for the keys in fleur_modes to perform the task .e.g. [(‘jspins’, 2), (‘soc’, True)] means only perform this task for a magnetic soc calculation

param _minimal:

bool, default False, denotes task to perform when minimal_mode=True is passed to the parser

param _special:

bool, default False, If true these tasks are not added by default and need to be added manually

param _conversions:

list of str, gives the names of functions in fleur_outxml_conversions to perform after parsing

The following keys are special at the moment:
  • fleur_modes specifies how to identify the type of the calculation (e.g. SOC, magnetic, lda+u) this is used to determine, whether additional things should be parsed

Following is the current specification of tasks

  1from masci_tools.util.parse_utils import Conversion
  2
  3__working_out_versions__ = {'0.34', '0.35', '0.36', '0.37'}
  4__base_version__ = '0.34'
  5
  6TASKS_DEFINITION = {
  7    #--------Definitions for general info from outfile (start, endtime, number_iterations)--------
  8    'general_out_info': {
  9        '_general': True,
 10        '_minimal': True,
 11        '_conversions': [Conversion(name='calculate_walltime')],
 12        'creator_name': {
 13            'parse_type': 'attrib',
 14            'path_spec': {
 15                'name': 'version',
 16                'not_contains': 'git'
 17            }
 18        },
 19        'creator_target_architecture': {
 20            'parse_type': 'text',
 21            'path_spec': {
 22                'name': 'targetComputerArchitectures'
 23            }
 24        },
 25        'output_file_version': {
 26            'parse_type': 'attrib',
 27            'path_spec': {
 28                'name': 'fleurOutputVersion'
 29            }
 30        },
 31        'number_of_iterations': {
 32            'parse_type': 'numberNodes',
 33            'path_spec': {
 34                'name': 'iteration'
 35            }
 36        },
 37        'number_of_atoms': {
 38            'parse_type': 'attrib',
 39            'path_spec': {
 40                'name': 'nat'
 41            }
 42        },
 43        'number_of_atom_types': {
 44            'parse_type': 'attrib',
 45            'path_spec': {
 46                'name': 'ntype'
 47            }
 48        },
 49        'number_of_kpoints': {
 50            'parse_type': 'attrib',
 51            'path_spec': {
 52                'name': 'count',
 53                'contains': 'numericalParameters'
 54            }
 55        },
 56        'start_date': {
 57            'parse_type': 'allAttribs',
 58            'path_spec': {
 59                'name': 'startDateAndTime'
 60            },
 61            'flat': False,
 62            'kwargs': {
 63                'ignore': ['zone'],
 64            }
 65        },
 66        'end_date': {
 67            'parse_type': 'allAttribs',
 68            'path_spec': {
 69                'name': 'endDateAndTime'
 70            },
 71            'flat': False,
 72            'kwargs': {
 73                'ignore': ['zone'],
 74            }
 75        }
 76    },
 77    #--------Defintions for general info from input section of outfile (kmax, symmetries, ..)--------
 78    'general_inp_info': {
 79        '_general': True,
 80        '_minimal': True,
 81        'title': {
 82            'parse_type': 'text',
 83            'path_spec': {
 84                'name': 'comment'
 85            }
 86        },
 87        'kmax': {
 88            'parse_type': 'attrib',
 89            'path_spec': {
 90                'name': 'Kmax'
 91            }
 92        },
 93        'gmax': {
 94            'parse_type': 'attrib',
 95            'path_spec': {
 96                'name': 'Gmax'
 97            }
 98        },
 99        'number_of_spin_components': {
100            'parse_type': 'attrib',
101            'path_spec': {
102                'name': 'jspins'
103            }
104        },
105        'number_of_symmetries': {
106            'parse_type': 'numberNodes',
107            'path_spec': {
108                'name': 'symOp'
109            }
110        },
111        'number_of_species': {
112            'parse_type': 'numberNodes',
113            'path_spec': {
114                'name': 'species'
115            }
116        },
117        'film': {
118            'parse_type': 'exists',
119            'path_spec': {
120                'name': 'filmPos'
121            }
122        },
123    },
124    #--------Defintions for lda+u info from input section (species, ldau tags)--------
125    'ldau_info': {
126        '_general': True,
127        '_modes': [('ldau', True)],
128        '_conversions': [Conversion(name='convert_ldau_definitions')],
129        'parsed_ldau': {
130            'parse_type': 'allAttribs',
131            'path_spec': {
132                'name': 'ldaU',
133                'contains': 'species'
134            },
135            'subdict': 'ldau_info',
136            'flat': False,
137            'kwargs': {
138                'only_required': True
139            }
140        },
141        'ldau_species': {
142            'parse_type': 'parentAttribs',
143            'path_spec': {
144                'name': 'ldaU',
145                'contains': 'species'
146            },
147            'subdict': 'ldau_info',
148            'flat': False,
149            'kwargs': {
150                'only_required': True
151            }
152        }
153    },
154    'ldahia_info': {
155        '_general': True,
156        '_modes': [('ldahia', True)],
157        '_conversions': [Conversion(name='convert_ldahia_definitions')],
158        'parsed_ldahia': {
159            'parse_type': 'allAttribs',
160            'path_spec': {
161                'name': 'ldaHIA',
162                'contains': 'species'
163            },
164            'subdict': 'ldahia_info',
165            'flat': False,
166        },
167        'ldahia_species': {
168            'parse_type': 'parentAttribs',
169            'path_spec': {
170                'name': 'ldaHIA',
171                'contains': 'species'
172            },
173            'subdict': 'ldahia_info',
174            'flat': False,
175            'kwargs': {
176                'only_required': True
177            }
178        }
179    },
180    #--------Defintions for relaxation info from input section (bravais matrix, atompos)
181    #--------for Bulk and film
182    'relax_info': {
183        '_general': True,
184        '_modes': [
185            ('relax', True),
186        ],
187        '_conversions': [Conversion(name='convert_relax_info')],
188        'parsed_relax_info': {
189            'parse_type': 'xmlGetter',
190            'name': 'get_structuredata',
191            'kwargs': {
192                'convert_to_angstroem': False,
193                'include_relaxations': False
194            }
195        }
196    },
197    'hubbard1_distances': {
198        '_general': True,  #General because not every iteration contains a hubbard1 iteration
199        '_minimum_version': '0.35',
200        '_minimal': True,
201        '_modes': [('ldahia', True)],
202        'occupation_distance': {
203            'parse_type': 'attrib',
204            'path_spec': {
205                'name': 'occupationDistance'
206            },
207            'kwargs': {
208                'iteration_path': True,
209                'list_return': True
210            },
211            'subdict': 'ldahia_info',
212        },
213        'element_distance': {
214            'parse_type': 'attrib',
215            'path_spec': {
216                'name': 'elementDistance'
217            },
218            'kwargs': {
219                'iteration_path': True,
220                'list_return': True
221            },
222            'subdict': 'ldahia_info',
223        }
224    },
225    #----General iteration tasks
226    # iteration number
227    # total energy (only total or also contributions, also lda+u correction)
228    # distances (nonmagnetic and magnetic, lda+u density matrix)
229    # charges (total, interstitial, mt sphere)
230    # fermi energy and bandgap
231    # magnetic moments
232    # orbital magnetic moments
233    # forces
234    'iteration_number': {
235        '_minimal': True,
236        'number_of_iterations_total': {
237            'parse_type': 'attrib',
238            'path_spec': {
239                'name': 'overallNumber'
240            },
241            'overwrite_last': True,
242        }
243    },
244    'total_energy': {
245        '_minimal':
246        True,
247        '_conversions': [
248            Conversion(name='convert_htr_to_ev', kwargs={
249                'name': 'energy_hartree',
250                'converted_name': 'energy',
251            }),
252            Conversion(name='convert_htr_to_ev',
253                       kwargs={
254                           'name': 'ts_energy_hartree',
255                           'converted_name': 'ts_energy',
256                           'pop': True
257                       })
258        ],
259        'energy_hartree': {
260            'parse_type': 'attrib',
261            'path_spec': {
262                'name': 'value',
263                'tag_name': 'freeEnergy'
264            }
265        },
266        'energy_hartree_units': {
267            'parse_type': 'attrib',
268            'path_spec': {
269                'name': 'units',
270                'tag_name': 'totalEnergy'
271            },
272            'overwrite_last': True,
273        },
274        'ts_energy_hartree': {
275            'parse_type': 'attrib',
276            'path_spec': {
277                'name': 'value',
278                'tag_name': 'tkbtimesentropy'
279            }
280        }
281    },
282    'distances': {
283        '_minimal': True,
284        'density_convergence': {
285            'parse_type': 'attrib',
286            'path_spec': {
287                'name': 'distance',
288                'tag_name': 'chargeDensity'
289            }
290        },
291        'density_convergence_units': {
292            'parse_type': 'attrib',
293            'path_spec': {
294                'name': 'units',
295                'tag_name': 'densityConvergence',
296            },
297            'overwrite_last': True,
298        }
299    },
300    'magnetic_distances': {
301        '_minimal': True,
302        '_modes': [('jspin', 2)],
303        'overall_density_convergence': {
304            'parse_type': 'attrib',
305            'path_spec': {
306                'name': 'distance',
307                'tag_name': 'overallChargeDensity'
308            }
309        },
310        'spin_density_convergence': {
311            'parse_type': 'attrib',
312            'path_spec': {
313                'name': 'distance',
314                'tag_name': 'spinDensity'
315            }
316        }
317    },
318    'total_energy_contributions': {
319        'sum_of_eigenvalues': {
320            'parse_type': 'singleValue',
321            'path_spec': {
322                'name': 'sumOfEigenvalues'
323            },
324            'kwargs': {
325                'only_required': True
326            }
327        },
328        'energy_core_electrons': {
329            'parse_type': 'singleValue',
330            'path_spec': {
331                'name': 'coreElectrons',
332                'contains': 'sumOfEigenvalues'
333            },
334            'kwargs': {
335                'only_required': True
336            }
337        },
338        'energy_valence_electrons': {
339            'parse_type': 'singleValue',
340            'path_spec': {
341                'name': 'valenceElectrons'
342            },
343            'kwargs': {
344                'only_required': True
345            }
346        },
347        'charge_den_xc_den_integral': {
348            'parse_type': 'singleValue',
349            'path_spec': {
350                'name': 'chargeDenXCDenIntegral'
351            },
352            'kwargs': {
353                'only_required': True
354            }
355        },
356    },
357    'ldau_energy_correction': {
358        '_modes': [('ldau', True)],
359        'ldau_energy_correction': {
360            'parse_type': 'singleValue',
361            'path_spec': {
362                'name': 'dftUCorrection'
363            },
364            'subdict': 'ldau_info',
365            'kwargs': {
366                'only_required': True
367            }
368        },
369    },
370    'nmmp_distances': {
371        '_minimal': True,
372        '_modes': [('ldau', True)],
373        'density_matrix_distance': {
374            'parse_type': 'attrib',
375            'path_spec': {
376                'name': 'distance',
377                'contains': 'ldaUDensityMatrixConvergence'
378            },
379            'subdict': 'ldau_info'
380        },
381    },
382    'fermi_energy': {
383        'fermi_energy': {
384            'parse_type': 'singleValue',
385            'path_spec': {
386                'name': 'FermiEnergy'
387            },
388        }
389    },
390    'bandgap': {
391        '_modes': [('bz_integration', 'hist')],
392        'bandgap': {
393            'parse_type': 'singleValue',
394            'path_spec': {
395                'name': 'bandgap'
396            },
397        }
398    },
399    'magnetic_moments': {
400        '_modes': [('jspin', 2)],
401        'magnetic_moments': {
402            'parse_type': 'allAttribs',
403            'path_spec': {
404                'name': 'magneticMoment'
405            },
406            'base_value': 'moment',
407            'kwargs': {
408                'ignore': ['atomType'],
409            }
410        }
411    },
412    'orbital_magnetic_moments': {
413        '_modes': [('jspin', 2), ('soc', True)],
414        'orbital_magnetic_moments': {
415            'parse_type': 'allAttribs',
416            'path_spec': {
417                'name': 'orbMagMoment'
418            },
419            'base_value': 'moment',
420            'kwargs': {
421                'ignore': ['atomType'],
422            }
423        }
424    },
425    'global_magnetic_moments': {
426        '_minimum_version': '0.35',
427        '_modes': [('noco', True)],
428        'magnetic_vec_moments': {
429            'parse_type': 'attrib',
430            'path_spec': {
431                'name': 'vec',
432                'contains': 'magnetic',
433                'tag_name': 'globalMagMoment'
434            }
435        }
436    },
437    'magnetic_moment': {
438        '_minimum_version': '0.36',
439        '_modes': [('jspin', 2), ('noco', False)],
440        'magnetic_vec_moments': {
441            'parse_type': 'attrib',
442            'path_spec': {
443                'name': 'vec',
444                'contains': 'magneticMomentsIn',
445                'not_contains': 'local'
446            }
447        }
448    },
449    'forces': {
450        '_minimal': True,
451        '_modes': [('relax', True)],
452        '_conversions': [Conversion(name='convert_forces')],
453        'force_units': {
454            'parse_type': 'attrib',
455            'path_spec': {
456                'name': 'units',
457                'tag_name': 'totalForcesOnRepresentativeAtoms'
458            },
459            'overwrite_last': True
460        },
461        'parsed_forces': {
462            'parse_type': 'allAttribs',
463            'path_spec': {
464                'name': 'forceTotal'
465            },
466            'flat': False,
467            'kwargs': {
468                'only_required': True
469            }
470        }
471    },
472    'charges': {
473        '_conversions': [Conversion(name='calculate_total_magnetic_moment')],
474        'spin_dependent_charge': {
475            'parse_type': 'allAttribs',
476            'path_spec': {
477                'name': 'spinDependentCharge',
478                'contains': 'allElectronCharges',
479                'not_contains': 'fixed'
480            },
481            'kwargs': {
482                'only_required': True
483            }
484        },
485        'total_charge': {
486            'parse_type': 'singleValue',
487            'path_spec': {
488                'name': 'totalCharge',
489                'contains': 'allElectronCharges',
490                'not_contains': 'fixed'
491            },
492            'kwargs': {
493                'only_required': True
494            }
495        }
496    },
497    #-------Tasks for forcetheorem Calculations
498    # DMI, JIJ, MAE, SSDISP
499    'forcetheorem_dmi': {
500        '_special': True,
501        'dmi_force': {
502            'parse_type': 'allAttribs',
503            'path_spec': {
504                'name': 'Entry',
505                'contains': 'DMI'
506            }
507        },
508        'dmi_force_so': {
509            'parse_type': 'allAttribs',
510            'path_spec': {
511                'name': 'allAtoms',
512                'contains': 'DMI'
513            }
514        },
515        'dmi_force_qs': {
516            'parse_type': 'attrib',
517            'path_spec': {
518                'name': 'qpoints',
519                'contains': 'Forcetheorem_DMI'
520            }
521        },
522        'dmi_force_angles': {
523            'parse_type': 'attrib',
524            'path_spec': {
525                'name': 'Angles',
526                'contains': 'Forcetheorem_DMI'
527            }
528        },
529        'dmi_force_units': {
530            'parse_type': 'attrib',
531            'path_spec': {
532                'name': 'units',
533                'contains': 'Forcetheorem_DMI'
534            }
535        }
536    },
537    'forcetheorem_ssdisp': {
538        '_special': True,
539        'spst_force': {
540            'parse_type': 'allAttribs',
541            'path_spec': {
542                'name': 'Entry',
543                'contains': 'SSDISP'
544            }
545        },
546        'spst_force_qs': {
547            'parse_type': 'attrib',
548            'path_spec': {
549                'name': 'qvectors',
550                'contains': 'Forcetheorem_SSDISP'
551            }
552        },
553        'spst_force_units': {
554            'parse_type': 'attrib',
555            'path_spec': {
556                'name': 'units',
557                'contains': 'Forcetheorem_SSDISP'
558            }
559        }
560    },
561    'forcetheorem_mae': {
562        '_special': True,
563        'mae_force': {
564            'parse_type': 'allAttribs',
565            'path_spec': {
566                'name': 'Angle',
567                'contains': 'MAE'
568            }
569        },
570        'mae_force_units': {
571            'parse_type': 'attrib',
572            'path_spec': {
573                'name': 'units',
574                'contains': 'Forcetheorem_MAE'
575            }
576        }
577    },
578    'forcetheorem_jij': {
579        '_special': True,
580        'jij_force': {
581            'parse_type': 'allAttribs',
582            'path_spec': {
583                'name': 'Config',
584                'contains': 'JIJ'
585            }
586        },
587        'jij_force_units': {
588            'parse_type': 'attrib',
589            'path_spec': {
590                'name': 'units',
591                'contains': 'Forcetheorem_JIJ'
592            }
593        }
594    },
595    'torques': {
596        '_minimum_version': '0.35',  #Typo torgue/torque before
597        '_optional': True,
598        'torque_x': {
599            'parse_type': 'attrib',
600            'path_spec': {
601                'name': 'sigma_x',
602                'contains': 'noncollinearTorque'
603            }
604        },
605        'torque_y': {
606            'parse_type': 'attrib',
607            'path_spec': {
608                'name': 'sigma_y',
609                'contains': 'noncollinearTorque'
610            }
611        }
612    },
613    'noco_angles': {
614        '_general': True,
615        '_optional': True,
616        'noco_alpha': {
617            'parse_type': 'attrib',
618            'path_spec': {
619                'name': 'alpha',
620                'tag_name': 'nocoParams',
621                'contains': 'Group'
622            }
623        },
624        'noco_beta': {
625            'parse_type': 'attrib',
626            'path_spec': {
627                'name': 'beta',
628                'tag_name': 'nocoParams',
629                'contains': 'Group'
630            }
631        }
632    },
633    'corelevels': {
634        '_optional': True,
635        'corestates': {
636            'parse_type': 'allAttribs',
637            'path_spec': {
638                'name': 'coreStates'
639            },
640            'kwargs': {
641                'subtags': True,
642            },
643            'flat': False
644        }
645    }
646}

In this module migration functions for the task definitions are collected

masci_tools.io.parsers.fleur.task_migrations.migrate_033_to_031(definition_dict)[source]

Migrate definitions for MaX5 release to MaX4 release

Return type:

dict[str, dict[str, Any]]

Changes:
  • LDA+U density matrix distance output did not exist

masci_tools.io.parsers.fleur.task_migrations.migrate_034_to_033(definition_dict)[source]

Migrate definitions for MaX5 bugfix release to MaX5 release

Return type:

dict[str, dict[str, Any]]

Changes:
  • forcetheorem units attribute did not exist (get from ‘sumValenceSingleParticleEnergies’)

Commandline interface (CLI)

masci_tools

CLI for the masci-tools library.

masci_tools [OPTIONS] COMMAND [ARGS]...

Options

-v, --version

Show the version and exit.

convert-inpgen

Convert the given file to an fleur inpgen file

masci_tools convert-inpgen [OPTIONS] INPUT_FILE OUTPUT_FILE

Options

-c, --converter <converter>

Which library is used to read in the given file format

Options:

ase | pymatgen

Arguments

INPUT_FILE

Required argument

OUTPUT_FILE

Required argument

fleur-schema

Commands related to the Fleur XML Schemas

masci_tools fleur-schema [OPTIONS] COMMAND [ARGS]...

add

Adds a new xml schema file to the folder in masci_tools/io/parsers/fleur_schema corresponding to its version number

masci_tools fleur-schema add [OPTIONS] SCHEMA_FILE

Options

--overwrite

Overwrite any existing schema-file

--branch <branch>

If the file does not exist the branch can be specified in the fleur git

--api-key <api_key>

API key for access to the Iff Gitlab instance

--test-xml-file <test_xml_file>

Example xmlfile for this schema version to test the file parser against

--from-git

Add the schema from the fleur git repository

Arguments

SCHEMA_FILE

Required argument

list

Show the available fleur schemas

masci_tools fleur-schema list [OPTIONS]

pull

Pull the default XML schema files from the iffgit and store them in the subfolder of masci_tools/io/parsers/fleur_schema corresponding to its version number

masci_tools fleur-schema pull [OPTIONS] BRANCH

Options

--api-key <api_key>

API key for access to the Iff Gitlab instance

--test-xml-file <test_xml_file>

Example xmlfile for this schema version to test the file parser against

Arguments

BRANCH

Required argument

validate-input

Validate the given inp.xml file against the Fleur schema stored for the version of the input

masci_tools fleur-schema validate-input [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

validate-output

Validate the given out.xml file against the Fleur schema stored for the version of the output

masci_tools fleur-schema validate-output [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

inpxml

Tool for converting inp.xml files to different versions

masci_tools inpxml [OPTIONS] COMMAND [ARGS]...

convert

Convert the given XML_FILE file to version TO_VERSION

XML_FILE is the file to convert TO_VERSION is the file version of the finale input file

masci_tools inpxml convert [OPTIONS] XML_FILE TO_VERSION

Options

-o, --output-file <output_file>

Name of the output file

--overwrite

If the flag is given and the file already exists it is overwritten

Arguments

XML_FILE

Required argument

TO_VERSION

Required argument

generate-conversion

Generate the conversions from FROM_VERSION to TO_VERSION

FROM_VERSION is the file version of the initial input file TO_VERSION is the file version of the finale input file

masci_tools inpxml generate-conversion [OPTIONS] FROM_VERSION TO_VERSION

Options

--show, --no-show

Show a summary of the conversion at the end

Arguments

FROM_VERSION

Required argument

TO_VERSION

Required argument

show-conversion

Show the actions for an already created conversion from FROM_VERSION to TO_VERSION

FROM_VERSION is the file version of the initial input file TO_VERSION is the file version of the finale input file

masci_tools inpxml show-conversion [OPTIONS] FROM_VERSION TO_VERSION

Arguments

FROM_VERSION

Required argument

TO_VERSION

Required argument

parse

Commands for parsing information from KKR/Fleur files

masci_tools parse [OPTIONS] COMMAND [ARGS]...

all-attribs

Parse all attributes of the specified tag from the given xml file

masci_tools parse all-attribs [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>
--subtags
--text

Arguments

XML_FILE

Required argument

attrib

Parse the specified attribute from the given xml file

masci_tools parse attrib [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>
-t, --tag <tag>

Arguments

XML_FILE

Required argument

cell

Parse the unit cell definition of the given xml file

masci_tools parse cell [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

constants

Parse the mathematical constants used in the given xml-file

masci_tools parse constants [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

fleur-modes

Parse the Fleur modes of the given xml file

masci_tools parse fleur-modes [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

inp-file

Parse the Fleur inp.xml into a python dictionary

masci_tools parse inp-file [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

kpoints

Parse the used kpoints from the given xml-file

masci_tools parse kpoints [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

nkpts

Extract the number of kpoints used in the given xml file

masci_tools parse nkpts [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

number-nodes

Return how often the specified tag occurs in the given xml file

masci_tools parse number-nodes [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>

Arguments

XML_FILE

Required argument

out-file

Parse the Fleur out.xml into a python dictionary

masci_tools parse out-file [OPTIONS] XML_FILE

Options

--ignore-validation

Arguments

XML_FILE

Required argument

parameters

Parse the calculation parameters of the given xml file

masci_tools parse parameters [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

parent-attribs

Parse all attributes of the parent of the specified tag from the given xml file

masci_tools parse parent-attribs [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>

Arguments

XML_FILE

Required argument

relaxation

Parse the relaxation information for the given xml file

masci_tools parse relaxation [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

structure

Parse the structure information in the given Fleur xml file

masci_tools parse structure [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

symmetry

Parse the symmetry information for the given xml file

masci_tools parse symmetry [OPTIONS] XML_FILE

Arguments

XML_FILE

Required argument

tag-exists

Return whether the specified tag exists in the given xml file

masci_tools parse tag-exists [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>

Arguments

XML_FILE

Required argument

text

Parse the text of the specified tag from the given xml file

masci_tools parse text [OPTIONS] XML_FILE

Options

-n, --name <name>
-c, --contains <contains>
-nc, --not-contains <not_contains>

Arguments

XML_FILE

Required argument

plot

Commands for visualizing data

masci_tools plot [OPTIONS] COMMAND [ARGS]...

fleur-bands

Plot bandstructures from the banddos.hdf file from Fleur

masci_tools plot fleur-bands [OPTIONS] BANDDOS_FILE

Options

-w, --weight <weight>
--backend <backend>
Options:

matplotlib | mpl | bokeh

--save
--show
-r, --recipe <recipe>
Options:

FleurBands | FleurOrbcompBands | FleurjDOSBands | FleurSimpleBands | FleurMCDBands

Arguments

BANDDOS_FILE

Required argument

fleur-dos

Plot density of states from the banddos.hdf file from Fleur

masci_tools plot fleur-dos [OPTIONS] BANDDOS_FILE

Options

--total <total>
--interstitial <interstitial>
--atoms <atoms>
--l_resolved <l_resolved>
--backend <backend>
Options:

matplotlib | mpl | bokeh

--save
--show
-r, --recipe <recipe>
Options:

FleurDOS | FleurORBCOMP | FleurJDOS | FleurMCD

Arguments

BANDDOS_FILE

Required argument