Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
epolack committed May 10, 2023
1 parent 12e0a75 commit 88c28ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/custom_potential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ tot_local_pot = DFTK.total_local_potential(scfres.ham)[:, 1, 1]; # use only dime
# Extract other quantities before plotting them
ρ = scfres.ρ[:, 1, 1, 1] # converged density, first spin component
ψ_fourier = scfres.ψ[1][:, 1] # first k-point, all G components, first eigenvector
ψ = ifft(basis, basis.kpoints[1], ψ_fourier)[:, 1, 1]
ψ_t = ifft(basis, basis.kpoints[1], ψ_fourier)[:, 1, 1]
ψ = reinterpret(reshape, eltype(eltype(ψ_t)), ψ_t)
ψ /= (ψ[div(end, 2)] / abs(ψ[div(end, 2)]));

using Plots
Expand Down
5 changes: 4 additions & 1 deletion examples/error_estimates_forces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ function apply_metric(φ, P, δφ, A::Function)
Aδφk = similar(δφk)
φk = φ[ik]
for n = 1:size(δφk,2)
Aδφk[:,n] = A(φk, P[ik], δφk[:,n], n)
φk_t = reinterpret(reshape, eltype(φk[1]), φk)
δφk_t = reinterpret(reshape, eltype(δφk[1,n]), δφk)
Aδφk_t = reinterpret(reshape, eltype(Aδφk[1,n]), Aδφk)
Aδφk_t[:,n] = A(φk_t, P[ik], δφk_t[:,n], n)
end
Aδφk
end
Expand Down

0 comments on commit 88c28ca

Please sign in to comment.