dipc-cc / hubbard

Python tools for mean-field Hubbard models
https://dipc-cc.github.io/hubbard/
GNU Lesser General Public License v3.0
21 stars 8 forks source link

enh: enabled usage of pulay mixing from sisl #53

Closed zerothi closed 4 years ago

zerothi commented 4 years ago

Now there is a basic implementation allowing Pulay mixing. And indeed MANY iterations are saved.

This requires the latest sisl commit to function.

I have updated all codes in examples/* and checked that they indeed improve efficiency. I have however not checked all, so perhaps the parameters needs changing for some of the examples. Please consider double checking them.

Also, I have changed the convergence criteria. Previously it was like this:

dn = np.absolute(self.dm - ni).sum()

however, generally in DFT one does:

dn = np.absolute(self.dm - ni).max()

The reason is that using sum, one will have a factor of # of elements meaning that for large systems the criteria will be stricter than for smaller systems. Instead one typically looks at the largest change in any element. This will also require you to go through the examples and check tolerances etc. And probably also the defaults in .converge. Note that 1e-10 is extremely low and for Siesta the typical convergence criteria is of the order 1e-4 -- 1e-5. So you could probably do with 1e-6. For an orthogonal basis this is equivalent to 1e-6 charge difference.

zerothi commented 4 years ago

As for your premix implementations, this could be handled by creating a wrapper function with two mixers, so currently it requires some manual labour, but I have this on the drawing board for sisl (but don't hold your breath ;))

sofiasanz commented 4 years ago

Hi Nick! Thank you very much for the pull request. I was actually taking a look on the new commit of sisl where you have implemented the Pulay mixing scheme, very cool!

I didn't realize on this issue of the scaling of dn with the system's size, so thank you for that also :-)

I will check the examples and test files, see if they work correctly and merge this commit :-)

tfrederiksen commented 4 years ago

Looks great! I just fixed a few things related the simple test scripts. Sofia, please merge when you think everything is consistent.

tfrederiksen commented 4 years ago

By the way, this branch fixes #20.