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.916402068833 -0.69 4.8 105ms
2 -7.921202645886 -2.32 -1.52 1.0 54.7ms
3 -7.921400909932 -3.70 -2.49 1.2 55.9ms
4 -7.921440934465 -4.40 -2.80 2.9 78.7ms
5 -7.921441420567 -6.31 -2.89 1.0 54.5ms
6 -7.921442005870 -6.23 -4.54 1.0 54.2ms
7 -7.921442021494 -7.81 -4.43 3.2 86.4ms
8 -7.921442022118 -9.21 -5.10 1.0 77.8ms
9 -7.921442022117 + -12.17 -4.95 1.0 58.4ms
10 -7.921442022142 -10.60 -5.76 1.0 59.8ms
11 -7.921442022144 -11.78 -5.78 2.2 73.6ms
12 -7.921442022144 -12.60 -6.04 1.0 59.4ms
13 -7.921442022144 -12.83 -6.42 1.0 58.5ms
14 -7.921442022144 -13.59 -7.03 1.1 61.6ms
15 -7.921442022144 -14.21 -8.00 1.4 116msNext 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 2.06s Non-interacting
1 0 1 0.31 52.6 3.83s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 41.8 1.21s
4 0 4 -4.46 29.9 971ms
5 0 5 -6.46 17.5 698ms
6 0 6 -8.92 4.0 425ms
7 1 1 -7.82 55.9 1.92s Restart
8 1 2 -8.97 5.6 457ms
72.8 1.76s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.58s Non-interacting
1 0 1 0.31 52.6 1.55s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 41.8 1.21s
4 0 4 -4.46 29.9 973ms
5 0 5 -6.46 17.5 703ms
6 0 6 -8.92 4.0 435ms
7 1 1 -7.82 55.9 1.86s Restart
8 1 2 -8.97 5.6 450ms
72.8 1.76s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.0 1.59s Non-interacting
1 0 1 0.31 52.6 1.54s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 41.8 1.23s
4 0 4 -4.46 29.9 961ms
5 0 5 -6.46 17.5 705ms
6 0 6 -8.92 4.0 424ms
7 1 1 -7.82 55.9 1.86s Restart
8 1 2 -8.97 5.6 456ms
72.8 1.76s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.0 1.60s Non-interacting
1 0 1 0.31 52.6 3.03s
2 0 2 -0.52 47.2 1.40s
3 0 3 -2.40 41.8 1.18s
4 0 4 -4.46 29.9 965ms
5 0 5 -6.46 17.5 714ms
6 0 6 -8.92 4.0 433ms
7 1 1 -7.82 55.9 1.86s Restart
8 1 2 -8.96 5.6 469ms
72.8 1.78s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
72.9 1.62s Non-interacting
1 0 1 0.31 52.6 1.55s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 41.8 1.22s
4 0 4 -4.46 29.9 964ms
5 0 5 -6.46 17.5 716ms
6 0 6 -8.92 4.0 422ms
7 1 1 -7.82 55.9 1.86s Restart
8 1 2 -8.96 5.6 461ms
72.8 1.77s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.0 1.60s Non-interacting
1 0 1 0.31 52.6 1.53s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 41.8 1.23s
4 0 4 -4.46 29.9 964ms
5 0 5 -6.46 17.5 700ms
6 0 6 -8.92 4.0 416ms
7 1 1 -7.82 55.9 1.85s Restart
8 1 2 -8.96 5.6 459ms
72.8 1.74s Final orbitals
86.081997 seconds (100.46 M allocations: 80.419 GiB, 7.30% gc time, 7.97% compilation time: 100% of which was recompilation)These are the final phonon frequencies:
phret_q0.frequencies6-element Vector{Float64}:
-0.003498155359427931
-0.0029774511536989614
-0.00297745115361676
0.004302230607336175
0.0043022306075117
0.004353201743744336