Phonopy is an open-source Python package designed for calculating phonon properties at harmonic and quasi-harmonic levels. It integrates with various first-principles density functional theory (DFT) codes, such as VASP, Quantum ESPRESSO, and ABINIT, to compute interatomic forces. Using the finite displacement method and crystal symmetry, Phonopy can derive phonon band structures, densities of states (DOS), thermal properties (free energy, heat capacity, entropy), group velocities, and more. The library is actively maintained and regularly updated, with version 3.5.0 being the current release.
pip install phonopyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `Phonopy` object with a unit cell and supercell matrix, and generate the necessary atomic displacements for subsequent DFT force calculations. The example uses a Silicon diamond structure, a common test case in phonon calculations. After generating displacements, the `supercells_with_displacements` can be used to create input files for an external DFT code. Once the forces are computed, they would be fed back into Phonopy for full phonon property analysis.
Review your `Phonopy` object initialization. Remove the deprecated parameters from the constructor call. Adjust your workflow to use newer API methods if the functionality is still required (e.g., directly handle unit conversions or decimals in post-processing).
For unit conversions, utilize `phonopy.physical_units.get_physical_units()` which returns a `PhysicalUnits` dataclass. For calculator-specific units, use `phonopy.interface.calculator.get_calculator_physical_units()`. Explicitly handle conversion factors rather than relying on the deprecated `factor` parameter in `Phonopy` initialization. Note that `Kb_j` and `Kb` were renamed to `KB_J` and `KB`, and `VaspToTHz` to `DefaultToTHz`.
Ensure `symfc` is installed (`pip install symfc` or `conda install -c conda-forge symfc`). If you prefer the traditional force constant calculation method when using `phonopy-load`, use the `--fc-calculator traditional` option.
Verify that your `PATH` and `PYTHONPATH` variables correctly point to your desired `phonopy` installation. When using `conda` environments, always activate the correct environment (`conda activate your_env_name`) which typically handles these paths automatically. If installing from source or with `pip` into user site-packages, ensure `~/.local/bin` and `~/.local/lib/pythonX.Y/site-packages` are in your `PATH` and `PYTHONPATH` respectively.
In configuration files like `band.conf`, try setting `PRIMITIVE_AXES = AUTO`. When using the Python API, ensure the `primitive_matrix` argument to the `Phonopy` constructor is correctly defined for your system, or experiment with omitting it if the structure is simple enough for automatic detection.
Increase the k-point sampling density for your DFT calculations. Ensure that your force convergence criteria are very strict (e.g., EDIFFG in VASP). Validate your DFT parameters for accuracy before running phonon calculations.
Install phonopy using pip: `pip install phonopy` or via conda: `conda install -c conda-forge phonopy`.
Ensure all DFT (VASP, Quantum ESPRESSO, etc.) calculations for the displaced supercells have successfully completed and their output forces are correctly compiled into the `FORCE_SETS` file. Verify that the supercell dimensions and primitive cell settings used in phonopy are consistent with the DFT calculations.
Correctly define the primitive cell using `PRIMITIVE_AXES = AUTO` (if applicable) or by providing the explicit primitive matrix. Ensure the supercell dimensions (`DIM`) are consistent with the structure you are using.
Check if all individual displacement calculations have completed successfully and generated their output files. Ensure the file paths provided to `phonopy -f` (or similar command) correctly point to all expected force output files, and that `phonopy_disp.yaml` reflects the actual displacements.