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: gensfacgp
8! !INTERFACE:
9pure subroutine gensfacgp(ngp,vgpc,ld,sfacgp)
10! !USES:
11use modmain
12! !INPUT/OUTPUT PARAMETERS:
13!   ngp    : number of G+p-vectors (in,integer)
14!   vgpc   : G+p-vectors in Cartesian coordinates (in,real(3,*))
15!   ld     : leading dimension (in,integer)
16!   sfacgp : structure factors of G+p-vectors (out,complex(ld,natmtot))
17! !DESCRIPTION:
18!   Generates the atomic structure factors for a set of ${\bf G+p}$-vectors:
19!   $$ S_{\alpha}({\bf G+p})=\exp(i({\bf G+p})\cdot{\bf r}_{\alpha}), $$
20!   where ${\bf r}_{\alpha}$ is the position of atom $\alpha$.
21!
22! !REVISION HISTORY:
23!   Created January 2003 (JKD)
24!EOP
25!BOC
26implicit none
27! arguments
28integer, intent(in) :: ngp
29real(8), intent(in) :: vgpc(3,ngp)
30integer, intent(in) :: ld
31complex(8), intent(out) :: sfacgp(ld,natmtot)
32! local variables
33integer is,ia,ias,igp
34real(8) v1,v2,v3,t1
35do ias=1,natmtot
36  is=idxis(ias)
37  ia=idxia(ias)
38  v1=atposc(1,ia,is); v2=atposc(2,ia,is); v3=atposc(3,ia,is)
39  do igp=1,ngp
40    t1=vgpc(1,igp)*v1+vgpc(2,igp)*v2+vgpc(3,igp)*v3
41    sfacgp(igp,ias)=cmplx(cos(t1),sin(t1),8)
42  end do
43end do
44end subroutine
45!EOC
46
47