pymatgen.analysis.elasticity.elastic module¶

class ElasticTensor[source]

This class extends Tensor to describe the 3x3x3x3 second-order elastic tensor, C_{ijkl}, with various methods for estimating other properties derived from the second order elastic tensor

Create an ElasticTensor object. The constructor throws an error if the shape of the input_matrix argument is not 3x3x3x3, i. e. in true tensor notation. Issues a warning if the input_matrix argument does not satisfy standard symmetries. Note that the constructor uses __new__ rather than __init__ according to the standard method of subclassing numpy ndarrays.

Parameters: input_array (3x3x3x3 array-like) – the 3x3x3x3 array-like representing the elastic tensor tol (float) – tolerance for initial symmetry test of tensor
cahill_thermalcond(structure)[source]

Calculates Cahill’s thermal conductivity (in SI units)

Parameters: structure – pymatgen structure object

Returns: Cahill’s thermal conductivity (in SI units)

clarke_thermalcond(structure)[source]

Calculates Clarke’s thermal conductivity (in SI units)

Parameters: structure – pymatgen structure object

Returns: Clarke’s thermal conductivity (in SI units)

compliance_tensor

returns the Voigt-notation compliance tensor, which is the matrix inverse of the Voigt-notation elastic tensor

debye_temperature(structure)[source]

Calculates the debye temperature (in SI units)

Parameters: structure – pymatgen structure object

Returns: debye temperature (in SI units)

debye_temperature_gibbs(structure)[source]

Calculates the debye temperature accordings to the GIBBS formulation (in SI units)

Parameters: structure – pymatgen structure object

Returns: debye temperature (in SI units)

classmethod from_pseudoinverse(strains, stresses)[source]

Class method to fit an elastic tensor from stress/strain data. Method uses Moore-Penrose pseudoinverse to invert the s = C*e equation with elastic tensor, stress, and strain in voigt notation

Parameters: stresses (Nx3x3 array-like) – list or array of stresses strains (Nx3x3 array-like) – list or array of strains
classmethod from_stress_dict(stress_dict, tol=0.1, vasp=True, symmetry=False)[source]

Constructs the elastic tensor from IndependentStrain-Stress dictionary corresponding to legacy behavior of elasticity package.

Parameters: stress_dict (dict) – dictionary of stresses indexed by corresponding IndependentStrain objects. tol (float) – tolerance for zeroing small values of the tensor vasp (boolean) – flag for whether the stress tensor should be converted based on vasp units/convention for stress symmetry (boolean) – flag for whether or not the elastic tensor should fit from data based on symmetry
g_reuss

returns the G_r shear modulus

g_voigt

returns the G_v shear modulus

g_vrh

returns the G_vrh (Voigt-Reuss-Hill) average shear modulus

get_structure_property_dict(structure, include_base_props=True)[source]

returns a dictionary of properties derived from the elastic tensor and an associated structure

homogeneous_poisson

returns the homogeneous poisson ratio

k_reuss

returns the K_r bulk modulus

k_voigt

returns the K_v bulk modulus

k_vrh

returns the K_vrh (Voigt-Reuss-Hill) average bulk modulus

long_v(structure)[source]

Calculates longitudinal sound velocity (in SI units) using the Voigt-Reuss-Hill average bulk modulus

Parameters: structure – pymatgen structure object

Returns: longitudinal sound velocity (in SI units)

property_dict

returns a dictionary of properties derived from the elastic tensor

snyder_ac(structure)[source]

Calculates Snyder’s acoustic sound velocity (in SI units)

Parameters: structure – pymatgen structure object

Returns: Snyder’s acoustic sound velocity (in SI units)

snyder_opt(structure)[source]

Calculates Snyder’s optical sound velocity (in SI units)

Parameters: structure – pymatgen structure object

Returns: Snyder’s optical sound velocity (in SI units)

snyder_total(structure)[source]

Calculates Snyder’s total sound velocity (in SI units)

Parameters: structure – pymatgen structure object

Returns: Snyder’s total sound velocity (in SI units)

trans_v(structure)[source]

Calculates transverse sound velocity (in SI units) using the Voigt-Reuss-Hill average bulk modulus

Parameters: structure – pymatgen structure object

Returns: transverse sound velocity (in SI units)

universal_anisotropy

returns the universal anisotropy value

y_mod

Calculates Young’s modulus (in SI units) using the Voigt-Reuss-Hill averages of bulk and shear moduli

class ElasticTensorExpansion(c_list)[source]

This class is a sequence of elastic tensors corresponding to an elastic tensor expansion, which can be used to calculate stress and energy density and inherits all of the list-based properties of TensorCollection (e. g. symmetrization, voigt conversion, etc.)

Initialization method for ElasticTensorExpansion

Parameters: c_list (list or tuple) – sequence of Tensor inputs or tensors from which the elastic tensor expansion is constructed.
calculate_stress(strain)[source]

Calculate’s a given elastic tensor’s contribution to the stress using Einstein summation

energy_density(strain, convert_GPa_to_eV=True)[source]

Calculates the elastic energy density due to a strain

classmethod from_diff_fit(strains, stresses, eq_stress=None, tol=1e-10, order=3)[source]

Generates an elastic tensor expansion via the fitting function defined below in diff_fit

order

Order of the elastic tensor expansion, i. e. the order of the highest included set of elastic constants

class NthOrderElasticTensor[source]

An object representing an nth-order tensor expansion of the stress-strain constitutive equations

calculate_stress(strain)[source]

Calculate’s a given elastic tensor’s contribution to the stress using Einstein summation

Parameters: strain (3x3 array-like) – matrix corresponding to strain
energy_density(strain, convert_GPa_to_eV=True)[source]

Calculates the elastic energy density due to a strain

classmethod from_diff_fit(strains, stresses, eq_stress=None, order=2, tol=1e-10)[source]
order

Order of the elastic tensor

diff_fit(strains, stresses, eq_stress=None, order=2, tol=1e-10)[source]

nth order elastic constant fitting function based on central-difference derivatives with respect to distinct strain states. The algorithm is summarized as follows:

1. Identify distinct strain states as sets of indices for which nonzero strain values exist, typically [(0), (1), (2), (3), (4), (5), (0, 1) etc.]
2. For each strain state, find and sort strains and stresses by strain value.
3. Find first, second .. nth derivatives of each stress with respect to scalar variable corresponding to the smallest perturbation in the strain.
4. Use the pseudoinverse of a matrix-vector expression corresponding to the parameterized stress-strain relationship and multiply that matrix by the respective calculated first or second derivatives from the previous step.
5. Place the calculated nth-order elastic constants appropriately.
Parameters: order (int) – order of the elastic tensor set to return strains (nx3x3 array-like) – Array of 3x3 strains to use in fitting of ECs stresses (nx3x3 array-like) – Array of 3x3 stresses to use in fitting ECs. These should be PK2 stresses. eq_stress (3x3 array-like) – stress corresponding to equilibrium strain (i. e. “0” strain state). If not specified, function will try to find the state in the list of provided stresses and strains. If not found, defaults to 0. zero_crit (float) – value for which strains below are ignored in identifying strain states. Set of tensors corresponding to nth order expansion of the stress/strain relation
find_eq_stress(strains, stresses, tol=1e-10)[source]

Finds stress corresponding to zero strain state in stress-strain list

Parameters: strains (Nx3x3 array-like) – array corresponding to strains stresses (Nx3x3 array-like) – array corresponding to stresses tol (float) – tolerance to find zero strain state
generate_pseudo(strain_states, order=3)[source]

Generates the pseudoinverse for a given set of strains.

Parameters: strain_states (6xN array like) – a list of voigt-notation “strain-states”, i. e. perturbed indices of the strain as a function of the smallest strain e. g. (0, 1, 0, 0, 1, 0) order (int) – order of pseudoinverse to calculate pseudo inverses for each order tensor, these can be multiplied by the central difference derivative of the stress with respect to the strain state absent_syms: symbols of the tensor absent from the PI expression mis
get_diff_coeff(hvec, n=1)[source]

Helper function to find difference coefficients of an derivative on an arbitrary mesh.

Parameters: hvec (1D array-like) – sampling stencil n (int) – degree of derivative to find
get_strain_state_dict(strains, stresses, eq_stress=None, tol=1e-10, add_eq=True, sort=True)[source]

Creates a dictionary of voigt-notation stress-strain sets keyed by “strain state”, i. e. a tuple corresponding to the non-zero entries in ratios to the lowest nonzero value, e.g. [0, 0.1, 0, 0.2, 0, 0] -> (0,1,0,2,0,0) This allows strains to be collected in stencils as to evaluate parameterized finite difference derivatives

Parameters: strains (Nx3x3 array-like) – strain matrices stresses (Nx3x3 array-like) – stress matrices eq_stress (Nx3x3 array-like) – equilibrium stress tol (float) – tolerance for sorting strain states add_eq (bool) – flag for whether to add eq_strain to stress-strain sets for each strain state sort (bool) – flag for whether to sort strain states OrderedDict with strain state keys and dictionaries with stress-strain data corresponding to strain state
get_symbol_list(rank, dim=6)[source]

Returns a symbolic representation of the voigt-notation tensor that places identical symbols for entries related by index transposition, i. e. C_1121 = C_1211 etc.

Parameters: dim (int) – dimension of matrix/tensor, e. g. 6 for voigt notation and 3 for standard rank (int) – rank of tensor, e. g. 3 for third-order ECs array representing distinct indices c_arr (array): array representing tensor with equivalent indices assigned as above c_vec (array)
subs(entry, cmap)[source]

Sympy substitution function, primarily for the purposes of numpy vectorization

Parameters: entry (symbol or exp) – sympy expr to undergo subs cmap (dict) – map for symbols to values to use in subs Evaluated expression with substitution