The Elk Code
zhegvxi.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2011 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 zhegvxi(n,m,ld1,a,b,w,ld2,z)
7 use modomp
8 implicit none
9 ! arguments
10 integer, intent(in) :: n,m,ld1
11 complex(8), intent(in) :: a(ld1,*),b(ld1,*)
12 real(8), intent(out) :: w(m)
13 integer, intent(in) :: ld2
14 complex(8), intent(out) :: z(ld2,m)
15 ! local variables
16 integer nb,lwork,nts
17 integer p,info,nthd
18 real(8) vl,vu
19 ! external functions
20 integer, external :: ilaenv
21 ! find the optimal blocksize for allocating the work array
22 nb=ilaenv(1,'ZHETRD','U',n,-1,-1,-1)
23 nb=max(nb,1)
24 lwork=(nb+1)*n
25 ! enable MKL parallelism
26 call holdthd(maxthdmkl,nthd)
27 nts=mkl_set_num_threads_local(nthd)
28 block
29 integer iwork(5*n),ifail(n)
30 real(8) rwork(7*n),wn(n)
31 complex(8) work(lwork)
32 ! find the first m eigenvalues and eigenvectors
33 call zhegvx(1,'V','I','U',n,a,ld1,b,ld1,vl,vu,1,m,-1.d0,p,wn,z,ld2,work,lwork, &
34  rwork,iwork,ifail,info)
35 w(1:m)=wn(1:m)
36 end block
37 nts=mkl_set_num_threads_local(0)
38 call freethd(nthd)
39 if (info /= 0) then
40  write(*,*)
41  write(*,'("Error(zhegvxi): diagonalisation failed")')
42  write(*,'(" ZHEGVX returned INFO = ",I0)') info
43  write(*,*)
44  stop
45 end if
46 end subroutine
47 
subroutine zhegvxi(n, m, ld1, a, b, w, ld2, z)
Definition: zhegvxi.f90:7
Definition: modomp.f90:6
integer maxthdmkl
Definition: modomp.f90:15
subroutine freethd(nthd)
Definition: modomp.f90:112
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78