The Elk Code
eveqnzh.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2016 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 eveqnzh(n,ld,a,w)
7 use modmain
8 use modomp
9 implicit none
10 ! arguments
11 integer, intent(in) :: n,ld
12 complex(8), intent(inout) :: a(ld,n)
13 real(8), intent(out) :: w(n)
14 ! local variables
15 integer nb,lwork,lrwork
16 integer nts,info,nthd
17 ! automatic arrays
18 integer iwork(3+5*n)
19 ! allocatable arrays
20 real(8), allocatable :: rwork(:)
21 complex(8), allocatable :: work(:)
22 ! external functions
23 integer, external :: ilaenv
24 ! find the optimal blocksize for allocating the work array
25 nb=ilaenv(1,'ZHETRD','U',n,-1,-1,-1)
26 lwork=max(2*n+n**2,(nb+1)*n)
27 lrwork=1+5*n+2*n**2
28 allocate(work(lwork),rwork(lrwork))
29 ! enable MKL parallelism
30 call holdthd(maxthdmkl,nthd)
31 nts=mkl_set_num_threads_local(nthd)
32 call zheevd('V','U',n,a,ld,w,work,lwork,rwork,lrwork,iwork,3+5*n,info)
33 nts=mkl_set_num_threads_local(0)
34 call freethd(nthd)
35 if (info /= 0) then
36  write(*,*)
37  write(*,'("Error(eveqnzh): diagonalisation failed")')
38  write(*,'(" ZHEEVD returned INFO = ",I8)') info
39  write(*,*)
40  stop
41 end if
42 deallocate(rwork,work)
43 end subroutine
44 
Definition: modomp.f90:6
integer maxthdmkl
Definition: modomp.f90:15
subroutine eveqnzh(n, ld, a, w)
Definition: eveqnzh.f90:7
subroutine freethd(nthd)
Definition: modomp.f90:106
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78