Debugging

Analogously to debugging for line minimization, the best test of your implementation is the gradient-orthogonality theorem, the ``cg test''. Depending upon the form used for $\beta$, this test will not function well until quite close to the minimum. Thus, begin your testing with the least sensitive version (Hestenes-Stiefel), running it from the wave functions determined by preconditioned line minimization by entering ``Wout=pccg(Wpclm,50,3);'' at the command prompt after having just run your ``dft.m''. You should observe that ``cg test'' gives results which track but are somewhat larger than those of the ``linmin test''. Also, after a number of iterations, the ``cg test'' should become quite good.

Once this test passes, Wout will contain wave functions sufficiently close to the minimum that the other forms for $\beta$ will work well when properly implemented. You may then verify those versions using ``pccg(Wout,10,1);'' and ``pccg(Wout,10,2);''.



Tomas Arias 2007-04-26