Overview
TheElasticity task computes the elastic tensor of a crystal by:
- Performing a full cell relaxation with the OPT task.
- Generating a set of deformed structures via
pymatgen.analysis.elasticity.DeformedStructureSetusing the specified normal and shear strains. - Evaluating the stress tensor of each deformed structure with the supplied calculator.
- Fitting the elastic constants (
C_ij) by linear regression of stress vs. strain.
Elasticity with a TASK_SOURCE + INPUTS cache policy.
Function signature
Parameters
Input crystal structure. A copy is made internally.
ASE-compatible calculator for stress and force evaluations.
Optimizer used for the initial relaxation. See OPT for accepted string values.
Extra keyword arguments forwarded to the optimizer constructor.
Filter applied during the initial relaxation to allow cell optimization. See OPT for accepted string values.
Extra keyword arguments forwarded to the filter constructor.
Convergence criteria passed to
optimizer.run(). See OPT for details.Normal strain values applied to generate deformed structures. Defaults to four values uniformly spaced from −0.01 to +0.01 (i.e., ±1%).
Shear strain values applied to generate deformed structures. Defaults to four values uniformly spaced from −0.06 to +0.06 (i.e., ±6%).
When
True, the result of the initial OPT sub-task is persisted (saved to Prefect result storage). Useful for inspecting the relaxed structure independently of the elasticity result.When
True, the initial OPT sub-task uses caching so that identical relaxations are not recomputed across calls. When False, the cache is refreshed every time.Return value
The fitted elastic tensor (Voigt notation, 6×6) with near-zero components zeroed out at a tolerance of
1e-7. The ElasticTensor object provides properties including:Sum of least-squares fit residuals across all
C_ij linear regressions. A lower value indicates a better-quality fit and a more linearly elastic material response in the applied strain range.If the initial relaxation fails, the function returns a Prefect
State object instead of a dict. Check isinstance(result, dict) before accessing keys.