Electronic structure of large systems: Coping with small gaps using the energy renormalization group method