In principle, we need now only modify getE(), getgrad() and H() to
perform density functional calculations. In order not to destroy your
Schrödinger solver, copy each of the ``.m'' files from ``
/A2'' to a
new directory called ``
/A2a'' where we shall now work. Once this is
done, go to your new directory, rename ``sch.m'' to ``dft.m'', start a
new octave session, and run ``dft.m'' from within octave to confirm
that it behaves just as did ``sch.m''. (Don't forget to run
``setup.m'' first!)
Next, we shall make the appropriate changes to getE(), getgrad() and getH(). Because the minimization algorithm is already debugged, we need first only confirm that we have an appropriate energy and gradient with the finite difference test, and then we are ready for full density-functional calculations!
To prevent proliferation of output as we run these tests, you may wish
to put a ``pause;'' statement immediately after the call to
fdtest() in ``dft.m''. Again, you should run ``dft.m'' one last time
to confirm all is well. Hitting Ctrl-C (and then
enter
if
there is no immediate response) when the program hits the pause
statement will regain the octave prompt.
Tomas Arias 2006-04-26