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