Code for computing band energies and normalising: adapted from CEFT.