2 ! Copyright (C) 2007 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
7 ! minimises the total energy w.r.t. evecsv using steepest descent
12 ! parameter to check energy convergence
13 real(8), parameter :: eps
=1.d
-10
15 complex(8), allocatable
:: evecfv(:,:)
16 complex(8), allocatable
:: evecsv(:,:)
18 allocate(evecfv(nmatmax
,nstfv
))
19 allocate(evecsv(nstsv
,nstsv
))
22 open(61,file
='RDMC_ENERGY.OUT',action
='WRITE',form
='FORMATTED')
24 open(62,file
='RDMC_MOMENT.OUT',action
='WRITE',form
='FORMATTED')
27 ! begin iteration loop
29 write(*,'("Info(rdmminc): iteration ",I4," of ",I4)') it
,maxitc
30 ! vary evecsv and orthogonalise it
35 ! zero the magnetisation
41 ! get the eigenvectors and values from file
42 call getevecfv(vkl(1,ik
),vgkl(1,1,ik
,1),evecfv
)
43 call getevecsv(vkl(1,ik
),evecsv
)
44 ! calculate the density
45 call rhovalk(ik
,evecfv
,evecsv
)
47 ! symmetrise the density
48 call symrf(lradstp
,rhomt
,rhoir
)
49 ! convert the muffin-tin density from coarse to a fine grid
52 ! symmetrise the magnetisation
53 call symrvf(lradstp
,magmt
,magir
)
54 ! convert the magnetisation from a coarse to a fine radial mesh
56 call rfmtctof(magmt(1,1,1,idm
))
59 ! add core density to the valence density
61 ! calculate the charges
63 ! calculate the magnetic moment
66 write(62,'(I6,3G18.10)') it
,momtot(1:ndmag
)
69 ! normalise the density
71 ! calculate the Coulomb potential
73 ! calculate Coulomb matrix elements
74 call genvmat(vclmt
,vclir
,vclmat
)
75 ! calculate derivative of kinetic energy w.r.t. evecsv
77 ! calculate the energy
79 ! check for convergence of derivative of energy w.r.t. evecsv
84 ! write energy and convergence factor to a file
85 write(61,'(I6,2G18.10)') it
,engytot
,ds
91 deallocate(evecfv
,evecsv
)