Source code Documentation (API reference)

Visualisation and Plotting

In this module are plot routines collected to create default plots out of certain ouput 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 ploted, parse a dict or filepath.

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.

masci_tools.vis.plot_methods.construct_corelevel_spectrum(coreleveldict, natom_typesdict, exp_references={}, scale_to=-1, fwhm_g=0.6, fwhm_l=0.1, energy_range=[None, None], energy_grid=0.2, peakfunction='voigt')[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(xdata, bins=None, range=None, density=None, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, normed=None, data=None, axis=None, title='hist', xlabel='bins', ylabel='counts', **kwargs)[source]

Create a standard looking histogram

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.histogram(xdata, bins=None, range=None, density=None, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, normed=None, data=None, axis=None, title='hist', xlabel='bins', ylabel='counts', limits=[None, None], legend=False, legend_option={}, saveas='histogram', return_hist_output=False, **kwargs)[source]

Create a standard looking histogram

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.lorentzian(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, sdata, xlabel='', ylabel='', title='', plot_labels=[], marker='o', legend=False, legend_option={}, saveas='mscatterplot', limits=[None, None], scale=[None, None], axis=None, color=[], xticks=[], alpha=1.0, label=None, **kwargs)[source]

xdata : list or array ydata : list or array sdata: marker size list or array Info: x, y and s data must have the same dimensions. …

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

Create a scatter plot with multiple axes

masci_tools.vis.plot_methods.multiple_scatterplots(ydata, xdata, xlabel, ylabel, title, plot_labels=None, linestyle='-', marker='o', markersize=4.0, legend=False, legend_option={}, saveas='mscatterplot', limits=[None, None], scale=[None, None], axis=None, xerr=None, yerr=None, colors=[], linewidth=[], xticks=[], **kwargs)[source]

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

masci_tools.vis.plot_methods.multiplot_moved(ydata, xdata, xlabel, ylabel, title, plot_labels, scale_move=1.0, linestyle='-', marker='o', legend=False, legend_option={}, saveas='mscatterplot', limits=[None, None], scale=[None, None])[source]

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

masci_tools.vis.plot_methods.plot_bands(path_to_bands_file, kpath, title='Bandstructure', plotlabel='bands', linetyp='o', limits=[None, None], saveas='bandstructure', color='k')[source]

Plot a band structure from a bands.1 file from FLEUR params: kpath: dict: {r”$Gamma$”: 0.00000, r”$H$” : 1.04590, r”$N$” : 1.78546, r”$P$”: 2.30841, r”$Gamma$” : 3.21419, r”$N$” 3.95375 }

masci_tools.vis.plot_methods.plot_bands2(xs, ys, ss, axis=None, linestyle='-', markersize_scaling=20, **kwargs)[source]
masci_tools.vis.plot_methods.plot_bands_and_dos()[source]

PLot a Bandstructure with a density of states on the right side.

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

Plot only certain bands from a bands.1 file from FLEUR

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

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

masci_tools.vis.plot_methods.plot_convergence_results_m(distances, total_energies, iterations, plot_labels=[], saveas1='t_energy_convergence', saveas2='distance_convergence')[source]

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

masci_tools.vis.plot_methods.plot_convex_hull2d(hull, title='Convex Hull', xlabel='Atomic Procentage', ylabel='Formation energy / atom [eV]', linestyle='-', marker='o', legend=False, legend_option={}, saveas='convex_hull', limits=[None, None], scale=[None, None], axis=None, color='k', color_line='k', linewidth=2.0, markersize=4.0, marker_hull='o', markersize_hull=4.0, **kwargs)[source]

Plot method for a 2d convex hull diagramm

Parameters:hull – scipy.spatial.ConvexHull
masci_tools.vis.plot_methods.plot_corelevel_spectra(coreleveldict, natom_typesdict, exp_references={}, scale_to=-1, show_single=True, show_ref=True, energy_range=[None, None], title='', fwhm_g=0.6, fwhm_l=0.1, energy_grid=0.2, peakfunction='voigt', linetyp_spec='o-', limits=[None, None], xlabel='Binding energy [eV]', ylabel='Intensity [arb] (natoms*nelectrons)', saveas=None, **kwargs)[source]

Ploting function of corelevel in the form of a spectrum.

Convention: Binding energies are positiv!

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 refereces, 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 (gaus, 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]} # TODO feature to make singles of different compounds a different color

masci_tools.vis.plot_methods.plot_corelevels(coreleveldict, compound='')[source]

Ploting function to visualize corelevels and corelevel shifts

masci_tools.vis.plot_methods.plot_dos(path_to_dosfile, only_total=False, saveas='dos_plot', title='Density of states', linestyle='-', marker=None, legend=False, limits=[None, None])[source]

Plot the total density of states from a FLEUR DOS.1 file

params:

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

Plot the density of states from a FLEUR DOS.1 file

params:

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

Plot the density of states from a FLEUR DOS.1 file

params:

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

Plot the density of states from a FLEUR DOS.1 file

params:

masci_tools.vis.plot_methods.plot_fleur_bands(filename, limits=[None, [-15, 15]])[source]

plot a fleur bandstructure

# TODO: performance has to be increased. Maybe allow to specify a procentage of the kpoints to read in and plot. Therefore enable a partially read in of the dos_band.hdf

masci_tools.vis.plot_methods.plot_lattice_constant(Total_energy, scaling, fit_y=None, relative=True, ref_const=None, multi=False, plotlables=['simulation data', 'fit results'], title='Equation of states', saveas='Lattice_constant')[source]

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

params: Total_energy, list with floats, or list of lists of floats params: scaling, list with floats, or list of lists of floats params: fit_y, list with floats, evaluated fit, or list of lists of floats params: relative = True, (optional), scaling factor given, or lattice constants given? params: ref_const = None, (optional), float, or list of floats, lattice constant for scaling 1.0 params: multi = False, (optional), bool, multiple plots? params: plotlables, list of strings, for lableling of the plots. params: title

masci_tools.vis.plot_methods.plot_one_element_corelv(corelevel_dict, element, compound='')[source]

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

i.e

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. Absolut 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', hist=True)[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.

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

Plot a spin density of states from FLEUR DOS.1, DOS.2 files together in one plot.

params:

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 gaus to lorentz, mix* gaus, (1-mix)*Lorentz
masci_tools.vis.plot_methods.set_plot_defaults(title_fontsize=16, linewidth=2.0, markersize=4.0, labelfonstsize=15, ticklabelsize=14, axis_linewidth=2.0, tick_paramsx={'labelsize': 14, 'length': 5, 'size': 4.0, 'width': 1.0}, tick_paramsy={'labelsize': 14, 'length': 5, 'size': 4.0, 'width': 1.0}, figsize=(8, 6), save_plots=False, save_format='pdf', legend=True, save_raw_plot_data=False, raw_plot_data_format='txt', show=True, use_axis_fromatter=True, **kwargs)[source]

Try to use this to set some global default values.

Set some evironment variable with or global variables.

masci_tools.vis.plot_methods.single_scatterplot(ydata, xdata, xlabel, ylabel, title, plotlabel='scatterplot', linestyle='-', marker='o', limits=[None, None], saveas='scatterplot', color='k', scale=[None, None], axis=None, xerr=None, yerr=None, markersize=4.0, **kwargs)[source]

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

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

Create a standard 3D surface plot

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, plot_labels, linetyp='o-', legend=False, legend_option={}, saveas='mscatterplot', limits=[None, None], scale=[None, None])[source]

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

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

plotting routine for dos files

masci_tools.vis.kkr_plot_FS_qdos.dispersionplot(p0='./', totonly=True, s=20, ls_ef=':', lw_ef=1, units='Ry', noefline=False, color='', reload_data=False, clrbar=True, logscale=True, nosave=False, atoms=[], ratios=False, atoms2=[], noscale=False, newfig=False, cmap=None, alpha=1.0, qcomponent=-1, clims=[], xscale=1.0, raster=True, atoms3=[], alpha_reverse=False, return_data=False, xshift=0, yshift=0)[source]

plotting routine for dos files

masci_tools.vis.kkr_plot_FS_qdos.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=[], lmdos=False, lm=[], 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

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

plotting routine for dos files

masci_tools.vis.kkr_plot_bandstruc_qdos.dispersionplot(p0='./', totonly=True, s=20, ls_ef=':', lw_ef=1, units='Ry', noefline=False, color='', reload_data=False, clrbar=True, logscale=True, nosave=False, atoms=[], ratios=False, atoms2=[], noscale=False, newfig=False, cmap=None, alpha=1.0, qcomponent=-1, clims=[], xscale=1.0, raster=True, atoms3=[], alpha_reverse=False, return_data=False, xshift=0, yshift=0)[source]

plotting routine for dos files

masci_tools.vis.kkr_plot_bandstruc_qdos.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=[], lmdos=False, lm=[], 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

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

plotting routine for dos files

masci_tools.vis.kkr_plot_dos.dispersionplot(p0='./', totonly=True, s=20, ls_ef=':', lw_ef=1, units='Ry', noefline=False, color='', reload_data=False, clrbar=True, logscale=True, nosave=False, atoms=[], ratios=False, atoms2=[], noscale=False, newfig=False, cmap=None, alpha=1.0, qcomponent=-1, clims=[], xscale=1.0, raster=True, atoms3=[], alpha_reverse=False, return_data=False, xshift=0, yshift=0)[source]

plotting routine for dos 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=[], lmdos=False, lm=[], 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

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

Change the zoom of a 3d plot

Author:

Philipp Ruessmann

Parameters:
  • ax – axis which is zoomed
  • zoom_range – range to which the image is zoomed, total range from center-zoom_range to center+zoom_range
  • center – center of the zoomed region (optional, defaults to origin)
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)

I/O helper and output file parsers

Here commonly used functions that do not need aiida-stuff (i.e. can be tested without a database) are collected.

masci_tools.io.common_functions.angles_to_vec(magnitude, theta, phi)[source]

convert (magnitude, theta, phi) to (x,y,z)

theta/phi need to be in radians!

Input can be single number, list of numpy.ndarray data Returns x,y,z vector

masci_tools.io.common_functions.get_corestates_from_potential(potfile='potential')[source]

Read core states from potential file

masci_tools.io.common_functions.get_ef_from_potfile(potfile)[source]

extract fermi energy from potfile

masci_tools.io.common_functions.get_highest_core_state(nstates, energies, lmoments)[source]

Find highest lying core state from list of core states, needed to find and check energy contour

masci_tools.io.common_functions.interpolate_dos(dospath, return_original=False)[source]

interpolation function copied from complexdos3 fortran code

Principle of DOS here: Two-point contour integration for DOS in the middle of the two points. The input DOS and energy must be complex. Parameter deltae should be of the order of magnitude of eim:

      <-2*deltae->   _
           /\        |     DOS=(n(1)+n(2))/2 + (n(1)-n(2))*eim/deltae
          /  \       |
        (1)  (2)   2*i*eim=2*i*pi*Kb*Tk
        /      \     |
       /        \    |
------------------------ (Real E axis)
Parameters:input – dospath, path where ‘complex.dos’ file can be found
Returns:E_Fermi, numpy array of interpolated dos
Note:output units are in Ry!
masci_tools.io.common_functions.vec_to_angles(vec)[source]

converts vector (x,y,z) to (magnitude, theta, phi)

Io routines for band structure files

masci_tools.io.io_fleur_bands.read_fleur_banddos_hdf(filepath)[source]

Reads in the banddos.hdf file from the FLEUR code

returns a dictionary containing all datasets with multidim numpy arrays and also containing the attributes of the groups

Parameters:filepath – path to the banddos.hdf file
Returns:xcoord, bands, xlabels, band_character, band_char_label,

kpoints, weights, rep_cell, cell, positions, atomicnumbers, special_point_pos

Expected file content: datasets [u’bravaisMatrix’,

u’numFoundEigenvals’, u’specialPointIndices’, u’lLikeCharge’, u’positions’, u’atomicNumbers’, u’coordinates’, u’weights’, u’reciprocalCell’, u’eigenvalues’, u’specialPointLabels’, u’equivAtomsGroup’]

attributes: {u’lastFermiEnergy’: array([0.20852455]),

u’maxL’: array([3], dtype=int32), u’nAtoms’: array([2], dtype=int32), u’nSpecialPoints’: array([7], dtype=int32), u’nTypes’: array([1], dtype=int32), u’neigd’: array([19], dtype=int32), u’nkpt’: array([100], dtype=int32), u’spins’: array([1], dtype=int32), u’version’: array([1], dtype=int32)}

IO routines for hdf

masci_tools.io.io_hdf5.read_hdf(filepath)[source]

Reads in an hdf file and returns its context in a nested dictionary

!Only works for files with unique group and dataset names

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()

Note: KKR-units (e.g. atomic units with energy in Ry, length in a_Bohr) are assumed
except for the keys’<RBLEFT>’, ‘<RBRIGHT>’, ‘ZPERIODL’, and ‘ZPERIODR’ which should be given in Ang. units!
fill_keywords_to_inputfile(is_voro_calc=False, output='inputcard')[source]

Fill new inputcard with keywords/values automatically check for input consistency 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)[source]

Returns description of keyword ‘key’

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’

read_keywords_from_inputcard(inputcard='inputcard')[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’

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()

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
masci_tools.io.kkrimp_scoef_tools.find_neighbors(structure, structure_array, i, radius, clust_shape='spherical', h=0.0, vector=[0.0, 0.0, 1.0])[source]

Applies periodic boundary conditions and obtains the distances between the selected atom i in the cell and all other atoms that lie within a cutoff radius r_cut. Afterwards an numpy array with all those atoms including atom i (x_res) will be returned.

Parameters:
  • structure – input parameter of the StructureData type containing the three bravais lattice cell vectors
  • structure_array – input numpy structure array containing all the structure related data
  • i – centered atom at which the origin lies (same one as in select_reference)
  • radius – Specifies the radius of the cylinder or of the sphere, depending on clust_shape. Input in units of the lattice constant.
  • clust_shape – specifies the shape of the cluster that is used to determine the neighbors for the ‘scoef’ file. Default value is ‘spherical’. Other possible forms are ‘cylindrical’ (‘h’ and ‘orient’ needed), … .
  • h – needed for a cylindrical cluster shape. Specifies the height of the cylinder. Default=0. Input in units of the lattice constant.
  • vector – needed for a cylindrical cluster shape. Specifies the orientation vector of the cylinder. Default: z-direction.
Returns:

array with all the atoms within the cutoff (x_res)

ToDo:
  • dynamical box construction (r_cut determines which values n1, n2, n3 have)
  • different cluster forms (spherical, cylinder, …), add default parameters, better solution for ‘orient’
masci_tools.io.kkrimp_scoef_tools.get_distance(structure_array, i, j)[source]

Calculates and returns the distances between to atoms i and j in the given structure_array

Parameters:structure_array – input numpy array of the cell containing all the atoms ((# of atoms) x 6-matrix)
Params i, j:indices of the atoms for which the distance should be calculated (indices again start at 0)
Returns:distance between atoms i and j in units of alat
Note:
masci_tools.io.kkrimp_scoef_tools.get_structure_data(structure)[source]

Function to take data from AiiDA’s StructureData type and store it into a single numpy array of the following form: a = [[x-Position 1st atom, y-Position 1st atom, z-Position 1st atom, index 1st atom, charge 1st atom, 0.],

[x-Position 2nd atom, y-Position 2nd atom, z-Position 2nd atom, index 2nd atom, charge 1st atom, 0.], […, …, …, …, …, …], … ]
Parameters:structure – input structure of the type StructureData
Returns:numpy array a[# of atoms in the unit cell][5] containing the structure related data (positions in units of the unit cell length)
Note:
masci_tools.io.kkrimp_scoef_tools.make_scoef(structure, radius, path, h=-1.0, vector=[0.0, 0.0, 1.0], i=0)[source]

Creates the ‘scoef’ file for a certain structure. Needed to conduct an impurity KKR calculation.

Parameters:
  • structure – input structure of the StructureData type.
  • radius – input cutoff radius in units of the lattice constant.
  • h – height of the cutoff cylinder (negative for spherical cluster shape). For negative values, clust_shape will be automatically assumed as ‘spherical’. If there will be given a h > 0, the clust_shape will be ‘cylindrical’.
  • vector – orientation vector of the cylinder (just for clust_shape=’cylindrical’).
  • i – atom index around which the cluster should be centered. Default: 0 (first atom in the structure).
masci_tools.io.kkrimp_scoef_tools.rotate_onto_z(structure, structure_array, vector)[source]

Rotates all positions of a structure array of orientation ‘orient’ onto the z-axis. Needed to implement the cylindrical cutoff shape.

Parameters:
  • structure – input structure of the type StructureData
  • structure_array – input structure array, obtained by select_reference for the referenced system.
  • vector – reference vector that has to be mapped onto the z-axis.
Returns:

rotated system, now the ‘orient’-axis is aligned with the z-axis

masci_tools.io.kkrimp_scoef_tools.select_reference(structure_array, i)[source]

Function that references all of the atoms in the cell to one particular atom i in the cell and calculates the distance from the different atoms to atom i. New numpy array will have the form: x = [[x-Position 1st atom, y-Position 1st atom, z-Position 1st atom, index 1st atom, charge 1st atom,

distance 1st atom to atom i],
[x-Position 2nd atom, y-Position 2nd atom, z-Position 2nd atom, index 2nd atom, charge 1st atom,
distance 1st atom to atom i],

[…, …, …, …, …, …], … ]

Parameters:
  • structure_array – input array of the cell containing all the atoms (obtained from get_structure_data)
  • i – index of the atom which should be the new reference
Returns:

new structure array with the origin at the selected atom i (for KKRimp: impurity atom)

Note:

the first atom in the structure_array is labelled with 0, the second with 1, …

masci_tools.io.kkrimp_scoef_tools.write_scoef(x_res, path)[source]

Sorts the data from find_neighbors with respect to the distance to the selected atom and writes the data correctly formatted into the file ‘scoef’. Additionally the total number of atoms in the list is written out in the first line of the file.

Parameters:x_res – array of atoms within the cutoff radius obtained by find_neighbors (unsorted)
Output:returns scoef file with the total number of atoms in the first line, then with the formatted positions, indices, charges and distances in the subsequent lines.

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_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_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_kkr_outputfile(out_dict, outfile, outfile_0init, outfile_000, timing_file, potfile_out, nonco_out_file, outfile_2='output.2.txt')[source]

Parser method for the kkr outfile. It returns a dictionary with results

masci_tools.io.parsers.kkrparser_functions.use_newsosol(outfile_0init)[source]

extract NEWSOSOL info from output.0.txt

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

Parse output of voronoi calculation and return (success, error_messages_list, out_dict)

class masci_tools.io.parsers.kkrimp_parser_functions.kkrimp_parser_functions[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)[source]

Main parser function for kkrimp, read information from files in file_dict and fills out_dict :param out_dict: dictionary that is filled with parsed output of the KKRimp calculation :param file_dict: dictionary of files that are parsed :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
class masci_tools.io.parsers.kkrimp_parser_functions.modify_potential[source]

Class for old modify potential script, ported from modify_potential script, initially by D. Bauer

neworder_potential(potfile_in, potfile_out, neworder, potfile_2=None, replace_from_pot2=None)[source]

Read potential file and new potential using a list describing the order of the new potential. If a second potential is given as input together with an index list, then the corresponding of the output potential are overwritten with positions from the second input potential.

Parameters:
  • potfile_in (str) – absolute path to input potential
  • potfile_out (str) – absolute path to output potential
  • neworder (list) – list after which output potential is constructed from input potential
  • potfile_2 (str) – optional, absolute path to second potential file if positions in new list of potentials shall be replaced by positions of second potential, requires replace_from_pot to be given as well
  • replace_from_pot (list) – optional, list containing tuples of (position in newlist that is to be replaced, position in pot2 with which position is replaced)
Usage:
  1. modify_potential().neworder_potential(<path_to_input_pot>, <path_to_output_pot>, [])
shapefun_from_scoef(scoefpath, shapefun_path, atom2shapes, shapefun_new)[source]

Read shapefun and create impurity shapefun using scoef info and shapes array

Parameters:
  • scoefpath – absolute path to scoef file
  • shapefun_path – absolute path to input shapefun file
  • shapes – shapes array for mapping between atom index and shapefunction index
  • shapefun_new – absolute path to output shapefun file to which the new shapefunction will be written