The Elk Code
energycore.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 Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 subroutine energycore
7 use modmain
8 implicit none
9 ! local variables
10 integer ist,is,ias,nr,nri
11 real(8) sm
12 ! automatic arrays
13 real(8) vr(nrmtmax),fr(nrmtmax)
14 ! zero the sum of core eigenvalues
15 evalsmc=0.d0
16 ! zero the core Kohn-Sham potential energy
17 engyvsc=0.d0
18 sm=0.d0
19 do ias=1,natmtot
20  is=idxis(ias)
21  nr=nrmt(is)
22  nri=nrmti(is)
23 ! add to sum of core eigenvalues
24  do ist=1,nstsp(is)
25  if (spcore(ist,is)) evalsmc=evalsmc+occcr(ist,ias)*evalcr(ist,ias)
26  end do
27 ! extract the l = m = 0 part of the Kohn-Sham potential
28  call rfmtlm(1,nr,nri,vsmt(:,ias),vr)
29 ! multiply by core density and integrate
30  if (spincore) then
31 ! spin-polarised core
32  fr(1:nr)=rhocr(1:nr,ias,1)+rhocr(1:nr,ias,2)
33  engyvsc=engyvsc+sum(fr(1:nr)*vr(1:nr)*wr2mt(1:nr,is))
34  else
35 ! spin-unpolarised core
36  engyvsc=engyvsc+sum(rhocr(1:nr,ias,1)*vr(1:nr)*wr2mt(1:nr,is))
37  end if
38 ! frozen core case
39  if (frzncore) sm=sm+sum(rhocr(1:nr,ias,1)*vrsp(1:nr,is)*wr2mt(1:nr,is))
40 end do
41 ! core electron kinetic energy
43 end subroutine
44 
real(8) evalsmc
Definition: modmain.f90:947
real(8), dimension(:,:), allocatable occcr
Definition: modmain.f90:929
real(8), dimension(:,:), allocatable evalcr
Definition: modmain.f90:931
real(8), dimension(:,:,:), allocatable rhocr
Definition: modmain.f90:935
logical, dimension(maxstsp, maxspecies) spcore
Definition: modmain.f90:127
pure subroutine rfmtlm(lm, nr, nri, rfmt, fr)
Definition: rfmtlm.f90:10
subroutine energycore
Definition: energycore.f90:7
logical frzncore
Definition: modmain.f90:939
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
real(8) engyknc
Definition: modmain.f90:955
real(8) engyvsc
Definition: modmain.f90:951
integer, dimension(maxspecies) nstsp
Definition: modmain.f90:113
integer natmtot
Definition: modmain.f90:40
real(8), dimension(:,:), allocatable vrsp
Definition: modmain.f90:139
real(8), dimension(:,:), pointer, contiguous vsmt
Definition: modmain.f90:652
integer, dimension(maxspecies) nrmti
Definition: modmain.f90:213
real(8), parameter y00
Definition: modmain.f90:1236
logical spincore
Definition: modmain.f90:937
real(8), dimension(:,:), allocatable wr2mt
Definition: modmain.f90:185
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150