An improved version of the direct inversion in the iterative subspace algorithm is developed. The method is significantly more efficient than the previous version, and is applicable to intrinsically divergent or slowly convergent cases. Comparisons indicate that the method is superior to the recently proposed quadratically convergent (QC-SCF) method of Bacskay.The direct inversion in the iterative subspace (DIIS) method, described in a recent communicationl (hereafter referred to as part I), provides a significant acceleration of the SCF convergence rate, particularly toward the end of the SCF procedure when convergence, for reasons discussed in part I, is usually slow. It is important to have accurately converged SCF wavefunctions in a number of applications: for calculating correlation energy surfaces; in gradient programs; and in all cases where a subsequent numerical differentiation is involved, as in finite field methods.The DIIS method can be briefly recapitulated as follows: In each SCF step, construct an error vector ei, where i is the step index. The vanishing of the error vector should be a necessary and sufficient condition for SCF convergence. The construction of a suitable error vector will be discussed later; basically, it is related to the gradient of the electronic energy with respect to the SCF parameters and thus vanishes for the SCF solution. Toward the end of the SCF procedure, changes in the wavefunction are small and it can be assumed that the error vector depends linearly on the parameters p used to characterize the wavefunction. As parameters, it is customary to use the elements of the density matrix or the Fock matrix, in order to avoid the phase difficulties of the wavefunction.It is then possible to find a linear combination of consecutive parameter vectors p = Eici pi so that the corresponding error vector Z;c; ei approximates the zero vector in the least-squares sense. An interpolation like this violates, of course, the * On leave at the Department of Chemistry, University of Texas at Austin, Austin, Texas 78712.idempotency of the density matrix in second order; however, this becomes insignificant as SCF convergence is approached. In practice, it was found that even interpolation between fairly different Fock matrices gave satisfactory results. As discussed in part I, the least-squares criterion, together with the condition that the coefficients c; add up to 1, leads to a small set of linear equations:where Bi; = (e; I e;) with a suitably defined metric in the e space, and X is a Lagrangian multiplier.In part I, the error vector was defined as the change in the parameter vector in the course of the subsequent SCF step. This worked well in the semiempirical applications for which DIIS was originally developed. Nevertheless, an initial implementation in the ab initio SCF program TEXAS revealed several weaknesses: (1) In the ab initio Roothaan-Hall procedure, the main computational task is the construction of the Fock matrix. In the original algorithm' the determination of the error vec...