Let’s do something more interesting that normally takes quite a bit of work in DFT: calculating an elastic constant! Elastic properties are important to understand how strong or easy to deform a material is, or how a material might change if compressed or expanded in specific directions (i.e. the Poisson ratio!).
We don’t have to change much code from above, we just use a built-in recipe to calculate the elastic tensor from quacc. This recipe
(optionally) Relaxes the unit cell using the MLIP
Generates a number of deformed unit cells by applying strains
For each deformation, a relaxation using the MLIP and (optionally) a single point calculation is run
Finally, all of the above calculations are used to calculate the elastic properties of the material
For more documentation, see the quacc docs for quacc
Need to install fairchem-core or get UMA access or getting permissions/401 errors?
Install the necessary packages using pip, uv etc
! pip install fairchem-core fairchem-data-oc fairchem-applications-cattsunamiGet access to any necessary huggingface gated models
Get and login to your Huggingface account
Request access to https://
huggingface .co /facebook /UMA Create a Huggingface token at https://
huggingface .co /settings /tokens/ with the permission “Permissions: Read access to contents of all public gated repos you can access” Add the token as an environment variable using
huggingface-cli loginor by setting the HF_TOKEN environment variable.
# Login using the huggingface-cli utility
! huggingface-cli login
# alternatively,
import os
os.environ['HF_TOKEN'] = 'MY_TOKEN'from __future__ import annotations
from ase.build import bulk
from quacc.recipes.mlp.elastic import elastic_tensor_flow
# Make an Atoms object of a bulk Cu structure
atoms = bulk("Cu")
# Run an elastic property calculation with our favorite MLP potential
result = elastic_tensor_flow(
atoms,
job_params={
"all": dict(
method="fairchem",
name_or_path="uma-s-1p2",
task_name="omat",
),
},
)Warp DeprecationWarning: The symbol `warp.vec` will soon be removed from the public API. Use `warp.types.vector` instead.
INFO:httpx:HTTP Request: HEAD https://huggingface.co/facebook/UMA/resolve/main/checkpoints/uma-s-1p2.pt "HTTP/1.1 302 Found"
INFO:httpx:HTTP Request: HEAD https://huggingface.co/facebook/UMA/resolve/main/references/iso_atom_elem_refs.yaml "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: HEAD https://huggingface.co/facebook/UMA/resolve/main/references/form_elem_refs.yaml "HTTP/1.1 200 OK"
WARNING:root:device was not explicitly set, using device='cuda'.
INFO:root:Adding 5 untrained task(s): ['oc20_stress', 'oc22_stress', 'odac_stress', 'oc25_stress', 'omol_stress']
WARNING:root:The 'seed' argument is deprecated and will be removed in future versions. Please set the seed in the MLIPPredictUnit configuration instead.
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-07-794508-59941
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-07-794508-59941 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-07-794508-59941
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-07-794508-59941
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-388465-53545
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-388465-53545 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-388465-53545
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-388465-53545
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-662406-40240
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-662406-40240 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-662406-40240
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-662406-40240
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-960556-31762
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-09-960556-31762 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-960556-31762
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-09-960556-31762
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-255135-60545
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-255135-60545 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-255135-60545
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-255135-60545
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-538419-85751
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-538419-85751 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-538419-85751
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-538419-85751
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-822758-47153
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-10-822758-47153 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-822758-47153
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-10-822758-47153
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-187773-82490
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-187773-82490 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-187773-82490
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-187773-82490
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-490692-46278
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-490692-46278 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-490692-46278
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-490692-46278
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-796308-60271
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-11-796308-60271 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-796308-60271
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-11-796308-60271
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-099581-85553
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-099581-85553 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-099581-85553
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-099581-85553
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-417838-11222
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-417838-11222 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-417838-11222
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-417838-11222
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-746244-42646
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-746244-42646 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-746244-42646
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-746244-42646
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-929099-96714
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-12-929099-96714 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-929099-96714
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-12-929099-96714
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-083869-12403
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-083869-12403 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-083869-12403
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-083869-12403
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-344704-67592
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-344704-67592 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-344704-67592
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-344704-67592
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-614968-30322
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-614968-30322 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-614968-30322
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-614968-30322
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-909125-29639
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-13-909125-29639 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-909125-29639
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-13-909125-29639
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-178652-51796
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-178652-51796 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-178652-51796
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-178652-51796
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-401505-31955
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-401505-31955 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-401505-31955
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-401505-31955
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-631877-43752
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-631877-43752 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-631877-43752
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-631877-43752
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-877007-95806
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-14-877007-95806 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-877007-95806
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-14-877007-95806
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-031218-91366
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-031218-91366 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-031218-91366
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-031218-91366
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-204799-86518
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-204799-86518 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-204799-86518
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-204799-86518
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-440002-17798
INFO:quacc.runners.prep:Moving /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-04-06-19-13-15-440002-17798 contents to /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-440002-17798
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-04-06-19-13-15-440002-17798
result["elasticity_doc"].bulk_modulusBulkModulus(voigt=148.658, reuss=148.658, vrh=148.658)Congratulations, you ran your first elastic tensor calculation!