I'm making some theoretical modelling for a system, which is effectively 1d in the sense that it is much longer the wide. This means (like in model for quantized conductance) that the energy bands are parabolas with a spacing equal to the energy difference between the ground state, first excited state, second excited state etc. (see attached figure). Now an input parameter in my script is the number of electrons in the system and from that I wish to calculate the fermi level of the system. This is however giving me some trouble. You can start from the assumption that only the first band is populated. Then calculate fermi level from that and if you find that this level is above where the second band starts I need to correct for this. But this becomes an infinite process, since the correction then needs to be corrected etc. Therefore I ask you people out there. Is there any way, given the total number of electrons for the system, that I could find a closed form expression for the fermi level of the system? Also the input parameter in my script is actually the electron density in the system rather than the total number of electrons. Is there a way to use this rather than the total number of electrons to calculate the fermi level?