The Elk Code
zhegvdi.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2026 J. K. Dewhurst and S. Sharma.
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 zhegvdi(n,ld,a,b,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),b(ld,n)
13 real(8), intent(out) :: w(n)
14 ! local variables
15 integer lwork,lrwork,liwork
16 integer nts,info,nthd
17 ! allocatable arrays
18 real(8), allocatable :: rwork(:)
19 complex(8), allocatable :: work(:)
20 lwork=2*n+n**2
21 lrwork=1+5*n+2*n**2
22 liwork=3+5*n
23 allocate(work(lwork),rwork(lrwork))
24 ! enable MKL parallelism
25 call holdthd(maxthdmkl,nthd)
26 nts=mkl_set_num_threads_local(nthd)
27 block
28 integer iwork(liwork)
29 call zhegvd(1,'V','U',n,a,ld,b,ld,w,work,lwork,rwork,lrwork,iwork,liwork,info)
30 end block
31 nts=mkl_set_num_threads_local(0)
32 call freethd(nthd)
33 if (info /= 0) then
34  write(*,*)
35  write(*,'("Error(zhegvdi): diagonalisation failed")')
36  write(*,'(" ZHEGVD returned INFO = ",I0)') info
37  write(*,*)
38  stop
39 end if
40 deallocate(rwork,work)
41 end subroutine
42 
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
subroutine zhegvdi(n, ld, a, b, w)
Definition: zhegvdi.f90:7