Add NLCC support for phonon computations#1311
Conversation
|
I had to remove |
antoine-levitt
left a comment
There was a problem hiding this comment.
Haven't checked everything but looks reasonable!
| in reduced coordinates: | ||
| ``` | ||
| dynmat[β, t, α, s] = ∂²E/∂u_sα(-q)∂u_tβ(q). | ||
| ``` |
There was a problem hiding this comment.
really not a fan of this interpretation, defining it as the derivative of the R -> F map seems much simpler to me...
There was a problem hiding this comment.
That's basically what it is since dE/du is the force. But with an extra q dependency here. The main reason I put the formula there is to know in which order to write the dynmat entries, otherwise you can get the transpose by mistake.
| for s = 1:n_atoms, α = 1:basis.model.n_dim | ||
| # Get δH ψ | ||
| δHψs_αs = compute_δHψ_αs(basis, ψ, α, s, q) | ||
| δHψs_αs = compute_δHψ_αs(basis, ψ, α, s, q; ρ) |
There was a problem hiding this comment.
We really need this state refactor business...
| # however since the potential is real, we conjugate to obtain the -q term: | ||
| # δV = Kxc (∂ρ/∂u_sα(-q) + ∂ρcore/∂u_sα(-q)) | ||
| # = conj( Kxc (∂ρ/∂u_sα( q) + ∂ρcore/∂u_sα( q)) ) | ||
| δV_αs = conj.(apply_kernel(term, basis, δρs[α, s] + δρcores[α, s]; ρ, q)) |
There was a problem hiding this comment.
Haven't followed the complete derivation but I'm scared by this line; the whole point of the explanation I gave in #1310 is that we never conjugate q stuff. Are you sure about this conj?
There was a problem hiding this comment.
Yes 100% sure. It's also there in the local term, just hidden by Parseval's theorem. For a real function (the density is real) the conjugate should always be fine. You only get problems if you directly conjugate the psis since those are complex. I am not sure how DFPT works for spin orbit coupling or magnetic fields. Surely Dal Corso has some paper about it, but I haven't read it.
Cleaner than I expected. Nice framework that you built @epolack and @antoine-levitt, especially the automated testing!