by Stefan Kontur for exciting boron
Purpose: This tutorial shows you how to visualize the phonon modes found in an earlier phonon calculation, using a basic python script. As in other tutorials, we consider the diamond crystal as example.
0. Prerequisites
This tutorial assumes that you have already downloaded and installed exciting, and set the relevant environment variables. Otherwise, please have a look at How to set environment variables for tutorials scripts. The script which is relevant for this tutorial is
- PLOT-phonon-anim.py
Note: The symbol $ at beginnings of lines in code segments below indicates the shell prompt.
Continue in the working directory where you did the phonon calculation, e.g., /home/tutorials/diamond-phonons/c-test. 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
To invoke the script, simply type
$ PLOT-phonon-anim.py
The script will read phonon eigenvectors for all q-points contained in the file PHONON.OUT and plot a supercell of 6$\times$6$\times$6 unit cells to visualize them. Unit cells are taken as specified in input.xml and the dimensions are along lattice vectors. If you want to change the supercell size, e.g., type
$ PLOT-phonon-anim.py 4 4 1
to obtain a supercell of 4$\times$4$\times$1 unit cells.
When executing the script PLOT-phonon-anim.py, you will be required to enter the number of steps in the animation which complete one period of the vibration.
$ PLOT-phonon-anim.py
############################################
Supercell dimensions : 6 6 6
Number of steps in the animation? >>>> 20
--------------------------------------------
Total number of atoms : 2
Total number of q-points : 3
--------------------------------------------
q-point 1 is 0.0 0.0 0.0
mode 1 with frequency -0.0000 cm-1
mode 2 with frequency 0.0000 cm-1
mode 3 with frequency 0.0000 cm-1
mode 4 with frequency 1579.8263 cm-1
mode 5 with frequency 1579.8263 cm-1
mode 6 with frequency 1579.8263 cm-1
q-point 2 is 0.5 0.5 0.0
mode 1 with frequency 524.5318 cm-1
mode 2 with frequency 524.5318 cm-1
mode 3 with frequency 1096.7498 cm-1
mode 4 with frequency 1096.7498 cm-1
mode 5 with frequency 1127.1560 cm-1
mode 6 with frequency 1127.1560 cm-1
q-point 3 is 0.5 0.5 0.5
mode 1 with frequency 459.7583 cm-1
mode 2 with frequency 459.7583 cm-1
mode 3 with frequency 868.0174 cm-1
mode 4 with frequency 1239.1738 cm-1
mode 5 with frequency 1400.9692 cm-1
mode 6 with frequency 1400.9692 cm-1
############################################
$
Specify, e.g., 20 steps, as above. The screen output of the script is completed by information about the number of atoms, number of q-points, and the frequency (in cm-1) for each mode at each q-point.
Beyond this information, 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 subsections deal with visualizing these files. To exemplify, we show this using XCrySDen and VMD. You might have other/additional choices, according to the actual software installed in your environment.
2. Visualize coordinate files
2.1) Using XCrySDen
If XCrySDen is installed on your system, you can use it to visualize the files produced in the previous step. Invoke the program by typing
$ xcrysden
Then, open the File -> Open Structure dialog. We show here the case using the option Open AXSF for the .axsf files. You could also use the .xyz files (option Open XYZ).
Choose a file, e.g., q1_mode4.axsf. The following two windows will apear:
You can click on the larger window and keeping the click you can also change the angle of view to the cell. Now, you can use the arrow buttons in the smaller Animation Control Center-window to watch the animation of the mode. In our example, the $T_{2g}$ phonon mode (the 4th one) of diamond at Γ would look like the following:
For a detailed description of all features of XCrySDen, including everything on animations, we refer to the XCrySDen website.
2.2) Using VMD
As a second example, 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
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:
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.
Our phonon mode, the 4th one at the Γ point, would look then like the following:
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, and invoke the script PLOT-phonon-anim.py once more, to obtain the appropriate .xyz file.
For a detailed description of all features of VMD and tutorials, including the creation of movies, we refer to the VMD website.