Phonon computations
This is a quick sketch how to run a simple phonon calculation using DFTK.
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.916467322272 -0.69 4.6 113ms
2 -7.921207990747 -2.32 -1.52 1.0 58.3ms
3 -7.921404366431 -3.71 -2.49 1.4 62.6ms
4 -7.921440879568 -4.44 -2.82 2.8 82.8ms
5 -7.921441566716 -6.16 -2.96 1.0 57.5ms
6 -7.921442006215 -6.36 -4.49 1.0 69.0ms
7 -7.921442021575 -7.81 -4.48 3.2 93.4ms
8 -7.921442022122 -9.26 -5.21 1.0 59.3ms
9 -7.921442022143 -10.67 -5.66 1.6 66.3ms
10 -7.921442022143 -12.22 -5.84 1.6 67.1ms
11 -7.921442022144 -12.19 -7.15 1.0 59.9ms
12 -7.921442022144 -13.50 -7.20 2.6 85.2ms
13 -7.921442022144 + -14.57 -7.29 1.0 69.8ms
14 -7.921442022144 -14.57 -7.83 1.0 61.3ms
15 -7.921442022144 + -Inf -8.32 1.0 61.3msNext 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 3.17s Non-interacting
1 0 1 0.31 52.4 3.57s
2 0 2 -0.52 47.1 1.33s
3 0 3 -2.40 41.7 1.21s
4 0 4 -4.46 29.6 960ms
5 0 5 -6.46 17.4 700ms
6 0 6 -8.91 4.0 427ms
7 1 1 -7.82 55.7 1.89s Restart
8 1 2 -8.83 5.6 457ms
72.8 1.74s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.57s Non-interacting
1 0 1 0.31 52.4 1.52s
2 0 2 -0.52 47.1 1.33s
3 0 3 -2.40 41.7 1.20s
4 0 4 -4.46 29.6 958ms
5 0 5 -6.46 17.4 697ms
6 0 6 -8.91 4.0 433ms
7 1 1 -7.82 55.7 1.85s Restart
8 1 2 -8.83 5.6 457ms
72.8 1.75s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.58s Non-interacting
1 0 1 0.31 52.4 1.53s
2 0 2 -0.52 47.1 1.31s
3 0 3 -2.40 41.7 1.22s
4 0 4 -4.46 29.6 962ms
5 0 5 -6.46 17.4 700ms
6 0 6 -8.91 4.0 420ms
7 1 1 -7.82 55.7 1.83s Restart
8 1 2 -8.83 5.6 456ms
72.8 1.75s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.0 1.59s Non-interacting
1 0 1 0.31 52.4 1.52s
2 0 2 -0.52 47.1 1.32s
3 0 3 -2.40 41.7 1.21s
4 0 4 -4.46 29.6 971ms
5 0 5 -6.46 17.4 733ms
6 0 6 -8.91 4.0 437ms
7 1 1 -7.82 55.7 3.24s Restart
8 1 2 -8.85 5.6 417ms
72.8 1.68s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.58s Non-interacting
1 0 1 0.31 52.4 1.52s
2 0 2 -0.52 47.1 1.33s
3 0 3 -2.40 41.7 1.20s
4 0 4 -4.46 29.6 976ms
5 0 5 -6.46 17.4 697ms
6 0 6 -8.91 4.0 432ms
7 1 1 -7.82 55.7 1.84s Restart
8 1 2 -8.85 5.6 457ms
72.8 1.75s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.59s Non-interacting
1 0 1 0.31 52.4 1.54s
2 0 2 -0.52 47.1 1.33s
3 0 3 -2.40 41.7 1.21s
4 0 4 -4.46 29.6 967ms
5 0 5 -6.46 17.4 697ms
6 0 6 -8.91 4.0 440ms
7 1 1 -7.82 55.7 1.87s Restart
8 1 2 -8.85 5.6 453ms
72.7 1.76s Final orbitals
86.628418 seconds (101.49 M allocations: 80.395 GiB, 8.06% gc time, 8.02% compilation time: 100% of which was recompilation)These are the final phonon frequencies:
phret_q0.frequencies6-element Vector{Float64}:
-0.00349815535565445
-0.0029774511583546518
-0.0029774511582323963
0.004302230639408008
0.004302230639541152
0.00435320176823937