First, make a copy of ``
/A3/dft.m'' called ``
/A3/Hatoms.m''.
Then, remove from ``Hatoms.m'' the code block which displays the wave
functions, and replace the code block that relaxes the wave functions
with
format long %# Converge W=sd(W,20); %# 20 iterations of simple sd() to get nearer to the minimum W=W*inv(sqrtm(W'*O(W))); %# Restart as orthonormal functions [W, Elist]=pccg(W,50,1); %# 50 iterations of pclm from same WAt this point, you may wish to rerun ``setup.m'' and ``Hatoms.m'' to verify that the code functions properly as before.
Next, delete the computation of V and Vdual in ``Hatoms.m'', and replace it with the following. First, compute the ionic potential in Fourier space as
%# H atoms Vps=-4*pi*Z./G2; Vps(1)=0.;Note that this code is careful to set the infinite
Vdual=cJ(Vps.*Sf);Finally, be sure to store the result in gbl_Vdual for communication to the various functions.