Skip to content

Commit d21457b

Browse files
authored
subroutine creating rid of structure factors
1 parent 0a29958 commit d21457b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

GetStructureFactors.f90

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
subroutine StructureFactors(positions,numbers,Fhkl)
2+
real , intent(in ) :: positions(:,:)
3+
integer, intent(in ) :: numbers(:)
4+
real , intent(out) :: Fhkl(31,31,31,2)
5+
integer :: h,k,l
6+
complex :: f_hkl
7+
real , parameter :: pi = 3.1415927
8+
complex, parameter :: j = cmplx(0,1)
9+
Fhkl = 0.0
10+
nat = size(positions,dim=1)
11+
do h=-15,15
12+
do k=-15,15
13+
do l=-15,15
14+
f_hkl = dot_product(exp(2.0*j*pi*(h*positions(:,1)+k*positions(:,2)+l*positions(:,3))),numbers)
15+
Fhkl(h+16,k+16,l+16,1) = abs(f_hkl)
16+
Fhkl(h+16,k+16,l+16,2) = atan2(aimag(f_hkl),real(f_hkl))
17+
end do
18+
end do
19+
end do
20+
end subroutine
21+

0 commit comments

Comments
 (0)