tp package

Module contents

A package for postprocessings transport calculations.

tp.docstring_replace(**kwargs)[source]

Submodules

tp.calculate module

Calculates quantities used in other modules.

Uses tp units by default, but can read the tprc.yaml to customise.

tp.calculate.be_occupation(frequency, temperature, use_tprc=True)[source]

Calculates Bose-Einstein occupation.

Parameters
  • frequency (array-like or float) – frequencies (by default in THz).

  • temperature (array-like or float) – temperature (by default in K).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

occupations.

Return type

array-like

tp.calculate.cumulate(x, y)[source]

Sorts by x and cumulates y.

Parameters
  • x (array-like) – x-values.

  • y (array-like) – y-values.

Returns

  • np.array – sorted x-values.

  • np.array – cumulated y-values.

tp.calculate.dfdde(energy, fermi_level, temperature, amset_order=False, use_tprc=True)[source]

Derivative of the Fermi-Dirac distribution wrt energy.

Parameters
  • energy (array-like) – energies per band and k-point (by default in eV).

  • fermi_level (array-like) – fermi level per temperature and dopant (by default in eV).

  • temperature (array-like) – temperatures (by default in K).

  • amset_order (bool, optional) – doping index before temperature index. Default: False.

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

derivative of the Fermi-Dirac distribution.

Return type

np.array

tp.calculate.fd_occupation(energy, temperature, fermi_level, use_tprc=True)[source]

Calculates Fermi-Dirac occupation.

Assumes singly-occupied bands: double as necessary.

Parameters
  • energy (array-like or float) – energies (by default in eV).

  • temperature (array-like or float) – temperature (by default in K).

  • fermi_level (array-like or float) – fermi level (by default in eV).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

occupations.

Return type

array-like

tp.calculate.from_tp(name, value)[source]

Converts quantity from tp default units using tprc.yaml.

Parameters
  • value (array-like) – values to be converted.

  • name (str) – name in tprc.yaml.

Returns

converted values.

Return type

np.array

tp.calculate.gaussian(x, x0=0, sigma=1)[source]

Gaussian function with height 1 centered on x0.

Parameters
  • x (array-like) – x-values.

  • x0 (float) – origin of function.

  • sigma (float) – standard deviation.

Returns

Gaussian

Return type

np.array

tp.calculate.interpolate(data1, data2, dependent, keys1, keys2, axis1=0, axis2=0, kind='linear')[source]

Shrinks datasets to smallest common size and interpolates.

Parameters
  • data(1,2) (dict) – input data.

  • dependent (str) – variable to interpolate against.

  • keys(1,2) (array-like or str) – data keys to interpolate

  • axis(1,2) (int, optional) – axis of the dependent variable wrt the keys. Default: 0.

  • kind (str, optional) – interpolation kind

Returns

  • dict – shrunk data1

  • dict – shrunk and interpolated data2

tp.calculate.kl(conductivity, seebeck, electronic_thermal_conductivity, zt, temperature, use_tprc=True)[source]

Calculates lattice thermal conductivity.

Parameters
  • conductivity (array-like) – conductivities (by default in S m-1).

  • seebeck (array-like) – seebeck coefficients (by default in muV K-1).

  • electronic_thermal_conductivity (array-like) – electronic thermal conductivities (by default in W m-1 K-1).

  • zt (array-like) – zt.

  • temperature (array-like) – temperatures (by default in K).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

lattice thermal conductivities (by default in W m-1 K-1).

Return type

np.array

tp.calculate.kl_fromdict(data, use_tprc=True)[source]

Convenience wrapper to calculate k_latt from a dictionary.

Parameters
  • data (dict) –

    dictionary containing:

    conductivityarray-like

    conductivities (by default in S m-1).

    seebeckarray-like

    seebeck coefficients (by default in muV K-1).

    electronic_thermal_conductivityarray-like

    electronic thermal conductivities (by default in W m-1 K-1).

    ztarray-like

    zt.

    temperaturearray-like

    temperatures (by default in K).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

dictionary with lattice thermal conductivities (by default in W m-1 K-1).

Return type

dict

tp.calculate.lifetime(gamma, use_tprc=True)[source]

Calculates lifetime from imaginary self-energy (Gamma).

Parameters
  • gamma (array-like or float) – frequencies (by default in THz).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

lifetimes (by default in s).

Return type

np.array

tp.calculate.lorentzian(x, x0=0, fwhm=1)[source]

Area conserved Lorentzian function centered on x0.

Parameters
  • x (array-like) – x-values.

  • x0 (float) – origin of function.

  • fwhm (float) – full-width at half-maximum.

Returns

Lorentzian

Return type

np.array

tp.calculate.mfp(gamma, group_velocity, use_tprc=True)[source]

Calculates mean free path from imaginary self-energy (Gamma) and group velocity.

Parameters
  • gamma (array-like or float) – frequencies (by default in THz).

  • group_velocity (array-like or float) – group velocities (by default in m s-1).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

mean free paths (by default in m).

Return type

array-like

tp.calculate.power_factor(conductivity, seebeck, use_tprc=True)[source]

Calculates power factor.

Parameters
  • conductivity (array-like) – conductivities (by default in S m-1).

  • seebeck (array-like) – seebeck coefficients (by default in muV K-1).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

power factors (by default in W m-1 K-2).

Return type

np.array

tp.calculate.power_factor_fromdict(data, use_tprc=True)[source]

Convenience wrapper to calculate power factor from a dictionary.

Parameters
  • data (dict) –

    dictionary containing:

    conductivityarray-like

    conductivities (by default in S m-1).

    seebeckarray-like

    seebeck coefficients (by default in muV K-1).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

dictionary with power factors (by default in W m-1 K-2).

Return type

dict

tp.calculate.thermal_conductivity(etc, ltc, use_tprc=True)[source]

Calculates ZT.

Parameters
  • etc (array-like) – electronic thermal conductivities (by default in W m-1 K-1).

  • ltc (array-like) – lattice thermal conductivities (by default in W m-1 K-1).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

thermal conductivity.

Return type

np.array

tp.calculate.to_tp(name, value)[source]

Converts quantity to tp default units using tprc.yaml.

Parameters
  • value (array-like) – values to be converted.

  • name (str) – name in tprc.yaml.

Returns

converted values.

Return type

np.array

tp.calculate.zt(conductivity, seebeck, electronic_thermal_conductivity, lattice_thermal_conductivity, temperature, use_tprc=True)[source]

Calculates ZT.

Parameters
  • conductivity (array-like) – conductivities (by default in S m-1).

  • seebeck (array-like) – seebeck coefficients (by default in muV K-1).

  • electronic_thermal_conductivity (array-like) – electronic thermal conductivities (by default in W m-1 K-1).

  • lattice_thermal_conductivity (array-like) – lattice thermal conductivities (by default in W m-1 K-1).

  • temperature (array-like) – temperatures (by default in K).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

ZT.

Return type

np.array

tp.calculate.zt_fromdict(data, use_tprc=True)[source]

Convenience wrapper to calculate ZT from a dictionary.

Parameters
  • data (dict) –

    dictionary containing:

    conductivityarray-like

    conductivities (by default in S m-1).

    seebeckarray-like

    seebeck coefficients (by default in muV K-1).

    electronic_thermal_conductivityarray-like

    electronic thermal conductivities (by default in W m-1 K-1).

    lattice_thermal_conductivityarray-like

    lattice thermal conductivities (by default in W m-1 K-1).

    temperaturearray-like

    temperatures (by default in K).

  • use_tprc (bool, optional) – use custom unit conversions. Default: True.

Returns

dictionary with ZTs.

Return type

dict

tp.settings module

Settings and defaults.

This module sets the default style sheet, tick locators and axis labels; as well as providing a means to automatically convert the units presented and add abbreviations that can be used when loading data. Custom defaults can be set by saving a copy of tprc.yaml (found in the main ThermoParser directory) to ~/.config/tprc.yaml and editing that.

tp.settings.amset_conversions()[source]

Get dictionary of unit conversions for amset to tp.

tp.settings.boltztrap_conversions()[source]

Get dictionary of unit conversions for boltztrap to tp.

tp.settings.boltztrap_dimensions()[source]

Get dictionary of dimensions of quantities updated for BoltzTraP.

tp.settings.conversions()[source]

Get dictionary of custom unit conversions from tprc.yaml.

tp.settings.dimensions()[source]

Get dictionary of dimensions of quantities used in tp.

tp.settings.inverted_labels()[source]

Get the default labels for inverted axes in tp.

tp.settings.labels()[source]

Get the default labels for small axes in tp.

tp.settings.locator()[source]

Get default locators.

tp.settings.long_labels()[source]

Get a dictionary of long-form axis labels.

tp.settings.medium_labels()[source]

Get a dictionary of medium-length axis labels.

tp.settings.phono3py_conversions()[source]

Get dictionary of unit conversions for phono3py to tp.

tp.settings.phonopy_conversions()[source]

Get dictionary of unit conversions for phonopy to tp.

tp.settings.short_labels()[source]

Get dictionary of short-form axis labels.

tp.settings.to_amset()[source]

Get dictionary to translate to amset.

tp.settings.to_boltztrap()[source]

Get dictionary to translate to boltztrap.

tp.settings.to_phono3py()[source]

Get dictionary to convert to phono3py.

tp.settings.to_tp()[source]

Get dictionary to translate to tp.

tp.settings.units(use_tprc=True)[source]

Get dictionary of units of quantities used in tp.

Parameters

use_tprc (bool, optional) – read custom units from tprc.yaml if present. Default: True.