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

Allow for convergence towards a total number of electrons #44

Open sofiasanz opened 4 years ago

sofiasanz commented 4 years ago

Allow iterative3 method for either 1) convergence towards a total number of electrons, and 2) towards a user-defined spin-configuration in open-systems.

zerothi commented 4 years ago

I think you should do this like I do in fermi_level i.e. pass q as a float or a list of floats. If only one value is passed, it is the total number, otherwise it is per-spin.

In fact this is something I think would be generally favourable in the implementation. Instead of doing n_up=A, n_dn=B one could do q=[A, B] and fail if the list does not have length 2.

tfrederiksen commented 4 years ago

Sounds like a good idea with q=q_tot or q=[q_up, q_dn] as acceptable inputs.