pwdft
0.1
PW-DFT code for education
|
Go to the documentation of this file.
28 & electron_maxstep !< Max number of iteration
30 & mixing_beta, & !< Mixing for SCF
31 & conv_thr !< Convergence threshold [Htr]
41 integer :: istep, jstep
43 real(8) :: alpha, res, &
44 & Fvec0(g_rh%nr), dVks(g_rh%nr), Fvec(g_rh%nr), dFvec(g_rh%nr), &
45 & jacob1(g_rh%nr,2:electron_maxstep), jacob2(g_rh%nr,2:electron_maxstep)
51 write(*,*)
" Iteration ", istep
55 res = sqrt(dot_product(fvec(1:
g_rh%nr), fvec(1:
g_rh%nr))) / dble(
g_rh%nr)
56 write(*,*)
" delta Vks [eV] : ", res *
htr2ev
66 do jstep = 2, istep - 1
67 alpha = dot_product(jacob2(1:
g_rh%nr,jstep), dfvec(1:
g_rh%nr))
68 jacob1(1:
g_rh%nr,istep) = jacob1(1:
g_rh%nr,istep) - jacob1(1:
g_rh%nr,jstep) * alpha
71 alpha = dot_product(dfvec(1:
g_rh%nr), dfvec(1:
g_rh%nr))
72 jacob2(1:
g_rh%nr,istep) = dfvec(1:
g_rh%nr) / alpha
80 alpha = dot_product(jacob2(1:
g_rh%nr,jstep), fvec(1:
g_rh%nr))
81 dvks(1:
g_rh%nr) = dvks(1:
g_rh%nr) - jacob1(1:
g_rh%nr,jstep) * alpha
90 write(*,
'(/,7x,"Not converged ! res = ",e12.5,/)') res
92 write(*,
'(/,7x,"Converged ! iter = ",i0,/)') istep
108 logical,
intent(in) :: linit
109 real(8),
intent(out) :: Fvec(g_rh%nr)
111 integer :: ik, istep, avestep
123 avestep = avestep + istep
127 write(*,*)
" Average LOBPCG steps : ", avestep /
nk
134 fvec(1:g_rh%nr) =
vps(1:g_rh%nr)
138 fvec(1:g_rh%nr) = fvec(1:g_rh%nr) -
vks(1:g_rh%nr)
141 fvec(1:g_rh%nr) = 0.0d0
153 complex(8),
intent(out) :: psi(g_wf%npw,nbnd)
155 integer :: ibnd, nseed
157 real(8) :: rpsi(g_wf%npw,nbnd), ipsi(g_wf%npw,nbnd), norm
159 call random_seed(size=nseed)
161 call random_seed(put=seed)
162 call random_number(rpsi)
163 call random_number(ipsi)
165 psi(1:g_wf%npw,1:nbnd) = cmplx(rpsi(1:g_wf%npw,1:nbnd), &
166 & ipsi(1:g_wf%npw,1:nbnd), 8)
169 norm = sqrt(dble(dot_product(psi(1:g_wf%npw,ibnd), psi(1:g_wf%npw,ibnd))))
170 psi(1:g_wf%npw,ibnd) = psi(1:g_wf%npw,ibnd) / norm
character(256), save calculation
Calculation mode.
subroutine xc_pot(Vloc)
Add XC potential (LDA)
complex(8), dimension(:,:,:), allocatable, save evec
(g_wfnpw,nbnd,nk) Kohn-Sham eigenvector (orbital)
real(8), dimension(:), allocatable vps
(g_rhnr) Pseudopotential [Htr]
real(8), save mixing_beta
Mixing for SCF.
integer, save nbnd
Number of bands.
subroutine initialize_wf(psi)
Initialize wave function with random number.
real(8), dimension(:,:), allocatable, save eval
(nbnd,nk) Kohn-Sham eigenvalue (energy)
real(8), dimension(:), allocatable vks
(g_rhnr) Kohn-Sham potential [Htr]
integer, save electron_maxstep
Max number of iteration.
real(8), parameter htr2ev
subroutine hartree_pot(Vloc)
Add Hartree potential.
real(8), save conv_thr
Convergence threshold [Htr].
subroutine lobpcg_main(npw, kvec, evec, eval, istep)
real(8), dimension(:,:), allocatable, save kvec
subroutine kohn_sham_eq(linit, Fvec)
subroutine direct(npw, kvec, evec, eval)