File: emdplot2d.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (63 lines) | stat: -rw-r--r-- 1,553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

! Copyright (C) 2014 D. Ernsting, S. Dugdale and J. K. Dewhurst.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine emdplot2d(emds)
use modmain
use modpw
use modomp
implicit none
! arguments
real(4), intent(in) :: emds(nhkmax,nkpt)
! local variables
integer nh(3),np,ip,n,i,nthd
real(8) vpnl(3),v1(3),t1
! allocatable arrays
real(8), allocatable :: vpl(:,:),vppc(:,:)
real(8), allocatable :: x(:),f(:)
! external functions
real(8) rfhkintp,fintgt
external rfhkintp,fintgt
! allocate local arrays
np=np2d(1)*np2d(2)
allocate(vpl(3,np),vppc(2,np))
! generate the 2D plotting points
call plotpt2d(bvec,binv,vpnl,vpl,vppc)
! determine the number of integration points
nh(:)=int(hkmax*sqrt(avec(1,:)**2+avec(2,:)**2+avec(3,:)**2)/pi)+1
n=2*maxval(nh(:)*ngridk(:))
allocate(x(n))
do i=1,n
  t1=2.d0*dble(i-1)/dble(n-1)-1.d0
  x(i)=t1*hkmax
end do
open(50,file='EMD2D.OUT',form='FORMATTED')
write(50,'(2I6," : grid size")') np2d(:)
! loop over plotting points in the 2D plane
call omp_hold(np,nthd)
!$OMP PARALLEL DEFAULT(SHARED) &
!$OMP PRIVATE(f,i,v1,t1) &
!$OMP NUM_THREADS(nthd)
!$OMP DO ORDERED
do ip=1,np
  allocate(f(n))
! integrate along normal to plane
  do i=1,n
    v1(:)=vpl(:,ip)+x(i)*vpnl(:)
    f(i)=rfhkintp(v1,emds)
  end do
  t1=fintgt(-2,n,x,f)
!$OMP ORDERED
  write(50,'(3G18.10)') vppc(1,ip),vppc(2,ip),t1
!$OMP END ORDERED
  deallocate(f)
end do
!$OMP END DO
!$OMP END PARALLEL
call omp_free(nthd)
close(50)
deallocate(vpl,vppc,x)
return
end subroutine