The Elk Code
potxc.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
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: potxc
8 ! !INTERFACE:
9 subroutine potxc(tsh,xctype_,rhomt_,rhoir_,magmt_,magir_,taumt_,tauir_,exmt_, &
10  exir_,ecmt_,ecir_,vxcmt_,vxcir_,bxcmt_,bxcir_,wxcmt_,wxcir_)
11 ! !USES:
12 use modmain
13 use modomp
14 ! !DESCRIPTION:
15 ! Computes the exchange-correlation potential and energy density. In the
16 ! muffin-tin, the density is transformed from spherical harmonic coefficients
17 ! $\rho_{lm}$ to spherical coordinates $(\theta,\phi)$ with a backward
18 ! spherical harmonic transformation (SHT). Once calculated, the
19 ! exchange-correlation potential and energy density are transformed with a
20 ! forward SHT.
21 !
22 ! !REVISION HISTORY:
23 ! Created April 2003 (JKD)
24 !EOP
25 !BOC
26 implicit none
27 ! arguments
28 logical, intent(in) :: tsh
29 integer, intent(in) :: xctype_(3)
30 real(8), intent(in) :: rhomt_(npmtmax,natmtot),rhoir_(ngtot)
31 real(8), intent(in) :: magmt_(npmtmax,natmtot,ndmag),magir_(ngtot,ndmag)
32 real(8), intent(in) :: taumt_(npmtmax,natmtot,nspinor),tauir_(ngtot,nspinor)
33 real(8), intent(out) :: exmt_(npmtmax,natmtot),exir_(ngtot)
34 real(8), intent(out) :: ecmt_(npmtmax,natmtot),ecir_(ngtot)
35 real(8), intent(out) :: vxcmt_(npmtmax,natmtot),vxcir_(ngtot)
36 real(8), intent(out) :: bxcmt_(npmtmax,natmtot,ndmag),bxcir_(ngtot,ndmag)
37 real(8), intent(out) :: wxcmt_(npmtmax,natmtot),wxcir_(ngtot)
38 ! local variables
39 integer ias,nthd
40 call holdthd(natmtot+1,nthd)
41 !$OMP PARALLEL DEFAULT(SHARED) &
42 !$OMP NUM_THREADS(nthd)
43 ! muffin-tin exchange-correlation potential, field and energy density
44 !$OMP DO SCHEDULE(DYNAMIC)
45 do ias=1,natmtot
46  call potxcmt(tsh,ias,xctype_,rhomt_,magmt_,taumt_,exmt_,ecmt_,vxcmt_,bxcmt_, &
47  wxcmt_)
48 end do
49 !$OMP END DO NOWAIT
50 ! interstitial exchange-correlation potential, field and energy density
51 !$OMP SINGLE
52 call potxcir(xctype_,rhoir_,magir_,tauir_,exir_,ecir_,vxcir_,bxcir_,wxcir_)
53 !$OMP END SINGLE
54 ! symmetrise the muffin-tin exchange-correlation potentials and magnetic fields
55 if (tsh) then
56 !$OMP SECTIONS
57 !$OMP SECTION
58  call symrfmt(nrmt,nrmti,npmt,npmtmax,vxcmt_)
59 !$OMP SECTION
60  if (spinpol) call symrvfmt(.true.,ncmag,nrmt,nrmti,npmt,npmtmax,bxcmt_)
61 !$OMP END SECTIONS
62 end if
63 !$OMP END PARALLEL
64 call freethd(nthd)
65 end subroutine
66 !EOC
67 
subroutine symrfmt(nrmt_, nrmti_, npmt_, ld, rfmt)
Definition: symrfmt.f90:7
logical spinpol
Definition: modmain.f90:228
subroutine symrvfmt(tspin, tnc, nrmt_, nrmti_, npmt_, ld, rvfmt)
Definition: symrvfmt.f90:7
integer, dimension(maxspecies) npmt
Definition: modmain.f90:213
Definition: modomp.f90:6
subroutine potxc(tsh, xctype_, rhomt_, rhoir_, magmt_, magir_, taumt_, tauir_, exmt_, exir_, ecmt_, ecir_, vxcmt_, vxcir_, bxcmt_, bxcir_, wxcmt_, wxcir_)
Definition: potxc.f90:11
subroutine freethd(nthd)
Definition: modomp.f90:106
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78
subroutine potxcmt(tsh, ias, xctype_, rhomt_, magmt_, taumt_, exmt_, ecmt_, vxcmt_, bxcmt_, wxcmt_)
Definition: potxcmt.f90:8
logical ncmag
Definition: modmain.f90:240
subroutine potxcir(xctype_, rhoir_, magir_, tauir_, exir_, ecir_, vxcir_, bxcir_, wxcir_)
Definition: potxcir.f90:8
integer, dimension(maxspecies) nrmti
Definition: modmain.f90:211
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150