Hartree and exchange energy in populated semiconductor quantum wells