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.916465010379 -0.69 4.8 113ms
2 -7.921207362209 -2.32 -1.52 1.0 56.3ms
3 -7.921402917774 -3.71 -2.49 1.2 59.2ms
4 -7.921440949420 -4.42 -2.81 2.9 94.3ms
5 -7.921441516220 -6.25 -2.93 1.0 56.5ms
6 -7.921442008603 -6.31 -4.46 1.0 57.0ms
7 -7.921442021811 -7.88 -4.60 2.6 83.5ms
8 -7.921442022131 -9.50 -5.32 1.0 57.3ms
9 -7.921442022141 -11.00 -5.58 1.9 68.2ms
10 -7.921442022144 -11.57 -5.93 1.0 57.4ms
11 -7.921442022144 -12.41 -6.54 1.4 75.2ms
12 -7.921442022144 -13.34 -7.16 1.6 66.3ms
13 -7.921442022144 -14.75 -7.51 1.8 69.1ms
14 -7.921442022144 -14.57 -7.91 1.2 62.3ms
15 -7.921442022144 + -Inf -9.02 1.4 64.5msNext 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 2.04s Non-interacting
1 0 1 0.31 52.7 3.76s
2 0 2 -0.52 47.2 1.34s
3 0 3 -2.40 42.0 1.22s
4 0 4 -4.46 30.0 967ms
5 0 5 -6.46 17.5 706ms
6 0 6 -8.92 4.0 416ms
7 1 1 -7.84 55.9 1.91s Restart
8 1 2 -8.98 5.5 464ms
73.0 1.75s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.1 2.92s Non-interacting
1 0 1 0.31 52.7 1.61s
2 0 2 -0.52 47.2 1.31s
3 0 3 -2.40 42.0 1.24s
4 0 4 -4.46 30.0 986ms
5 0 5 -6.46 17.5 720ms
6 0 6 -8.92 4.0 421ms
7 1 1 -7.84 55.9 1.87s Restart
8 1 2 -8.98 5.5 469ms
72.9 1.77s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.1 1.64s Non-interacting
1 0 1 0.31 52.7 1.56s
2 0 2 -0.52 47.2 1.33s
3 0 3 -2.40 42.0 1.24s
4 0 4 -4.46 30.0 973ms
5 0 5 -6.46 17.5 711ms
6 0 6 -8.92 4.0 419ms
7 1 1 -7.84 55.9 1.87s Restart
8 1 2 -8.98 5.5 454ms
72.9 1.76s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.1 1.61s Non-interacting
1 0 1 0.31 52.7 1.54s
2 0 2 -0.52 47.2 1.32s
3 0 3 -2.40 41.9 1.22s
4 0 4 -4.46 30.0 970ms
5 0 5 -6.46 17.5 713ms
6 0 6 -8.92 4.0 422ms
7 1 1 -7.84 55.9 1.84s Restart
8 1 2 -8.98 5.5 458ms
72.9 1.75s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.1 1.59s Non-interacting
1 0 1 0.31 52.7 1.52s
2 0 2 -0.52 47.2 1.32s
3 0 3 -2.40 41.9 1.21s
4 0 4 -4.46 30.0 966ms
5 0 5 -6.46 17.5 707ms
6 0 6 -8.92 4.0 400ms
7 1 1 -7.84 55.9 1.84s Restart
8 1 2 -8.98 5.5 1.73s
72.9 1.72s Final orbitals
Iter Restart Krydim log10(res) avg(CG) Δtime Comment
---- ------- ------ ---------- ------- ------ ---------------
73.1 1.57s Non-interacting
1 0 1 0.31 52.7 1.56s
2 0 2 -0.52 47.2 1.35s
3 0 3 -2.40 41.9 1.23s
4 0 4 -4.46 30.0 979ms
5 0 5 -6.46 17.5 713ms
6 0 6 -8.92 4.0 418ms
7 1 1 -7.84 55.9 1.87s Restart
8 1 2 -8.98 5.5 445ms
72.9 1.77s Final orbitals
87.176638 seconds (100.49 M allocations: 80.483 GiB, 8.41% gc time, 7.61% compilation time: 100% of which was recompilation)These are the final phonon frequencies:
phret_q0.frequencies6-element Vector{Float64}:
-0.0034981553526570253
-0.0029774511523067006
-0.002977451152226475
0.004302230633256609
0.0043022306334349805
0.004353201763833903