Skip to main content

Overview

The Elasticity task computes the elastic tensor of a crystal by:
  1. Performing a full cell relaxation with the OPT task.
  2. Generating a set of deformed structures via pymatgen.analysis.elasticity.DeformedStructureSet using the specified normal and shear strains.
  3. Evaluating the stress tensor of each deformed structure with the supplied calculator.
  4. Fitting the elastic constants (C_ij) by linear regression of stress vs. strain.
The task is registered in Prefect as Elasticity with a TASK_SOURCE + INPUTS cache policy.

Function signature

Parameters

ase.Atoms
required
Input crystal structure. A copy is made internally.
ase.calculators.calculator.BaseCalculator
required
ASE-compatible calculator for stress and force evaluations.
Optimizer | str
default:"BFGSLineSearch"
Optimizer used for the initial relaxation. See OPT for accepted string values.
dict | None
default:"None"
Extra keyword arguments forwarded to the optimizer constructor.
Filter | str | None
default:"FrechetCell"
Filter applied during the initial relaxation to allow cell optimization. See OPT for accepted string values.
dict | None
default:"None"
Extra keyword arguments forwarded to the filter constructor.
dict | None
default:"None"
Convergence criteria passed to optimizer.run(). See OPT for details.
list[number] | np.ndarray | None
default:"np.linspace(-0.01, 0.01, 4)"
Normal strain values applied to generate deformed structures. Defaults to four values uniformly spaced from −0.01 to +0.01 (i.e., ±1%).
list[number] | np.ndarray | None
default:"np.linspace(-0.06, 0.06, 4)"
Shear strain values applied to generate deformed structures. Defaults to four values uniformly spaced from −0.06 to +0.06 (i.e., ±6%).
boolean
default:"true"
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.
boolean
default:"false"
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

pymatgen.analysis.elasticity.ElasticTensor
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:
number
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.

Example