Skip to content

Commit

Permalink
Add phonon example (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst authored Jan 3, 2025
1 parent 8d32226 commit 6b0f20b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PAGES = [
"Response and properties" => [
"examples/polarizability.jl",
"examples/forwarddiff.jl",
"examples/phonons.jl",
],
"Ecosystem integration" => [
# This concerns the discussion of interfaces, IO and integration
Expand Down
2 changes: 1 addition & 1 deletion docs/src/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Density-functional perturbation theory (DFPT)
- Integration of DFPT with algorithmic differentiation,
e.g. [Polarizability using automatic differentiation](@ref)
- Phonons *(preliminary implementation)*
- [Phonon computations](@ref) *(preliminary implementation)*

* Unique features
- Support for arbitrary floating point types, including `Float32` (single precision)
Expand Down
24 changes: 24 additions & 0 deletions examples/phonons.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# # 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);
nothing # hide

# 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]);
nothing # hide

# These are the final phonon frequencies:

phret_q0.frequencies

0 comments on commit 6b0f20b

Please sign in to comment.