The Elk Code
rdmminn.f90
Go to the documentation of this file.
1
2
! Copyright (C) 2007-2008 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.
5
6
!BOP
7
! !ROUTINE: rdmminn
8
! !INTERFACE:
9
subroutine
rdmminn
10
! !USES:
11
use
modmain
12
use
modrdm
13
use
modmpi
14
! !DESCRIPTION:
15
! Minimizes the total energy w.r.t. occupation numbers. The steepest-descent
16
! algorithm is used.
17
!
18
! !REVISION HISTORY:
19
! Created 2008 (Sharma)
20
!EOP
21
!BOC
22
implicit none
23
! local variables
24
integer
it,n
25
if
(
maxitn
< 1)
return
26
! write the Coulomb matrix elements to file
27
call
writevcl1221
28
! calculate derivative of kinetic energy w.r.t. evecsv
29
call
rdmdkdc
30
! begin iteration loop
31
do
it=1,
maxitn
32
if
(
mp_mpi
)
then
33
if
(mod(it,10) == 0)
then
34
write
(*,
'("Info(rdmminn): iteration ",I4," of ",I4)'
) it,
maxitn
35
end if
36
end if
37
! generate the density and magnetisation
38
call
rhomag
39
! calculate the Coulomb potential
40
call
potcoul
41
! calculate Coulomb potential matrix elements
42
call
genvmat
(
vclmt
,
vclir
,
vclmat
)
43
! update occupation numbers and write to file (MPI master process only)
44
if
(
mp_mpi
)
call
rdmvaryn
45
! broadcast occupation numbers to all other processes
46
n=
nstsv
*
nkpt
47
call
mpi_bcast(
occsv
,n,mpi_double_precision,0,
mpicom
,
ierror
)
48
! calculate the energy
49
call
rdmenergy
50
! write energy to file
51
if
(
mp_mpi
)
then
52
write
(61,
'(I6,G18.10)'
) it,
engytot
53
flush
(61)
54
end if
55
! end iteration loop
56
end do
57
if
(
mp_mpi
)
then
58
write
(60,*)
59
write
(60,
'("Occupation number minimisation done")'
)
60
write
(61,*)
61
if
(
spinpol
)
write
(63,*)
62
end if
63
end subroutine
64
!EOC
65
rdmminn
subroutine rdmminn
Definition:
rdmminn.f90:10
modmpi::mp_mpi
logical mp_mpi
Definition:
modmpi.f90:17
modmain::spinpol
logical spinpol
Definition:
modmain.f90:228
modmain::nkpt
integer nkpt
Definition:
modmain.f90:461
modmain::vclmt
real(8), dimension(:,:), allocatable vclmt
Definition:
modmain.f90:624
genvmat
subroutine genvmat(vmt, vir, vmat)
Definition:
genvmat.f90:7
rhomag
subroutine rhomag
Definition:
rhomag.f90:7
modrdm
Definition:
modrdm.f90:6
rdmvaryn
subroutine rdmvaryn
Definition:
rdmvaryn.f90:10
modmain
Definition:
modmain.f90:6
modmain::nstsv
integer nstsv
Definition:
modmain.f90:889
modrdm::maxitn
integer maxitn
Definition:
modrdm.f90:25
writevcl1221
subroutine writevcl1221
Definition:
writevcl1221.f90:10
modmain::engytot
real(8) engytot
Definition:
modmain.f90:983
modmain::occsv
real(8), dimension(:,:), allocatable occsv
Definition:
modmain.f90:905
modmain::vclir
real(8), dimension(:), allocatable vclir
Definition:
modmain.f90:624
rdmdkdc
subroutine rdmdkdc
Definition:
rdmdkdc.f90:10
modmpi
Definition:
modmpi.f90:6
modrdm::vclmat
complex(8), dimension(:,:,:), allocatable vclmat
Definition:
modrdm.f90:13
rdmenergy
subroutine rdmenergy
Definition:
rdmenergy.f90:10
potcoul
subroutine potcoul
Definition:
potcoul.f90:10
modmpi::mpicom
integer mpicom
Definition:
modmpi.f90:11
modmpi::ierror
integer ierror
Definition:
modmpi.f90:19
rdmminn.f90
Generated by
1.8.14