# Phonon density of states {#sec:dfptds}

Instructions for computing phonons density of states (DOS) are almost
identical to those of `band-structure<sec:dfptbs>`{.interpreted-text
role="ref"} calculations. The only difference is sampling of phonons
wave-vectors which is done on a grid of q-points in case of DOS
calculations. One can create the following input file to perform as DOS
calculation:

:::: note
::: title
Note
:::

Please see `sec:dfptbs`{.interpreted-text role="ref"} for more
information regarding how dynamical matrix is calculated in
nonself-consistent DFPT calculations, as well as LO-TO corrections.
::::

``` matlab
info.calculationType = 'dfpt-phonon-dos'
info.savepath = './results/bn_real_phonon_dos'
dfpt.phononData = './results/bn_real_phonon.mat'
dfpt.dielectricData = './results/bn_real_dielectric.mat'
dfpt.qpointGridn = [10 10 10]
dfpt.asr = [1,1,1]
```

We expand on these important keywords.

-   `info.calculationType` is a string determining the type of the
    calculation;
-   `info.savepath` points to the file that stores the ouput data;
-   `dfpt.dielectricData` points to the path of the file containing the
    ion-clamped dielectric tensor (only required for non-metallic
    systems), i.e. the output of `dielectric<ioncd>`{.interpreted-text
    role="ref"} calculation. This information is used to calculate the
    LO-TO corrections;
-   `dfpt.phononData` points to the path of the file containing the
    dynamical matrix and Born effective charges, i.e. the output of
    `phonon<DMandBE>`{.interpreted-text role="ref"} calculation; BECs
    are used for calculating LO-TO corrections, and dynamical matrix is
    used in Fourier interplation process.
-   `dfpt.qpointGridn` use a `[10,10,10]` grid to sample the Brillouin
    zone. The grid is forced to be $\Gamma$-centered.
-   `dfpt.asr` it is a $1\times 3$ vector which determines the status of
    various acoustic sum rules in DFPT calculations. In particular, the
    first two entries determines if acoustic sum rule and charge
    neutrality will be enforced to dynamical matrix and Born effective
    charges, respectively. RESCU assumes that all sum rules are active
    by default.

Then execute RESCU as follows

``` shell
rescu -i bn_real_phonon_dos
```

Upon completion, RESCU will write the DOS data in `DensityOfStates.txt`.
Additional data is found in the `dfpt` and `dos` structure stored in
`./results/bn_real_phonon_dos.mat`.

``` 
>> load results/bn_real_phonon_dos.mat
>> dfpt

dfpt = 

  struct with fields:

             IFC: [6x6x27 double]
             asr: [1 1 1]
            desc: [1x1 struct]
          dynMat: [6x6x1000 double]
      phononFreq: [6x1000 double]
      phononMode: {1000x1 cell}
    qpointDirect: [1000x3 double]
     qpointGridn: [10 10 10]
            type: 'phonon-dos'

>> dos

dos = 

  struct with fields:

      desc: [1x1 struct]
    dosvec: [6024x1 double]
    nrgvec: [6024x1 double]            
```

Please see `sec:dfptbs`{.interpreted-text role="ref"} for further
description of important variables. You may then plot the phonon DOS
using RESCU\'s plotting tool

``` shell
rescu -p ./results/bn_real_phonon_dos.mat
```

RESCU will display a plot of the phonon DOS, shown in
`fig:bnPhononDOS`{.interpreted-text role="numref"} and also save the
figure to `bn_real_phonon_dos_plot.fig`.

<figure>
<img src="figs/bn_real_phonon_dos.png" id="fig:bnPhononDOS"
alt="figs/bn_real_phonon_dos.png" />
<figcaption>Boron nitride phonon DOS</figcaption>
</figure>
