question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite loop in H.fermi_level

See original GitHub issue

In 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:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
zerothicommented, May 19, 2020

Ok, I see now why. I have added a new commit which fixes it 😉

Thanks!

0reactions
pfebrercommented, May 19, 2020

I don’t think this makes sense, it seems complicated and not necessary. You should change the atoms with a charge to control this.

Ah ok, I didn’t know you could do that 👍

How many k-points are you using?

The default, which is just the Gamma point, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite loops with a linked list - Stack Overflow
I'm currently getting an infinite loop in the function. len(struct node *). at the for loop and I'm not sure why. #include <stdio.h> ......
Read more >
What is infinite loop (endless loop)? | Definition from TechTarget
An infinite loop (sometimes called an endless loop) is a piece of coding that lacks a functional exit so that it repeats indefinitely....
Read more >
Infinite loop theory | Flynn Wiki - Fandom
Infinite loop theory theorises the universe operates in a type of closed-loop event in order to avoid contradicting the second law of thermodynamics...
Read more >
Is it possible to detect and stop an infinite loop when ... - Quora
Of course it is possible to detect and stop infinite loops, if you also accept to either end some perfectly valid finite loops...
Read more >
Loop quantum gravity - Wikipedia
It is an attempt to develop a quantum theory of gravity based directly on Einstein's geometric formulation rather than the treatment of gravity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found