Phonon computations

This is a quick sketch how to run a simple phonon calculation using DFTK.

Preliminary implementation

Practical phonon computations have only seen rudimentary testing as of now. As of now we do not yet recommend relying on this feature for production calculations. We appreciate any issues, bug reports or PRs.

First we run an SCF calculation.

using AtomsBuilder
using DFTK
using PseudoPotentialData

pseudopotentials = PseudoFamily("cp2k.nc.sr.lda.v0_1.semicore.gth")
model  = model_DFT(bulk(:Si); pseudopotentials, functionals=LDA())
basis  = PlaneWaveBasis(model; Ecut=10, kgrid=[4, 4, 4])
scfres = self_consistent_field(basis, tol=1e-8);
n     Energy            log10(ΔE)   log10(Δρ)   Diag   Δtime
---   ---------------   ---------   ---------   ----   ------
  1   -7.916441077308                   -0.69    4.8    110ms
  2   -7.921207220624       -2.32       -1.52    1.0   55.3ms
  3   -7.921406110344       -3.70       -2.49    1.4   59.4ms
  4   -7.921440993798       -4.46       -2.83    2.5   89.0ms
  5   -7.921441671012       -6.17       -3.04    1.1   57.0ms
  6   -7.921442008524       -6.47       -4.55    1.1   57.5ms
  7   -7.921442021908       -7.87       -4.67    2.9   85.2ms
  8   -7.921442022133       -9.65       -5.32    1.0   56.1ms
  9   -7.921442022142      -11.04       -5.60    1.6   62.5ms
 10   -7.921442022144      -11.65       -6.02    1.0   56.1ms
 11   -7.921442022144      -12.60       -6.79    1.0   69.0ms
 12   -7.921442022144      -13.40       -7.28    2.4   73.1ms
 13   -7.921442022144   +    -Inf       -7.77    1.4   63.3ms
 14   -7.921442022144   +  -15.05       -8.24    1.4   63.1ms

Next we compute the phonon modes at the q-point [1/4, 1/4, 1/4].

scfres = DFTK.unfold_bz(scfres)
phret_q0 = @time DFTK.phonon_modes(scfres; q=[0.25, 0.25, 0.25]);
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   3.72s  Non-interacting
   1        0       1        0.31     52.7   3.94s
   2        0       2       -0.52     47.2   1.59s
   3        0       3       -2.40     42.0   1.43s
   4        0       4       -4.46     30.0   1.11s
   5        0       5       -6.46     17.6   800ms
   6        0       6       -8.91      4.0   442ms
   7        1       1       -7.87     55.6   2.18s  Restart
   8        1       2       -9.08      5.5   489ms
                                      72.9   2.12s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   1.97s  Non-interacting
   1        0       1        0.31     52.7   1.82s
   2        0       2       -0.52     47.2   1.57s
   3        0       3       -2.40     42.0   1.43s
   4        0       4       -4.46     30.0   1.11s
   5        0       5       -6.46     17.6   794ms
   6        0       6       -8.91      4.0   446ms
   7        1       1       -7.87     55.6   2.14s  Restart
   8        1       2       -9.08      5.5   475ms
                                      72.9   2.14s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   1.96s  Non-interacting
   1        0       1        0.31     52.7   1.82s
   2        0       2       -0.52     47.2   1.54s
   3        0       3       -2.40     42.0   1.42s
   4        0       4       -4.46     30.0   1.11s
   5        0       5       -6.46     17.6   798ms
   6        0       6       -8.91      4.0   436ms
   7        1       1       -7.87     55.6   2.12s  Restart
   8        1       2       -9.08      5.5   479ms
                                      72.9   2.10s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   1.94s  Non-interacting
   1        0       1        0.31     52.7   1.80s
   2        0       2       -0.52     47.2   1.55s
   3        0       3       -2.40     42.0   2.66s
   4        0       4       -4.46     30.0   1.19s
   5        0       5       -6.46     17.5   775ms
   6        0       6       -8.91      4.0   409ms
   7        1       1       -7.85     55.9   2.09s  Restart
   8        1       2       -9.09      5.6   477ms
                                      72.9   2.09s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   1.94s  Non-interacting
   1        0       1        0.31     52.7   1.79s
   2        0       2       -0.52     47.2   1.54s
   3        0       3       -2.40     42.0   1.42s
   4        0       4       -4.46     30.0   1.10s
   5        0       5       -6.46     17.5   780ms
   6        0       6       -8.91      4.0   443ms
   7        1       1       -7.85     55.9   2.10s  Restart
   8        1       2       -9.09      5.6   476ms
                                      72.9   2.07s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.1   1.93s  Non-interacting
   1        0       1        0.31     52.7   1.77s
   2        0       2       -0.52     47.2   1.54s
   3        0       3       -2.40     42.0   1.42s
   4        0       4       -4.46     30.0   1.10s
   5        0       5       -6.46     17.5   780ms
   6        0       6       -8.91      4.0   425ms
   7        1       1       -7.85     55.9   2.08s  Restart
   8        1       2       -9.09      5.6   467ms
                                      72.9   2.07s  Final orbitals
 98.851981 seconds (101.48 M allocations: 80.492 GiB, 8.04% gc time, 7.34% compilation time: 100% of which was recompilation)

These are the final phonon frequencies:

phret_q0.frequencies
6-element Vector{Float64}:
 -0.0034981553607239956
 -0.002977451160935513
 -0.0029774511602397536
  0.004302230621450548
  0.00430223062192956
  0.004353201752852598