Added energy gap calculation!