galore package

Module contents

galore.apply_orbital_weights(pdos_data, cross_sections)[source]

Weight orbital intensities by cross-section for photoemission simulation

Parameters
  • pdos_data (dict) –

    DOS data in format:

    {'el1': {'energy': values, 's': values, 'p': values ...},
     'el2': {'energy': values, 's': values, ...}, ...}
    

    where DOS values are 1D numpy arrays. Orbital labels must match cross_sections data. It is recommended to use collections.OrderedDict instead of regular dictionaries, to ensure consistent output.

    In addition, the fields “citation”, “link” and “energy” are recognised and logged as “INFO”.

  • cross_sections (dict) –

    Weightings in format:

    {'el1': {'1s': x1, '2s': x2, '2p': x3 ...},
     'el2': {'3s': y1, '3p': y2 ...}, ...}
    

    The labels should correspond to the headers in the input data. It is fine not so specify the level (e.g. use ‘s’, ‘p’, etc.) as is done in the sample data; however, this means that all levels are being treated equally and hence probably the core levels will be weighted incorrectly. It is possible to set the cross-section of undesired orbitals (e.g. projection onto d-orbital for early elements) to None; in this case the orbital will be dropped from the returned data set.

Returns

Weighted data in same format as input

Return type

weighted_pdos_data (dict)

galore.auto_limits(data_1d, padding=0.05)[source]

Return limiting values outside data range

Parameters
  • data_1d (iterable) – Data to obtain range from

  • padding (float) – Scale factor for padding relative to data range

Returns

(2-tuple) (xmin, xmax)

galore.broaden(data, dist='lorentz', width=2, pad=False, d=1)[source]

Given a 1d data set, use convolution to apply a broadening function

Parameters
  • data (np.array) – 1D array of data points to broaden

  • dist (str) – Type of distribution used for broadening. Currently only “Lorentz” is supported.

  • width (float) – Width parameter for broadening function. Determines the full-width at half-maximum (FWHM) of the broadening function.

  • pad (float) – Distance sampled on each side of broadening function.

  • d (float) – x-axis distance associated with each sample in 1D data

galore.delta(f1, f2, w=1)[source]

Compare two frequencies, return 1 if close

galore.gaussian(f, f0=0, fwhm=1)[source]

Gaussian function with height 1 centered on f0

f (np.array): 1D array of x-values (e.g. frequencies) f0 (float): Origin of function fwhm (float): full-width half-maximum (FWHM); i.e. the width of the function at half its maximum value.

galore.lorentzian(f, f0=0, fwhm=1)[source]

Lorentzian function with height 1 centered on f0.

Parameters
  • f (np.array) – 1D array of x-values (e.g. frequencies)

  • f0 (float) – Origin of function

  • fwhm (float) – full-width half-maximum (FWHM); i.e. the width of the function at half its maximum value.

galore.process_1d_data(input=['vasprun.xml'], gaussian=None, lorentzian=None, sampling=0.01, xmin=None, xmax=None, spikes=False, **kwargs)[source]

Read 1D data series from files, process for output

Parameters
  • input (str or 1-list) – Input data file. Pass as either a string or a list containing one string

  • **kwargs – See main command reference

Returns

Resampled x-values and corresponding broadened data as 1D numpy arrays

Return type

2-tuple (np.ndarray, np.ndarray)

galore.process_pdos(input=['vasprun.xml'], gaussian=None, lorentzian=None, weighting=None, sampling=0.01, xmin=None, xmax=None, flipx=False, **kwargs)[source]

Read PDOS from files, process for output

Parameters
  • input (list or str) –

    Files for processing. Vasp output or space-separated files with

    XXX_EL_YYY.EXT filename pattern where EL is the element label. We recommend SYSTEM_EL_dos.dat. Alternatively, a pymatgen.electronic_structure.dos.CompleteDos can be provided. Spin channels indicated by an (up) or (down) suffix in file header will be combined for each orbital type.

  • **kwargs – See main command reference

Returns

Weighted and resampled orbital data in format:

{'el1': {'energy': values, 's': values, 'p': values ...},
 'el2': {'energy': values, 's': values, ...}, ...}

Return type

dict

galore.xy_to_1d(xy, x_values, spikes=False)[source]

Convert a set of x,y coordinates to 1D array

Data is resampled to a given sequence of regularly-spaced x-values. By default linear interpolation is used between neighbouring points, which is suitable for resampling distribution data.

Where the data consists of a set of discrete energy levels, it should be resampled to a series of “spikes”. y-values are placed on the nearest x-value by subtracting d/2 and rounding up. d is determined by examining the first two elements of x_values.

Parameters
  • xy – (ndarray) 2D numpy array of x, y values

  • x_values – (iterable) An evenly-spaced x-value mesh

Returns

re-sampled y values corresponding to x_values

Return type

(np.array)