Phono3py: Anharmonic Lattice Dynamics

3.30.1 · active · verified Sun Apr 12

Phono3py is a Python package for calculating anharmonic lattice dynamics properties, such as lattice thermal conductivity and phonon lifetimes, using a supercell approach and third-order force constants. It is commonly used in conjunction with first-principles calculation codes (e.g., VASP, Quantum ESPRESSO) that provide the necessary force information. The current version is 3.30.1. It maintains an active development and release cadence, often in sync with its harmonic counterpart, Phonopy.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the core `Phono3py` object. It sets up a dummy silicon unit cell and supercell, then creates a `Phonopy` object, which is passed to `Phono3py`. This is the fundamental first step before loading force constants and running calculations.

import numpy as np
from phonopy import Phonopy
from phonopy.structure.atoms import PhonopyAtoms
from phono3py import Phono3py

# Define a simple silicon unit cell (diamond structure) for demonstration
a = 5.43  # Lattice parameter for Si

# Unit cell basis vectors (face-centered cubic)
lattice = np.array([
    [a/2, a/2, 0],
    [a/2, 0, a/2],
    [0, a/2, a/2]
])

# Atoms in the unit cell (fractional coordinates)
positions = np.array([
    [0, 0, 0],
    [0.25, 0.25, 0.25]
])
symbols = ['Si', 'Si']

# Create a PhonopyAtoms object for the unit cell
unit_cell = PhonopyAtoms(cell=lattice, scaled_positions=positions, symbols=symbols)

# Define supercell matrix (e.g., 2x2x2 supercell)
supercell_matrix = np.diag([2, 2, 2])

# Initialize Phonopy object (a prerequisite for Phono3py)
phonon = Phonopy(unit_cell, supercell_matrix)

# Define a primitive matrix if different from the unit cell. 
# For FCC structures, a typical primitive cell matrix is:
primitive_matrix = np.array([
    [0, 0.5, 0.5],
    [0.5, 0, 0.5],
    [0.5, 0.5, 0]
])

# Initialize Phono3py object with the Phonopy object and supercell matrix
ph3 = Phono3py(phonon, supercell_matrix, primitive_matrix=primitive_matrix)

print("Phono3py object initialized successfully.")
print(f"Number of atoms in primitive cell: {ph3.primitive.numbers.shape[0]}")
print(f"Number of atoms in supercell: {ph3.supercell.numbers.shape[0]}")

view raw JSON →