Infinite loop in H.fermi_level
See original GitHub issueIn my ignorance, I had a Hamiltonian
and I wanted to calculate its fermi level. I thought, well that’s easy, just H.fermi_level()
. But then my laptop started to heat up and hyperventilate. And I was like, man, this must be an expensive calculation.
However, it was just that the _Ef
function was running infinitely because min_Ef
and max_Ef
were the same. This happened because q
(which I initially thought was the net charge) needs to be set to the number of electrons in the system. Since I was not providing a q, it was taken from my geometry q0 attribute, which was set to 0.
I have two questions:
- If
q
is the number of electrons, does it make sense to check beforehand if the user is asking for something impossible? And specially if it’s 0, assume that is the sum of all atoms Z? - Wouldn’t it be more useful that
q
was the net charge? So that the user does not need to know how many electrons are there in their system.
edit: I realised that what I was proposing does not make sense because you are not taking into consideration all electrons necessarily, sorry. Maybe the check that I proposed in the next comment is useful?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Ok, I see now why. I have added a new commit which fixes it 😉
Thanks!
Ah ok, I didn’t know you could do that 👍
The default, which is just the Gamma point, right?