How to Visualize Phonons¶

by Stefan Kontur for exciting sodium

(Jupyter notebook by Mara Voiculescu & Martin Kuban)


Purpose: This tutorial shows you how to visualize the phonon modes found in an earlier phonon calculation. As in other tutorials, we consider the diamond crystal as example.



0. Before Starting¶

Read the following paragraphs before starting with the rest of this tutorial!

Before running any Jupyter tutorials, please refer to the 00_before_starting.md document on how to correctly set up the environment. This only needs to be done once. After which, the venv can be (re)activated from exciting's root directory:

source $EXCITINGROOT/tools/excitingjupyter/venv/excitingvenv/bin/activate

Continue in the working directory where you did the phonon calculation, e.g. the directory run_diamond_phonons from the tutorial Lattice dynamics of diamond and zincblende-structure crystals. In particluar you need to have the files input.xml and PHONON.OUT ready. The script will also read the relevant species files, C.xml in our example for diamond, in the path specified by $EXCITINGROOT/species.


1. Produce Coordinate Files of the Animated Phonon Modes¶

In order to create coordinate files for a given phonon, you should invoke the script excitingscripts.plot.phonon_anim. This script will read phonon eigenvectors for all q-points contained in the file PHONON.OUT and plot a supercell of (default) 6×6×6 unit cells to visualize them. Unit cells are taken as specified in input.xml and the dimensions are along lattice vectors.

In [1]:
%%bash
cd run_diamond_phonons
python3 -m excitingscripts.plot.phonon_anim
cd ..

If you want to change the supercell size, e.g., type

python3 -m excitingscripts.plot.phonon_anim -s 4 4 1

to obtain a supercell of 4×4×1 unit cells.


$\Rightarrow$ Further options for excitingscripts.plot.phonon_anim

The option -n specifies the number of steps in the animation which complete one period of the vibration (default: 20), whereas the option -c can be used to change the scaling factor (default: 10.0)


The script produces a number of files, named, e.g., q1_mode1.axsf and q1_mode1.xyz. One file is written for each mode at each q-point. These files contain atomic coordinates for the supercell at every step of the animation. The files with extension axsf are animated XCrySDen structure files, the files with extension xyz are simple xyz-coordinate files.

The next subsection deals with visualizing these files. To exemplify, we show this using VMD. You might have other/additional choices, according to the actual software installed in your environment.


2. Visualize Coordinate Files¶

2.1. Using VMD¶

Before performing the visualization, one can get more information about the number of atoms, number of q-points, and the frequency (in cm-1) for each mode at each q-point by running the script excitingscripts.convert.au2invcm. For more details, see the tutorial Lattice Dynamics of Diamond and Zincblende-Structure Crystals.

Considering an example for diamond with the following mode frequencies:

Total number of atoms    :     2
Total number of q-points    :     3

q-point   1  is  [0.0, 0.0, 0.0]
   mode   1      frequency:    -0.0000  cm-1
   mode   2      frequency:    -0.0000  cm-1
   mode   3      frequency:    -0.0000  cm-1
   mode   4      frequency:  1580.5233  cm-1
   mode   5      frequency:  1580.5233  cm-1
   mode   6      frequency:  1580.5233  cm-1

q-point   2  is  [0.5, 0.5, 0.0]
   mode   1      frequency   523.8800  cm-1
   mode   2      frequency   523.8800  cm-1
   mode   3      frequency  1096.3667  cm-1
   mode   4      frequency  1096.3667  cm-1
   mode   5      frequency  1128.0147  cm-1
   mode   6      frequency  1128.0147  cm-1

q-point   3  is  [0.5, 0.5, 0.5]
   mode   1      frequency   459.4412  cm-1
   mode   2      frequency   459.4412  cm-1
   mode   3      frequency   869.1994  cm-1
   mode   4      frequency  1238.7323  cm-1
   mode   5      frequency  1400.8203  cm-1
   mode   6      frequency  1400.8203  cm-1


We make use of VMD, and assume that you have an installed and properly set up version available on you system.

After starting the program by typing

 vmd >/dev/null 2>&1 &

Now, use the buttons File -> New Molecule to open a dialog to open files. Use Browse to choose a file in your working directory, e.g., q1_mode4.xyz, the file type should be determined automatically, and Load to yield the following windows:

No description has been provided for this image
No description has been provided for this image

Use the Graphics -> Representations button to change the appearance of atoms and bonds. In the example below the choice for Drawing Method was CPK. Colors of atoms and the background can be changed via Graphics -> Colors. You might also want to change to a non-perspective display or omit the axes in the image, using the Display menu. The animation of the phonon mode can be started and stopped using the "play" (right-pointing black triangle) button in the bottom-right corner of the VMD Main window.

Our phonon mode, the 4th one at the Γ point, would look then like the following:

No description has been provided for this image

As another example, let us have a look at the first acoustic mode at q = (0.1, 0.1, 0), on the line Δ (i.e., Γ-X). You have to rerun the phonon calculation with this q-point added to the list as discussed in Section 2.1 of Lattice dynamics of diamond and zincblende-structure crystals, and invoke the script excitingscripts.plot.phonon_anim once more, to obtain the appropriate .xyz file.

No description has been provided for this image

For a detailed description of all features of VMD and tutorials, including the creation of movies, we refer to the VMD website.