Multiscale theory of valley splitting in the conduction band of a quantum well