DFTK.jl icon indicating copy to clipboard operation
DFTK.jl copied to clipboard

Reduce computation time for energy calculation

Open EfremCarnate opened this issue 3 years ago • 4 comments
trafficstars

Hello,

I am currently writing a function that calculates the total energy for an arbitrary number of gallium atoms in a cluster. The system is isolated (kgrid = [1,1,1]). However, for a 12 atom system, the timing of the computation of the self_consistent_field function averages to around 3 seconds. Here is the code so far. If you have any ideas on how to reduce the computation time of the energy calculation function that would be really helpful. Thank you for your time.

EfremCarnate avatar Aug 03 '22 09:08 EfremCarnate

Will take a look. Do you expect less by comparison to other codes and if yes by how much? On a Gamma point only calculation we should be about a factor of 2 slower (because we don't optimize for real wavefunctions) but not much more.

antoine-levitt avatar Aug 03 '22 10:08 antoine-levitt

There's nothing that stands out particularly. You can play with the mixing types to get a bit faster SCF convergence but there's no glaring issue.

antoine-levitt avatar Aug 03 '22 12:08 antoine-levitt

A large time is spent on the XC computation, if you're running things with lots of vacuum you can possibly gain a bit by using a threshold, @mfherbst did something related to that at some point I believe

antoine-levitt avatar Aug 03 '22 13:08 antoine-levitt

Alright, I'll try out all of these suggestions. Thanks a lot for your help!

EfremCarnate avatar Aug 03 '22 21:08 EfremCarnate

For reference on the point Antoine mentioned, you can reduce the cutoff for the points where XC quantities are computed using

model_DFT(lattice, atoms, positions, Xc(functionals; potential_threshold=tol); kwargs...)

where functionals is your functional list (e.g. [:lda_x, lda_c_pw]) and tol is the tolerance, try values around 1e-10, but check on the errors you make.

Also I'm closing this for now as this is a usage discussion. Feel free to reopen @EfremCarnate if you want more advice.

mfherbst avatar Oct 04 '22 06:10 mfherbst