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.916429469819                   -0.69    4.8    100ms
  2   -7.921203360336       -2.32       -1.52    1.0   50.5ms
  3   -7.921405499150       -3.69       -2.49    1.5   55.3ms
  4   -7.921440893024       -4.45       -2.83    2.4   70.0ms
  5   -7.921441610360       -6.14       -3.00    1.1   51.7ms
  6   -7.921442004365       -6.40       -4.43    1.0   57.6ms
  7   -7.921442021718       -7.76       -4.57    2.6   74.7ms
  8   -7.921442022122       -9.39       -5.22    1.0   51.5ms
  9   -7.921442022132      -11.02       -5.09    1.9   61.2ms
 10   -7.921442022144      -10.93       -5.85    1.0   52.0ms
 11   -7.921442022144      -12.23       -6.98    1.0   57.5ms
 12   -7.921442022144      -13.34       -6.82    2.9   74.6ms
 13   -7.921442022144      -14.35       -7.85    1.0   51.9ms
 14   -7.921442022144   +  -14.75       -8.00    1.9   60.6ms
 15   -7.921442022144      -14.75       -8.79    1.0   57.9ms

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.0   1.90s  Non-interacting
   1        0       1        0.31     52.3   2.20s
   2        0       2       -0.52     46.9   1.46s
   3        0       3       -2.40     41.7   1.35s
   4        0       4       -4.46     29.7   1.02s
   5        0       5       -6.46     17.5   727ms
   6        0       6       -8.91      4.0   409ms
   7        1       1       -7.84     55.6   1.97s  Restart
   8        1       2       -8.87      5.6   458ms
                                      72.8   1.94s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      72.9   1.85s  Non-interacting
   1        0       1        0.31     52.3   1.65s
   2        0       2       -0.52     46.9   1.46s
   3        0       3       -2.40     41.7   1.33s
   4        0       4       -4.46     29.7   1.04s
   5        0       5       -6.46     17.5   733ms
   6        0       6       -8.91      4.0   440ms
   7        1       1       -7.84     55.6   2.02s  Restart
   8        1       2       -8.87      5.6   441ms
                                      72.8   1.98s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.83s  Non-interacting
   1        0       1        0.31     52.3   2.37s
   2        0       2       -0.52     46.9   1.41s
   3        0       3       -2.40     41.7   1.42s
   4        0       4       -4.46     29.7   1.06s
   5        0       5       -6.46     17.5   732ms
   6        0       6       -8.91      4.0   404ms
   7        1       1       -7.84     55.6   1.98s  Restart
   8        1       2       -8.87      5.6   449ms
                                      72.8   1.98s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.85s  Non-interacting
   1        0       1        0.31     52.3   1.68s
   2        0       2       -0.52     46.9   1.47s
   3        0       3       -2.40     41.7   1.33s
   4        0       4       -4.46     29.6   1.05s
   5        0       5       -6.46     17.5   735ms
   6        0       6       -8.91      4.0   405ms
   7        1       1       -7.83     55.6   2.00s  Restart
   8        1       2       -8.89      5.6   440ms
                                      72.8   1.97s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.87s  Non-interacting
   1        0       1        0.31     52.3   1.71s
   2        0       2       -0.52     46.9   1.45s
   3        0       3       -2.40     41.7   2.02s
   4        0       4       -4.46     29.6   1.00s
   5        0       5       -6.46     17.5   734ms
   6        0       6       -8.91      4.0   409ms
   7        1       1       -7.83     55.6   2.01s  Restart
   8        1       2       -8.89      5.6   473ms
                                      72.8   1.99s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.84s  Non-interacting
   1        0       1        0.31     52.3   1.71s
   2        0       2       -0.52     46.9   1.47s
   3        0       3       -2.40     41.7   1.38s
   4        0       4       -4.46     29.6   1.06s
   5        0       5       -6.46     17.5   749ms
   6        0       6       -8.91      4.0   430ms
   7        1       1       -7.83     55.6   2.01s  Restart
   8        1       2       -8.89      5.6   449ms
                                      72.8   1.98s  Final orbitals
 87.570691 seconds (92.54 M allocations: 80.278 GiB, 7.19% gc time, 1.17% compilation time: 100% of which was recompilation)

These are the final phonon frequencies:

phret_q0.frequencies
6-element Vector{Float64}:
 -0.0034981553571261934
 -0.00297745115762518
 -0.002977451157584445
  0.00430223062962175
  0.004302230629684215
  0.004353201759944783