DFTK.jl
DFTK.jl copied to clipboard
Add documentation about conducting a convergence study
I was playing with doing a convergence study of a small system, and I remember you mentioned Abinit has a good doc for that, and I thought maybe DFTK should have it too. Feel free to say this isn't good enough to be part of the docs, but I just wanted to share the code :)
Looks very nice, thank you very much @killah-t-cell! And I agree, we should have some docs on this.
Some ideas from a quick look:
- There are a few undefined variables. Be careful that
jlfiles by the docs are interpreted like cells in a jupyter notebook and executed in order. Basically any comment creates a new cell, so that might rip statements apart if you are not careful. Have not checked the details, but as a pointer towards debugging. - It would be nice to show the convergence graphically (i.e. just generate a log-plot of log(error) or
log(value[i+1] - value[i])versus the parameter for Ecut or kgrid. - Since the code is running on the CI, it's probably a good idea to not run all the way up to fully converged Ecut (would take too long). So you sort of have to stop early. Perhaps you can just include a static graph of the convergence plot to the document instead.
I added this type of graph, but I'm not sure how you guys store images for the docs, so this might still be wrong. Happy to change it (Documenter.jl's image settings confuse me haha)
@mfherbst This should be ready for a review
Hi @killah-t-cell thanks for your efforts!
Regarding adding the image to Documenter ... yes that's a bit tricky. Some examples for how we do this are in:
- https://github.com/JuliaMolSim/DFTK.jl/blob/master/docs/src/guide/parallelization.md
- https://github.com/JuliaMolSim/DFTK.jl/blob/master/examples/ase.jl the former probably applies more to your case.
I saw you're just using the assets ... that's of course also fine, probably even better.
Maybe give it a more descriptive name (like include a prefix of the file name of the example)? Also I would make the plots on a semilog scale (i.e. use logscale for the y axis and don't plot energies but energy differences between the different runs (k and k+1 for example)
@killah-t-cell Are you still working on this one? I'd be really glad to have this. Let me know if you need any help.
Hi @killah-t-cell Would you mind if I take over polishing and merging this PR? I would love to have this ready in the docs for our summer school end of August. Of course more than happy if you prefer to do it yourself.
@LaurentVidal95 also wanted to do something like that I think
Hi everyone! Indeed I had the project to do a note about the structures of the code for people in the lab and a tutorial about convergence study (after discussing with @antoine-levitt). However I had trouble not to repeat things already said in other tutorials so the notes I have are for now pretty informal (I did a small notebook). I will adapt considering this PR !
I wrote this during my first week with DFT, so I used optim to find the ideal converging Ecut. This might be a bit of an overkill, given that I can run this more like nkpts and just test 200:50:900 for example.
Hey @mfherbst I don't mind you taking over it at all! Sorry it took so long to do this (I spent a bunch of time learning ASE, GPAW in the past few weeks). Feel free to add anything to this. I answered to your comments, but happy to take this anywhere!
@antoine-levitt I'm running into an error with makedocs. Any chance you know what is going on?
Yes, your diff has a large set of changes that is unrelated to your example, I'm assuming you messed up with git somehow? You should try to merge against master and resolve conflicts, and if that doesn't work just save your example to a file and make another PR in another branch and destroy this one...
oh you know what happened? I pulled from origin/main instead of origin/master... fixing
Superseeded by #701.