The Elk Code
gentaucr.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2011 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 subroutine gentaucr
7 use modmain
8 use modomp
9 implicit none
10 ! local variables
11 integer ist,ispn,jspn
12 integer is,ia,ias,nthd
13 integer nr,nri,np,i,j,m
14 ! allocatable arrays
15 complex(4), allocatable :: wfcr(:,:)
16 complex(8), allocatable :: zfmt(:),gzfmt(:,:)
17 taucr(1:npmtmax,1:natmtot,1:nspinor)=0.d0
18 call holdthd(natmtot,nthd)
19 !$OMP PARALLEL DEFAULT(SHARED) &
20 !$OMP PRIVATE(wfcr,zfmt,gzfmt) &
21 !$OMP PRIVATE(is,ia,nr,nri,np) &
22 !$OMP PRIVATE(ist,m,ispn,jspn,i,j) &
23 !$OMP NUM_THREADS(nthd)
24 allocate(wfcr(npmtmax,2),zfmt(npmtmax),gzfmt(npmtmax,3))
25 !$OMP DO SCHEDULE(DYNAMIC)
26 do ias=1,natmtot
27  is=idxis(ias)
28  ia=idxia(ias)
29  nr=nrmt(is)
30  nri=nrmti(is)
31  np=npmt(is)
32  do ist=1,nstsp(is)
33  if (spcore(ist,is)) then
34  do m=-ksp(ist,is),ksp(ist,is)-1
35 ! generate the core wavefunction in spherical harmonics (pass in m-1/2)
36  call wavefcr(.true.,1,is,ia,ist,m,npmtmax,wfcr)
37  do ispn=1,2
38  jspn=merge(ispn,1,spinpol)
39 ! compute the gradient of the wavefunction
40  zfmt(1:np)=wfcr(1:np,ispn)
41  call gradzfmt(nr,nri,rlmt(:,-1,is),wcrmt(:,:,is),zfmt,npmtmax,gzfmt)
42  do i=1,3
43 ! convert gradient to spherical coordinates
44  call zbsht(nr,nri,gzfmt(:,i),zfmt)
45 ! add to total in muffin-tin
46  do j=1,np
47  taucr(j,ias,jspn)=taucr(j,ias,jspn) &
48  +0.5d0*(zfmt(j)%re**2+zfmt(j)%im**2)
49  end do
50  end do
51  end do
52  end do
53  end if
54  end do
55 ! convert core tau to spherical harmonics
56  do ispn=1,nspinor
57  call rfshtip(nr,nri,taucr(:,ias,ispn))
58  end do
59 end do
60 !$OMP END DO
61 deallocate(wfcr,zfmt,gzfmt)
62 !$OMP END PARALLEL
63 call freethd(nthd)
64 end subroutine
65 
integer, dimension(maxstsp, maxspecies) ksp
Definition: modmain.f90:125
logical spinpol
Definition: modmain.f90:230
real(8), dimension(:,:,:), allocatable rlmt
Definition: modmain.f90:181
integer, dimension(maxspecies) npmt
Definition: modmain.f90:215
Definition: modomp.f90:6
subroutine gradzfmt(nr, nri, ri, wcr, zfmt, ld, gzfmt)
Definition: gradzfmt.f90:10
logical, dimension(maxstsp, maxspecies) spcore
Definition: modmain.f90:127
real(8), dimension(:,:,:), allocatable taucr
Definition: modmain.f90:677
subroutine rfshtip(nr, nri, rfmt)
Definition: rfshtip.f90:7
pure subroutine wavefcr(tsh, lrstp, is, ia, ist, m, ld, wfcr)
Definition: wavefcr.f90:7
integer nspinor
Definition: modmain.f90:269
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
subroutine zbsht(nr, nri, zfmt1, zfmt2)
Definition: zbsht.f90:10
subroutine freethd(nthd)
Definition: modomp.f90:112
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78
integer, dimension(maxatoms *maxspecies) idxia
Definition: modmain.f90:45
integer, dimension(maxspecies) nstsp
Definition: modmain.f90:113
integer npmtmax
Definition: modmain.f90:218
integer natmtot
Definition: modmain.f90:40
real(8), dimension(:,:,:), allocatable wcrmt
Definition: modmain.f90:189
integer, dimension(maxspecies) nrmti
Definition: modmain.f90:213
subroutine gentaucr
Definition: gentaucr.f90:7
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150