thermodynamics#

Solve charge neutrality and compute defect equilibria

Classes

Conductivity(mobilities)

Class that handles conductivity calculations.

DefectThermodynamics(defects_analysis, bulk_dos)

Class that handles the calculations of defect equilibriua under different conditions.

ThermoData(thermodata[, name])

Class to handle defect thermodynamics data

class Conductivity(mobilities)[source]#

Bases: object

Class that handles conductivity calculations.

Parameters:

mobilities (dict) – Dictionary with mobility values for the defect species in [cm^2/(V*s)]. Keys must contain “electrons”, “holes” and the defect species names.

get_conductivities_from_thermodata(thermodata)[source]#

Calculate conductivities from defect and carrier concentrations in thermodynamic data. Only the defect species which are present in the mobility dict are considered for the calculation of the conductivity.

Parameters:

thermodata (ThermoData) – ThermoData object that contains the thermodynamic data.

Returns:

conductivities – List with conductivity values in S/m.

Return type:

list

get_conductivity(carrier_concentrations, defect_concentrations)[source]#

Calculate conductivity from the concentrations of electrons, holes and defects and their mobilities.

Parameters:
  • carrier_concentrations (list) – List of tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

  • defect_concentrations (list) – Defect concentrations in the same format as the output of DefectsAnalysis in cm^-3.

Returns:

sigma – Conductivity in S/m.

Return type:

float

class DefectThermodynamics(defects_analysis, bulk_dos, fixed_concentrations=None, external_defects=[], xtol=1e-05, eform_kwargs={}, dconc_kwargs={})[source]#

Bases: object

Class that handles the calculations of defect equilibriua under different conditions.

Parameters:
  • defects_analysis (DefectsAnalysis) – DefectsAnalysis object.

  • bulk_dos (dict or Dos) –

    Density of states to integrate. Can be provided as density of states D(E) or using effective masses.

    Format for effective masses is a dict with the following keys:

    • ”m_eff_h” : holes effective mass in units of m_e (electron mass)

    • ”m_eff_e” : electrons effective mass in units of m_h

    Format for explicit DOS (dictionary) with the following keys:

    • ’energies’ : list or np.array with energy values

    • ’densities’ : list or np.array with total density values

    • ’structure’ : pymatgen Structure of the material, needed for DOS volume and charge normalization

    Alternatively, a pymatgen Dos object (Dos, CompleteDos, or FermiDos).

  • fixed_concentrations (dict) – Dictionary with fixed concentrations. Keys are defect entry names in the standard format, values are the concentrations. (ex {‘Vac_Na’:1e20})

  • external_defects (list) – List of external defect concentrations (not present in defect entries). Must either be a list of dictionaries with {‘charge’: float, ‘conc’: float} or a list of SingleDefConc objects.

  • xtol (float) – Tolerance for bisect (scipy) to solve charge neutrality.

  • eform_kwargs (dict) – Kwargs to pass to entry.formation_energy.

  • dconc_kwargs (dict) – Kwargs to pass to entry.defect_concentration.

get_pO2_quenched_thermodata(reservoirs, initial_temperature, final_temperature, quenched_species=None, quench_elements=False, name=None)[source]#

Calculate defect and carrier concentrations as a function of oxygen partial pressure with quenched defects. It is possible to select which defect species to quench and which ones are free to equilibrate. Frozen defects in the inputs of the class are still considered.

Parameters:
  • reservoirs (dict, Reservoirs or PressureReservoirs) – Object with partial pressure values as keys and chempots dictionary as values.

  • initial_temperature (float) – Value of initial temperature in K.

  • final_temperature (float) – Value of final temperature in K.

  • quenched_species (list) – List of defect species to quench. If None all defect species are quenched.The default is None.

  • quench_elements (bool) – If True the total concentrations of elements at high temperature go in the charge neutrality at low temperature. If False the quenched concentrations are the ones of single defect species (e.g. elements are not allowed to equilibrate on different sites). The default is False.

  • name (str) – Name to assign to ThermoData.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

partial_pressures(list)

List of partial pressure values in atm.

defect_concentrations(list)

List of DefectConcentrations objects (cm^-3)

carrier_concentrations(list)

List of tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

fermi_levels(list)

list of Fermi level values in eV.

Return type:

ThermoData

get_pO2_thermodata(reservoirs, temperature=None, name=None)[source]#

Calculate defect and carrier concentrations as a function of the oxygen partial pressure.

Parameters:
  • reservoirs (dict, Reservoirs or PressureReservoirs) – Object with partial pressure values as keys and chempots dictionary as values.

  • temperature (float) – Temperature in Kelvin. If None reservoirs.temperature is used.

  • name (str) – Name to assign to ThermoData.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

partial_pressures(list)

List of partial pressure values in atm.

defect_concentrations(list)

List of DefectConcentrations objects (cm^-3)

carrier_concentrations(list)

List of tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

fermi_levels(list)

list of Fermi level values in eV.

Return type:

ThermoData

get_single_point_quenched_thermodata(chemical_potentials, initial_temperature, final_temperature, quenched_species=None, quench_elements=False, fixed_concentrations=None, external_defects=None, name=None)[source]#

Compute carrier concentrations, defect concentrations and Fermi level for a single set of chemical potentials.

Parameters:
  • chemical_potentials (dict or Chempots) – Chempots object containing chemical potentials.

  • initial_temperature (float) – Initial temperature in K.

  • final_temperature (float) – Final temperature in K

  • quenched_species (list) – List of defect species to quench. If None all defect species are quenched.

  • quench_elements (bool) – If True the total concentrations of elements at high temperature go in the charge neutrality at low temperature. If False the quenched concentrations are the ones of single defect species (e.g. elements are not allowed to equilibrate on different sites).

  • fixed_concentrations (dict) – Dictionary with fixed concentrations. Keys are defect entry names in the standard format, values are the concentrations. (ex {‘Vac_Na’:1e20})

  • external_defects (list) – List of external defect concentrations (not present in defect entries). Must either be a list of dictionaries with {‘charge’: float, ‘conc’: float} or a list of SingleDefConc objects.

  • name (str) – Label for ThermoData.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

defect_concentrations(DefectConcentrations)

DefectConcentrations object (cm^-3).

carrier_concentrations(tuple)

Tuple with intrinsic carriers concentrations in cm^-3 (holes,electrons).

fermi_levels(float)

Fermi level value in eV.

Return type:

ThermoData

get_single_point_thermodata(chemical_potentials, temperature, fixed_concentrations=None, external_defects=None, name=None, eform_kwargs=None, dconc_kwargs=None)[source]#

Compute carrier concentrations, defect concentrations and Fermi level for a single set of chemical potentials.

Parameters:
  • chemical_potentials (dict or Chempots) – Chempots object containing chemical potentials.

  • temperature (int) – Temperature in K.

  • fixed_concentrations (dict) – Dictionary with fixed concentrations. Keys are defect entry names in the standard format, values are the concentrations. (ex {‘Vac_Na’:1e20})

  • external_defects (list) – List of external defect concentrations (not present in defect entries). Must either be a list of dictionaries with {‘charge’: float, ‘conc’: float} or a list of SingleDefConc objects.

  • name (str) – Label for ThermoData.

  • eform_kwargs (dict) – Kwargs to pass to entry.formation_energy.

  • dconc_kwargs (dict) – Kwargs to pass to entry.defect_concentration.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

defect_concentrations(DefectConcentrations)

DefectConcentrations object (cm^-3).

carrier_concentrations(tuple)

Tuple with intrinsic carriers concentrations in cm^-3 (holes,electrons).

fermi_levels(float)

Fermi level value in eV.

Return type:

ThermoData

get_variable_species_quenched_thermodata(variable_defect_specie, concentration_range, chemical_potentials, initial_temperature, final_temperature, quenched_species=None, quench_elements=False, external_defects=[], npoints=50, name=None)[source]#

Calculate defect and carrier concentrations as a function of the concentration of a particular defect species (usually a dopant) with quenched defects. It is possible to select which defect species to quench and which ones are free to equilibrate. Frozen defects in the inputs of the class are still considered.

Parameters:
  • variable_defect_specie (str or dict) –

    Variable species. Possible formats are:

    • str: name or element, if the variable defect species is in defect entries.

    • dict : {‘name’:str,’charge’:int or float} if the variable species is not in defect entries.

  • concentration_range (tuple or list) – Range of the concentration of the variable species in cm^-3.

  • chemical_potentials (dict or Chempots) – Chempots object containing chemical potentials.

  • initial_temperature (float) – Value of initial temperature in K.

  • final_temperature (float) – Value of final temperature in K.

  • quenched_species (list) – List of defect species to quench. If None all defect species are quenched.

  • quench_elements (bool) – If True the total concentrations of elements at high temperature go in the charge neutrality at low temperature. If False the quenched concentrations are the ones of single defect species (e.g. elements are not allowed to equilibrate on different sites).

  • external_defects (list) – List of external defect concentrations (not present in defect entries). Must either be a list of dictionaries with {‘charge’: float, ‘conc’: float} or a list of SingleDefConc objects.

  • npoints (int) – Number of points to divide concentration range.

  • name (str) – Name to assign to ThermoData.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

variable_defect_specie(str)

Name of variable defect species.

variable_concentrations(list)

List of concentrations of variable species.

defect_concentrations(list)

List of DefectConcentrations objects in the same format as the output of DefectsAnalysis.

carrier_concentrations(list)

List of tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

fermi_levels(list)

List of Fermi level values in eV.

Return type:

ThermoData

get_variable_species_thermodata(variable_defect_specie, concentration_range, chemical_potentials, temperature, external_defects=[], npoints=50, name=None)[source]#

Calculate defect and carrier concentrations as a function of the concentration of a particular defect species (usually a dopant).

Parameters:
  • variable_defect_specie (str or dict) –

    Variable species. Possible formats are:

    • str: name or element, if the variable defect species is in defect entries.

    • dict : {‘name’:str,’charge’:int or float} if the variable species is not in defect entries.

  • concentration_range (tuple or list) – Range of the concentration of the variable species in cm^-3.

  • chemical_potentials (dict or Chempots) – Chempots object containing chemical potentials.

  • temperature (float) – Temperature.

  • npoints (int) – Number of points to divide concentration range.

  • external_defects (list) – List of external defect concentrations (not present in defect entries). Must either be a list of dictionaries with {‘charge’: float, ‘conc’: float} or a list of SingleDefConc objects.

  • name (str) – Label for ThermoData.

Returns:

thermodata – ThermoData object that contains the thermodynamic data:

variable_defect_specie(str)

Name of variable defect species.

variable_concentrations(list)

List of concentrations of variable species.

defect_concentrations(list)

List of DefectConcentrations objects in the same format as the output of DefectsAnalysis.

carrier_concentrations(list)

List of tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

fermi_levels(list)

List of Fermi level values in eV.

Return type:

ThermoData

class ThermoData(thermodata, name=None)[source]#

Bases: MSONable

Class to handle defect thermodynamics data

Class that handles dict of defect thermodynamics data.

Parameters:
  • thermodata (dict) –

    Dict that contains the thermodynamic data, typically output from the methods in the DefectThermodynamics class. Keys of the dict are set as attributes of ThermoData.

    Possible items are:

    partial_pressures(list)

    partial pressure values.

    variable_defect_specie(str)

    Name of variable defect species.

    variable_concentrations(list)

    Concentrations of variable species.

    defect_concentrations(list)

    DefectConcentrations objects (cm^-3).

    carrier_concentrations(list)

    Tuples with intrinsic carriers concentrations (holes,electrons) in cm^-3.

    conductivities(list)

    Conductivity values (in S/m).

    fermi_levels(list)

    Fermi level values in eV.

    temperatures(list)

    Temperature values in K.

  • name (str) – Name to assign to ThermoData.

as_dict()[source]#
Returns:

Json-serializable dict representation of ThermoData

classmethod from_dict(d)[source]#

Reconstitute a ThermoData object from a dict representation created using as_dict().

Parameters:

d (dict) – Dictionary representation of ThermoData.

Return type:

ThermoData object.

static from_json(path_or_string)[source]#

Build ThermoData object from json file or string.

Parameters:

path_or_string (str) – If an existing path to a file is given the object is constructed reading the json file. Otherwise it will be read as a string.

Return type:

ThermoData object.

get_specific_pressures(p_values)[source]#

Get ThermoData object only for specific pressure values. The closest pressure value present in list is chosen for each provided value.

Parameters:

p_values (list) – List of partial pressure values.

Return type:

ThermoData object

items()[source]#
keys()[source]#
set_data(key, value)[source]#

Set data dictionary.

to_json(path=None)[source]#

Save ThermoData object as json string or file

Parameters:

path (str) – Path to the destination file. If None the name of ThermoData is used as filename.

Returns:

d – If path is not set a string is returned.

Return type:

str

values()[source]#