Formulation and Implementation of the Spin-Restricted Ensemble-Referenced Kohn-Sham Method in the Context of the Density Functional Tight Binding Approach.