JuliaMolSim / DFTK.jl

Density-functional toolkit
https://docs.dftk.org
MIT License
435 stars 89 forks source link

Free energy for computations with temperature #105

Closed antoine-levitt closed 4 years ago

antoine-levitt commented 4 years ago

In case of computations at finite temperature, the energy is not variational wrt the orbitals, which makes it harder to compute derivatives such as forces. We should instead compute the free energy, which has an entropic contribution.

mfherbst commented 4 years ago

Do you talk about a complete free energy minimisation, i.e. minimising

F(ρ, {f_i}, T) = E(ρ, {f_i}) - T * S({f_i})

over all parameters or just minimise it for a given temperature T. The latter would just amount to adding the S term to our energy expression for direct minimisation and an additional set of gradient entries for the f_i no?

antoine-levitt commented 4 years ago

I'm thinking of SCF. SCF at finite temperature amounts to minimizing the free energy, not the energy. In particular in means that the Hellmann-Feynman forces are not the derivative of the energy but of the free energy.

To implement it in direct minimization is more tricky.

mfherbst commented 4 years ago

How can one understand that? Differentiating the free energy with respect to the orbitals obviously gets one the "normal" Kohn-Sham non-linear eigenproblem. So is differentiating F wrt. f_i gives the constraint of conservation of particle number? (haven't really check the literature on free energy methods yet).

antoine-levitt commented 4 years ago

Solve min_gamma tr(H gamma) - T S(gamma) under the constraint 0 <= gamma <= 1 (needed to define S), gamma^* = gamma, tr(gamma) = N, S being the fermionic entropy of the density matrix gamma, and you get gamma = FD(H - mu), FD being the Fermi-Dirac distribution and mu the Lagrange multiplier of the constraint tr gamma = N. You can also see it as you do with f_i and phi_i: the stationarity wrt f_i is what gives you f_i = FD(eps_i - mu).

mfherbst commented 4 years ago

Thanks!

antoine-levitt commented 4 years ago

For other types of smearing functions f this also works, with a slightly different entropy term. See https://www.vasp.at/vasp-workshop/k-points.pdf