Phonon calculations are very important for inorganic materials science to
Calculate thermal conductivity
Understand the vibrational modes, and thus entropy and free energy, of a material
Predict the stability of a material at finite temperature (e.g. 300 K) among many others! We can run a similarly straightforward calculation that
Runs a relaxation on the unit cell and atoms
Repeats the unit cell a number of times to make it sufficiently large to capture many interesting vibrational models
Generatives a number of finite displacement structures by moving each atom of the unit cell a little bit in each direction
Running single point calculations on each of (3)
Gathering all of the calculations and calculating second derivatives (the hessian matrix!)
Calculating the eigenvalues/eigenvectors of the hessian matrix to find the vibrational modes of the material
Analyzing the thermodynamic properties of the vibrational modes.
Note that this analysis assumes that all vibrational modes are harmonic, which is a pretty reasonable approximately for low/moderate temperature materials, but becomes less realistic at high temperatures.
from __future__ import annotations
from ase.build import bulk
from quacc.recipes.mlip.core import relax_job
from quacc.recipes.mlip.phonons import phonon_flow
# Make an Atoms object of a bulk Cu structure
atoms = bulk("Cu")
# Relax the structure before calculating phonons.
model_params = dict(
library="fairchem",
name_or_path="uma-s-1p2p1",
task_name="omat",
)
atoms = relax_job(
atoms,
**model_params,
relax_cell=True,
opt_params={"fmax": 1e-3},
)["atoms"]
# Run a phonon (hessian) calculation with our favorite MLP potential
result = phonon_flow(
atoms,
job_params={"all": model_params},
min_lengths=10.0, # set the minimum unit cell size smaller to be compatible with limited github runner ram
)INFO:httpx2:HTTP Request: HEAD https://huggingface.co/facebook/UMA/resolve/main/checkpoints/uma-s-1p2p1.pt "HTTP/1.1 302 Found"
INFO:httpx2:HTTP Request: HEAD https://huggingface.co/facebook/UMA/resolve/main/references/iso_atom_elem_refs.yaml "HTTP/1.1 200 OK"
INFO:httpx2: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'.
WARNING:root:UMA Nitro cannot serve this request: nitro mode supports only CUDA compute capability 8.x-12.x, not 7.5.
WARNING:root:Now running with nitro=False, execution_mode='umas_fast_gpu' (TF32).
INFO:root:Adding 5 untrained task(s): ['oc25_stress', 'oc22_stress', 'omol_stress', 'oc20_stress', 'odac_stress']
WARNING:root:Running in a reduced-precision mode: some values, such as higher-order derivatives and phonon calculations, will be less accurate. For standard FP32 precision, use inference_settings='high-precision'.
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:Run directory = /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-11-17-18-31-57-556135-59941
WARNING:root:Model is being compiled. This might take a while the first time.
WARNING:root:Running (unknown commit) with inference settings: multigpu
W1117 18:32:00.728000 13507 site-packages/torch/_logging/_internal.py:1345] [0/0] Profiler record function <class 'torch.autograd.profiler.record_function'> will be ignored
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-11-17-18-31-57-556135-59941
INFO:quacc.runners.prep:Run directory = /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-11-17-18-32-33-942797-53545
W1117 18:33:11.161000 13507 site-packages/torch/_inductor/utils.py:1953] [6/1] Not enough SMs to use max_autotune_gemm mode
/home/runner/work/_tool/Python/3.12.16/x64/lib/python3.12/site-packages/torch/_inductor/lowering.py:2352: FutureWarning: `torch._prims_common.check` is deprecated and will be removed in the future. Please use `torch._check*` functions instead.
check(
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-11-17-18-32-33-942797-53545
INFO:quacc.runners.prep:Run directory = /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2026-11-17-18-34-19-140440-40240
/home/runner/work/_tool/Python/3.12.16/x64/lib/python3.12/site-packages/quacc/runners/phonons.py:81: GammaAcousticWarning: 3 acoustic mode(s) at Gamma, at 1.696e-03, 1.696e-03, 1.696e-03 THz, entered the thermal-property sums. Their frequencies are nearly zero, and they add -2.201e-05 eV per unit cell to the free energy at 1000 K. Set exclude_gamma_acoustic=True (EXCLUDE_GAMMA_ACOUSTIC = .TRUE., --exclude-gamma-acoustic) to exclude them.
phonon.run_thermal_properties(t_step=t_step, t_max=t_max, t_min=t_min)
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2026-11-17-18-34-19-140440-40240
print(
f'The entropy at { result["results"]["thermal_properties"]["temperatures"][-1]:.0f} K is { result["results"]["thermal_properties"]["entropy"][-1]:.2f} kJ/mol'
)The entropy at 1000 K is 62.22 kJ/mol
Congratulations, you ran your first phonon calculation!
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'