Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Phonon Calculations

Phonon calculations are very important for inorganic materials science to

  1. Runs a relaxation on the unit cell and atoms

  2. Repeats the unit cell a number of times to make it sufficiently large to capture many interesting vibrational models

  3. Generatives a number of finite displacement structures by moving each atom of the unit cell a little bit in each direction

  4. Running single point calculations on each of (3)

  5. Gathering all of the calculations and calculating second derivatives (the hessian matrix!)

  6. Calculating the eigenvalues/eigenvectors of the hessian matrix to find the vibrational modes of the material

  7. 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!