Phonon computations

This is a quick sketch how to run a simple phonon calculation using DFTK. 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.916451015284                   -0.69    4.6    102ms
  2   -7.921209048588       -2.32       -1.52    1.0   53.0ms
  3   -7.921404562874       -3.71       -2.49    1.4   56.6ms
  4   -7.921440858483       -4.44       -2.82    2.5   72.3ms
  5   -7.921441575559       -6.14       -2.97    1.1   54.3ms
  6   -7.921442005334       -6.37       -4.49    1.0   61.4ms
  7   -7.921442021493       -7.79       -4.46    2.8   81.4ms
  8   -7.921442022117       -9.20       -5.19    1.0   55.0ms
  9   -7.921442022142      -10.60       -5.52    1.5   59.9ms
 10   -7.921442022143      -11.85       -5.96    1.2   57.7ms
 11   -7.921442022144      -12.22       -6.81    1.1   62.4ms
 12   -7.921442022144      -13.32       -7.14    2.4   72.3ms
 13   -7.921442022144      -14.75       -7.41    1.1   56.5ms
 14   -7.921442022144   +    -Inf       -8.04    1.0    104ms

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.95s  Non-interacting
   1        0       1        0.31     52.4   2.22s
   2        0       2       -0.52     46.9   1.47s
   3        0       3       -2.40     41.7   1.35s
   4        0       4       -4.46     29.7   1.05s
   5        0       5       -6.46     17.5   741ms
   6        0       6       -8.91      4.0   1.11s
   7        1       1       -7.83     55.6   1.94s  Restart
   8        1       2       -8.87      5.6   458ms
                                      72.7   2.01s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.84s  Non-interacting
   1        0       1        0.31     52.4   1.72s
   2        0       2       -0.52     46.9   1.48s
   3        0       3       -2.40     41.7   1.35s
   4        0       4       -4.46     29.7   1.05s
   5        0       5       -6.46     17.5   743ms
   6        0       6       -8.91      4.0   418ms
   7        1       1       -7.83     55.6   2.00s  Restart
   8        1       2       -8.87      5.6   460ms
                                      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.4   1.70s
   2        0       2       -0.52     46.9   1.45s
   3        0       3       -2.40     41.7   1.34s
   4        0       4       -4.46     29.7   1.04s
   5        0       5       -6.46     17.5   741ms
   6        0       6       -8.91      4.0   415ms
   7        1       1       -7.83     55.6   2.61s  Restart
   8        1       2       -8.87      5.6   447ms
                                      72.7   1.99s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      73.0   1.86s  Non-interacting
   1        0       1        0.31     52.4   1.71s
   2        0       2       -0.52     46.9   1.47s
   3        0       3       -2.40     41.7   1.35s
   4        0       4       -4.46     29.7   1.06s
   5        0       5       -6.46     17.5   758ms
   6        0       6       -8.91      4.0   425ms
   7        1       1       -7.83     55.6   2.01s  Restart
   8        1       2       -8.87      5.6   459ms
                                      72.8   2.01s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      72.9   1.85s  Non-interacting
   1        0       1        0.31     52.4   1.71s
   2        0       2       -0.52     46.9   1.48s
   3        0       3       -2.40     41.7   1.34s
   4        0       4       -4.46     29.7   1.04s
   5        0       5       -6.46     17.5   747ms
   6        0       6       -8.91      4.0   419ms
   7        1       1       -7.83     55.6   2.68s  Restart
   8        1       2       -8.87      5.6   420ms
                                      72.7   1.93s  Final orbitals
Iter  Restart  Krydim  log10(res)  avg(CG)  Δtime   Comment
----  -------  ------  ----------  -------  ------  ---------------
                                      72.9   1.85s  Non-interacting
   1        0       1        0.31     52.4   1.71s
   2        0       2       -0.52     46.9   1.48s
   3        0       3       -2.40     41.7   1.35s
   4        0       4       -4.46     29.7   1.05s
   5        0       5       -6.46     17.5   756ms
   6        0       6       -8.91      4.0   431ms
   7        1       1       -7.83     55.6   2.02s  Restart
   8        1       2       -8.87      5.6   459ms
                                      72.8   2.00s  Final orbitals
 88.193332 seconds (94.34 M allocations: 80.346 GiB, 7.28% gc time, 1.20% compilation time: 100% of which was recompilation)

These are the final phonon frequencies:

phret_q0.frequencies
6-element Vector{Float64}:
 -0.003498155362058426
 -0.0029774511597638674
 -0.002977451159257137
  0.004302230608897933
  0.004302230609497188
  0.004353201739721985
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.