Smearing scheme for finite-temperature electronic-structure calculations