Density of States (DoS)ΒΆ
This shows a two densities of states (DoSs), which show the density of phonon modes at particular frequencies.
The left plot can be generated by:
tp plot dos ../data/basno3/projected_dos.dat --total --nolegend -c pink -c cyan -c red -p ../data/basno3/POSCAR
And the right plot by:
tp plot dos ../data/basno3/projected_dos.dat --atoms "Ba Sn O O_2 2" --sigma 0.2 --location 1 -c magenta -c cyan -c red -c orange
Or the whole thing in python with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/usr/bin/env python3
import tp
dosfile = '../data/basno3/projected_dos.dat'
poscar = '../data/basno3/POSCAR'
colours = {'Ba': '#ff00ff',
'Sn': '#00ffff',
'O': '#ff0000',
'O_2': '#ff8000'}
fig, ax, add_legend = tp.axes.small.two_h()
# Unsmeared, read from POSCAR with total
dos1 = tp.data.load.phonopy_dos(dosfile, poscar=poscar)
tp.plot.frequency.add_dos(ax[0], dos1, total=True, colour=colours)
# Smeared (sigma=0.2), custom atoms with no total
dos2 = tp.data.load.phonopy_dos(dosfile, atoms='Ba Sn O O_2 2')
tp.plot.frequency.add_dos(ax[1], dos2, sigma=0.2, colour=colours)
add_legend(title='$BaSnO_3$', location=2, ncol=1)
fig.savefig('dos.png')
|
The most foolproof way of specifying colours is through a dictionary (lines 8-11), but colours, linestyles etc. as well as atoms can also be specified in POSCAR order.
Manually specifying atoms
(line 20) rather than reading from
the POSCAR enables the separation of different environments of the same atom,
and in this instance no POSCAR is required. The default for the poscar
argument is POSCAR, so often this will not need to be specified anyway.
If desired, the atom-projected dos can be disabled entirely by setting
projected
to False
, and in the same way the total
can be enabled
or disabled (line 17).
To recreated experimental data more closely, Gaussian smearing can be applied
with sigma
(line 21). This option may be quicker and easier than rerunning
phonopy to compare, but beware it does not detect if smearing is already
applied. A good starting value is 0.2, as used here.