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.mlp.phonons import phonon_flow
# Make an Atoms object of a bulk Cu structure
atoms = bulk("Cu")
# Run a phonon (hessian) calculation with our favorite MLP potential
result = phonon_flow(
atoms,
method="fairchem",
job_params={
"all": dict(
name_or_path="uma-s-1p2",
task_name="omat",
),
},
min_lengths=10.0, # set the minimum unit cell size smaller to be compatible with limited github runner ram
)/tmp/ipykernel_9692/3575986036.py:4: DeprecationWarning: quacc.recipes.mlp is deprecated. Use quacc.recipes.mlip instead.
from quacc.recipes.mlp.phonons import phonon_flow
/tmp/ipykernel_9692/3575986036.py:4: DeprecationWarning: quacc.recipes.mlp.phonons is deprecated. Use quacc.recipes.mlip.phonons instead.
from quacc.recipes.mlp.phonons import phonon_flow
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 10
6 # Make an Atoms object of a bulk Cu structure
7 atoms = bulk("Cu")
8
9 # Run a phonon (hessian) calculation with our favorite MLP potential
---> 10 result = phonon_flow(
11 atoms,
12 method="fairchem",
13 job_params={
File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:148, in tracked.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
146 @wraps(func)
147 def wrapper(*args, **kwargs):
--> 148 return _tracked_call(func, node_type, args, kwargs)
File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:169, in _tracked_call(func, node_type, args, kwargs)
166 # When NESTED_RESULTS is off, skip all context tracking and just
167 # delegate to the original function directly.
168 if not settings.NESTED_RESULTS:
--> 169 return func(*args, **kwargs)
171 # Create a unique name we can use at this level.
172 name = make_unique_name(prefix=f"{func.__name__}-")
File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/monty/dev.py:176, in requires.__call__.<locals>.decorated(*args, **kwargs)
174 if not self.condition:
175 raise self.err_cls(self.message)
--> 176 return _callable(*args, **kwargs)
File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/monty/dev.py:176, in requires.__call__.<locals>.decorated(*args, **kwargs)
174 if not self.condition:
175 raise self.err_cls(self.message)
--> 176 return _callable(*args, **kwargs)
TypeError: phonon_flow() got an unexpected keyword argument 'method'print(
f'The entropy at { result["results"]["thermal_properties"]["temperatures"][-1]:.0f} K is { result["results"]["thermal_properties"]["entropy"][-1]:.2f} 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'