The Elk Code
rhocoreu.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2019 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 rhocoreu
7 use modmain
8 use modulr
9 use modomp
10 implicit none
11 ! local variables
12 integer is,ias,ir,i,nthd
13 integer nrc,nrci,irc,npc
14 real(8) t1
15 ! allocatable arrays
16 real(8), allocatable :: rfmt(:,:)
17 ! generate the core density in spherical coordinates
18 allocate(rfmt(npcmtmax,natmtot))
19 do ias=1,natmtot
20  is=idxis(ias)
21  nrc=nrcmt(is)
22  nrci=nrcmti(is)
23  ir=1
24  i=1
25  do irc=1,nrci
26  t1=rhocr(ir,ias,1)*y00
27  rfmt(i:i+lmmaxi-1,ias)=t1
28  ir=ir+lradstp
29  i=i+lmmaxi
30  end do
31  do irc=nrci+1,nrc
32  t1=rhocr(ir,ias,1)*y00
33  rfmt(i:i+lmmaxo-1,ias)=t1
34  ir=ir+lradstp
35  i=i+lmmaxo
36  end do
37 end do
38 ! add to the ultra long-range density
39 call holdthd(nqpt,nthd)
40 !$OMP PARALLEL DO DEFAULT(SHARED) &
41 !$OMP PRIVATE(ias,is,npc) &
42 !$OMP SCHEDULE(DYNAMIC) &
43 !$OMP NUM_THREADS(nthd)
44 do ir=1,nqpt
45  do ias=1,natmtot
46  is=idxis(ias)
47  npc=npcmt(is)
48  rhormt(1:npc,ias,ir)=rhormt(1:npc,ias,ir)+rfmt(1:npc,ias)
49  end do
50 end do
51 !$OMP END PARALLEL DO
52 call freethd(nthd)
53 deallocate(rfmt)
54 end subroutine
55 
integer, dimension(maxspecies) npcmt
Definition: modmain.f90:216
integer npcmtmax
Definition: modmain.f90:218
integer lmmaxo
Definition: modmain.f90:205
integer nqpt
Definition: modmain.f90:528
Definition: modomp.f90:6
real(8), dimension(:,:,:), allocatable rhocr
Definition: modmain.f90:935
subroutine rhocoreu
Definition: rhocoreu.f90:7
real(8), dimension(:,:,:), allocatable rhormt
Definition: modulr.f90:52
integer lradstp
Definition: modmain.f90:173
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
integer lmmaxi
Definition: modmain.f90:209
subroutine freethd(nthd)
Definition: modomp.f90:112
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78
integer natmtot
Definition: modmain.f90:40
integer, dimension(maxspecies) nrcmt
Definition: modmain.f90:175
integer, dimension(maxspecies) nrcmti
Definition: modmain.f90:213
Definition: modulr.f90:6
real(8), parameter y00
Definition: modmain.f90:1236