The Elk Code
potefieldu.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2019 T. Mueller, 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 potefieldu
7 use modmain
8 use modulr
9 implicit none
10 ! local variables
11 integer ir
12 real(8) v0,v(3)
13 ! allocatable arrays
14 real(8), allocatable :: rfft(:)
15 if (sum(abs(efieldcu(:))) < epslat) return
16 allocate(rfft(nqpt))
17 ! constant added to potential so that it is zero at the ultracell center
18 v(:)=0.5d0*(avecu(:,1)+avecu(:,2)+avecu(:,3))
19 v0=dot_product(efieldcu(:),v(:))
20 ! calculate the potential in real-space
21 do ir=1,nqpt
22  rfft(ir)=v0-dot_product(efieldcu(:),vrcu(:,ir))
23 end do
24 ! Fourier transform to Q-space
25 call rzfftifc(3,ngridq,-1,rfft,vclq)
26 deallocate(rfft)
27 end subroutine
28 
integer nqpt
Definition: modmain.f90:525
real(8), dimension(3) efieldcu
Definition: modulr.f90:77
complex(8), dimension(:), allocatable vclq
Definition: modulr.f90:66
real(8), dimension(3, 3) avecu
Definition: modulr.f90:12
integer, dimension(3) ngridq
Definition: modmain.f90:515
real(8) epslat
Definition: modmain.f90:24
real(8), dimension(:,:), allocatable vrcu
Definition: modulr.f90:26
subroutine rzfftifc(nd, n, sgn, r, z)
subroutine potefieldu
Definition: potefieldu.f90:7
Definition: modulr.f90:6