# Notes on screening¶

We have some number of old density matrices *D*_{*k* -
1},*D*_{*k* - 2} etc, and want to write the new density matrix
as

- ..figure:: /dirac/images/math/6/c/8/6c86ef3df163c5e325edbc447abb31d9.png
align: center alt: D_k = \Delta D + \sum_{i=1}^N c_i D_{k-i}, D_k = \Delta D + \sum_{i=1}^N c_i D_{k-i},

where Δ*D* will be sent to `TWOFCK` and should give efficient
screening. Currently we are minimizing the Frobenius norm (sum of
squares of elements) of Δ*D*, using one old density matrix. In the
general case we have to solve *S**c* = *y*, where

*S*_{*i**j*} = (*D*_{*k* - *i*},*D*_{*k* - *j*})
and *y*_{*i*} = (*D*_{*k*},*D*_{*k* - *i*}).

Here “(cdot,\cdot)”(FIX) is the inner product between the *D* “vectors”.
However, the use of the Frobenius norm gives the larges weight to the
large elements of Δ*D*. This is not really what we want, because we care
more about producing as many small elements in Δ*D* as possible.
Therefore we can imagine to introduce a metric matrix *M*, so that

- ..figure:: /dirac/images/math/8/7/7/877cd0b8aba2f7fcefddaa52ff414fdd.png
align: center alt: (A,B) = \sum_{ij} A^*_{ij}M_{ij}B_{ij}, (A,B) = \sum_{ij} A^*_{ij}M_{ij}B_{ij},

and set *M* to emphasize the elements that have a chance of being made
small. In practice one could imagine

- Calculate Δ*D* using a unit (
*M*_{*i**j*}= 1) metric. - Find the largest elements (with some definition of largest) of Δ*D*
and set the corresponding elements in
*M*to zero. - Recalculate
*S*using the new metric. - Solve for the new Δ*D*

Doing this for the water molecule SCF in test 1 shrinks the elements in the final iteration Δ*D* by four orders of magnitude. In this case I used five old density matrices. Just using a large number of old densities without modifying the metric did very little. A simple test inside Dirac shows that it is not enough to use one historical density matrix with a modified metric. The reason is that at the end of the SCF the change in density is almost orthogonal to the last density matrix.

It would also be possible to give larger weight to certain elements of Δ*D*, for example those that come from different integral blocks or centers.