The Elk Code
proj2d.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2014 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 proj2d(np,fp)
7 use modmain
8 implicit none
9 ! arguments
10 integer, intent(in) :: np
11 real(8), intent(inout) :: fp(np,3)
12 ! local variables
13 integer i
14 real(8) vl1(3),vl2(3),t1,t2,t3
15 real(8) vc1(3),vc2(3),vc3(3),vc4(3)
16 ! determine the 2D plotting plane vectors in Cartesian coordinates
17 vl1(:)=vclp2d(:,1)-vclp2d(:,0)
18 vl2(:)=vclp2d(:,2)-vclp2d(:,0)
19 call r3mv(avec,vl1,vc1)
20 call r3mv(avec,vl2,vc2)
21 ! the z axis is orthogonal to the plotting plane vectors
22 call r3cross(vc1,vc2,vc3)
23 t1=sqrt(vc1(1)**2+vc1(2)**2+vc1(3)**2)
24 t2=sqrt(vc2(1)**2+vc2(2)**2+vc2(3)**2)
25 t3=sqrt(vc3(1)**2+vc3(2)**2+vc3(3)**2)
26 if ((t1 < epslat).or.(t2 < epslat).or.(t3 < epslat)) then
27  write(*,*)
28  write(*,'("Error(proj2d): degenerate 2D plotting directions")')
29  write(*,*)
30  stop
31 end if
32 ! normalise the x and z axes
33 vc1(:)=vc1(:)/t1
34 vc3(:)=vc3(:)/t3
35 ! create new y axis orthogonal to x and z axes
36 call r3cross(vc3,vc1,vc2)
37 t1=sqrt(vc2(1)**2+vc2(2)**2+vc2(3)**2)
38 vc2(:)=vc2(:)/t1
39 ! project the vector function onto the orthogonalised plotting plane axes
40 do i=1,np
41  vc4(:)=fp(i,:)
42  fp(i,1)=dot_product(vc4(:),vc1(:))
43  fp(i,2)=dot_product(vc4(:),vc2(:))
44  fp(i,3)=dot_product(vc4(:),vc3(:))
45 end do
46 end subroutine
47 
real(8), dimension(3, 3) avec
Definition: modmain.f90:12
real(8), dimension(3, 0:2) vclp2d
Definition: modmain.f90:1128
subroutine proj2d(np, fp)
Definition: proj2d.f90:7
real(8) epslat
Definition: modmain.f90:24
pure subroutine r3cross(x, y, z)
Definition: r3cross.f90:10
pure subroutine r3mv(a, x, y)
Definition: r3mv.f90:10