The purpose of the present study is twofold. First, the techniques of correlated wave functions for two-electron systems have been extended to obtain results for P and D states in a screening environment, and in particular for Debye screening. In these calculations, the satisfaction of both the quantum virial theorem and a related sum rule has been enforced and found to provide a high degree of stability of the solutions. Second, in order to facilitate the general use of correlated wave functions in combination with sum rule stability criteria, a rather systematic computational approach to this notoriously cumbersome method has been developed and thoroughly discussed here. Accurate calculations for few-electron systems are of interest to plasma diagnostics; in particular, when inaccuracies in binding energies are drastically magnified as they occur in exponents of Boltzmann factors.