File: initoep.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (61 lines) | stat: -rw-r--r-- 1,553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

! Copyright (C) 2018 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine initoep
use modmain
implicit none
! local variables
integer ist,ic,m
integer is,ia,ias
integer xctype_(3)
! allocatable arrays
real(8), allocatable :: rfmt(:)
! external functions
real(8) rfint
external rfint
! find maximum core states over all species
ncrmax=0
do is=1,nspecies
  do ia=1,natoms(is)
    ic=0
    do ist=1,nstsp(is)
      if (spcore(ist,is)) then
        do m=-ksp(ist,is),ksp(ist,is)-1
          ic=ic+1
        end do
      end if
    end do
    ncrmax=max(ncrmax,ic)
  end do
end do
! allocate the exchange potential and magnetic field
if (allocated(vxmt)) deallocate(vxmt)
allocate(vxmt(npcmtmax,natmtot))
if (allocated(vxir)) deallocate(vxir)
allocate(vxir(ngtot))
if (spinpol) then
  if (allocated(bxmt)) deallocate(bxmt)
  allocate(bxmt(npcmtmax,natmtot,ndmag))
  if (allocated(bxir)) deallocate(bxir)
  allocate(bxir(ngtot,ndmag))
end if
! initialise the exchange potential to LDA
xctype_(1)=3
xctype_(2:)=0
call potxc(.true.,xctype_,rhomt,rhoir,magmt,magir,taumt,tauir,exmt,exir,ecmt, &
 ecir,vxcmt,vxcir,bxcmt,bxcir,wxcmt,wxcir)
allocate(rfmt(npcmtmax))
do ias=1,natmtot
  is=idxis(ias)
  call rfmtftoc(nrmt(is),nrmti(is),vxcmt(:,ias),rfmt)
  call rbsht(nrcmt(is),nrcmti(is),rfmt,vxmt(:,ias))
end do
deallocate(rfmt)
vxir(:)=vxcir(:)
! determine the constant part of V_xc
vxc0=rfint(vxcmt,vxcir)/omega
return
end subroutine