The Elk Code
 
Loading...
Searching...
No Matches
phscdvs.f90
Go to the documentation of this file.
1
2! Copyright (C) 2008 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
6subroutine phscdvs(p,vsmt0,vsir0)
7use modmain
8use modphonon
9implicit none
10! arguments
11integer, intent(in) :: p
12real(8), intent(in) :: vsmt0(npmtmax,natmtot),vsir0(ngtot)
13! local variables
14integer is,ia,ja,ias,jas
15integer nr,nri,np,i
16integer iv(3),ig0,ifg0,ifg
17real(8) vl(3),vc(3),t1
18complex(8) z0,z1,z2
19! allocatable arrays
20real(8), allocatable :: rfmt(:)
21complex(8), allocatable :: zfmt(:),zfir(:)
22! prefactor
23z0=1.d0/deltaph
24! multiply by i for sin-like displacement
25if (p == 1) z0=z0*zi
26!------------------------------!
27! muffin-tin potential !
28!------------------------------!
29allocate(rfmt(npmtmax),zfmt(npmtmax))
30z1=z0/dble(nscph)
31ias=0
32jas=0
33do is=1,nspecies
34 nr=nrmt(is)
35 nri=nrmti(is)
36 np=npmt(is)
37 ja=0
38 do ia=1,natoms0(is)
39 ias=ias+1
40 do i=1,nscph
41 ja=ja+1
42 jas=jas+1
43! compute the difference between the perturbed and unperturbed potentials
44 rfmt(1:np)=vsmt(1:np,jas)-vsmt0(1:np,jas)
45! convert real potential difference to a complex spherical harmonic expansion
46 call rtozfmt(nr,nri,rfmt,zfmt)
47! the muffin-tin potential should have an *explicit* phase exp(iq.r)
48 t1=-dot_product(vqc(:,iqph),vscph(:,i))
49 z2=z1*cmplx(cos(t1),sin(t1),8)
50! add to total
51 dvsmt(1:np,ias)=dvsmt(1:np,ias)+z2*zfmt(1:np)
52 end do
53! end loop over atoms and species
54 end do
55end do
56deallocate(rfmt,zfmt)
57!--------------------------------!
58! interstitial potential !
59!--------------------------------!
60! Fourier transform interstitial potential derivative to G-space
61allocate(zfir(ngtot))
62zfir(1:ngtot)=z0*(vsir(1:ngtot)-vsir0(1:ngtot))
63call zfftifc(3,ngridg,-1,zfir)
64! convert to G+q-space
65do ig0=1,ngtot0
66 ifg0=igfft0(ig0)
67 vl(1:3)=dble(ivg0(1:3,ig0))+vql(1:3,iqph)
68 call r3mv(bvec0,vl,vc)
69 call r3mv(binv,vc,vl)
70 iv(1:3)=nint(vl(1:3))
71 if ((iv(1) >= intgv(1,1)).and.(iv(1) <= intgv(2,1)).and. &
72 (iv(2) >= intgv(1,2)).and.(iv(2) <= intgv(2,2)).and. &
73 (iv(3) >= intgv(1,3)).and.(iv(3) <= intgv(2,3))) then
74 ifg=igfft(ivgig(iv(1),iv(2),iv(3)))
75 dvsir(ifg0)=dvsir(ifg0)+zfir(ifg)
76 else
77 dvsir(ifg0)=0.d0
78 end if
79end do
80! Fourier transform back to real-space
81if (p == 1) call zfftifc(3,ngridg0,1,dvsir)
82deallocate(zfir)
83end subroutine
84
integer, dimension(maxspecies) nrmti
Definition modmain.f90:211
integer, dimension(:,:), allocatable ivg0
Definition modmain.f90:400
integer, dimension(2, 3) intgv
Definition modmain.f90:394
integer, dimension(3) ngridg
Definition modmain.f90:386
integer, dimension(maxspecies) nrmt
Definition modmain.f90:150
complex(8), parameter zi
Definition modmain.f90:1239
real(8), dimension(3, 3) binv
Definition modmain.f90:18
real(8), dimension(3, 3) bvec0
Definition modmain.f90:16
real(8), dimension(:,:), allocatable vqc
Definition modmain.f90:547
real(8), dimension(:,:), allocatable vql
Definition modmain.f90:545
integer ngtot0
Definition modmain.f90:390
integer, dimension(:), allocatable igfft
Definition modmain.f90:406
real(8), dimension(:,:), pointer, contiguous vsmt
Definition modmain.f90:649
integer, dimension(3) ngridg0
Definition modmain.f90:386
integer, dimension(maxspecies) npmt
Definition modmain.f90:213
integer, dimension(maxspecies) natoms0
Definition modmain.f90:36
real(8), dimension(:), allocatable vsir
Definition modmain.f90:651
integer nspecies
Definition modmain.f90:34
integer, dimension(:,:,:), allocatable ivgig
Definition modmain.f90:402
integer, dimension(:), allocatable igfft0
Definition modmain.f90:406
complex(8), dimension(:), allocatable dvsir
complex(8), dimension(:,:), pointer, contiguous dvsmt
integer iqph
Definition modphonon.f90:15
real(8), dimension(:,:), allocatable vscph
Definition modphonon.f90:46
integer nscph
Definition modphonon.f90:44
real(8) deltaph
Definition modphonon.f90:48
subroutine phscdvs(p, vsmt0, vsir0)
Definition phscdvs.f90:7
pure subroutine r3mv(a, x, y)
Definition r3mv.f90:10
pure subroutine rtozfmt(nr, nri, rfmt, zfmt)
Definition rtozfmt.f90:7
subroutine zfftifc(nd, n, sgn, z)