matcalc._elasticity module

Calculator for elastic properties.

class ElasticityCalc(calculator: Calculator | str, *, norm_strains: Sequence[float] | float = (-0.01, -0.005, 0.005, 0.01), shear_strains: Sequence[float] | float = (-0.06, -0.03, 0.03, 0.06), fmax: float = 0.1, symmetry: bool = False, relax_structure: bool = True, relax_deformed_structures: bool = False, use_equilibrium: bool = True, units_GPa: bool = False, relax_calc_kwargs: dict | None = None)[source]

Bases: PropCalc

Elastic tensor and related moduli via strain-stress fitting with pymatgen.

calculator[source]

ASE calculator (or universal model name).

norm_strains[source]

Normal strains applied in DeformedStructureSet.

shear_strains[source]

Shear strains applied in DeformedStructureSet.

fmax[source]

Force tolerance for optional relaxations.

symmetry[source]

Whether to reduce deformations by symmetry.

relax_structure[source]

Relax initial structure before deforming.

relax_deformed_structures[source]

Relax each deformed structure before stress.

use_equilibrium[source]

Include equilibrium stress in the fit when applicable.

units_GPa[source]

If True, report moduli in GPa instead of pymatgen’s native eV/A^3.

relax_calc_kwargs[source]

Optional kwargs for RelaxCalc.

Parameters:
  • calculator – ASE calculator or universal model name string.

  • norm_strains – Normal strains (non-empty, no zeros); scalar broadcast to one value.

  • shear_strains – Shear strains (non-empty, no zeros); scalar allowed.

  • fmax – Force tolerance for relaxations.

  • symmetry – Pass-through to pymatgen DeformedStructureSet.

  • relax_structure – Relax parent structure before generating deformations.

  • relax_deformed_structures – Relax each deformed structure before stress eval.

  • use_equilibrium – Use equilibrium stress in fit; forced True if only one strain type.

  • units_GPa – If True, return moduli (and elastic tensor / residuals) in GPa. Defaults to False, in which case values are returned in pymatgen’s native units of eV/A^3.

  • relax_calc_kwargs – Optional kwargs for RelaxCalc.

_abc_impl = <_abc._abc_data object>[source]
_elastic_tensor_from_strains(strains: ArrayLike, stresses: ArrayLike, eq_stress: ArrayLike = None, tol: float = 1e-07) tuple[ElasticTensor, float][source]

Fit elastic constants from strain-stress pairs (Voigt), optionally subtracting equilibrium stress.

Parameters:
  • strains – Strain states (array-like) for each deformation.

  • stresses – Matching stress tensors (array-like).

  • eq_stress – Equilibrium stress to subtract; None to omit.

  • tol – Small components below this are zeroed on the fitted tensor.

Returns:

Tuple of (ElasticTensor, residuals_sum).

calc(structure: Structure | Atoms | dict[str, Any]) dict[str, Any][source]
Parameters:

structure – Pymatgen structure, ASE atoms, or dict with structure keys.

Returns:

Dict including elastic_tensor, shear_modulus_vrh, bulk_modulus_vrh, youngs_modulus, residuals_sum, structure, and merged relaxation fields. elastic_tensor, shear_modulus_vrh, bulk_modulus_vrh and residuals_sum are returned in GPa if units_GPa=True, otherwise in eV/A^3 (pymatgen’s native units). youngs_modulus is always reported in pymatgen’s default units (see pymatgen ElasticTensor docs).