The Elk Code
eveqnzg.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2019 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 eveqnzg(n,ld,a,w)
7 use modomp
8 implicit none
9 ! arguments
10 integer, intent(in) :: n,ld
11 complex(8), intent(inout) :: a(ld,n)
12 complex(8), intent(out) :: w(n)
13 ! local variables
14 integer lwork,info
15 integer nthd,nts
16 ! automatic arrays
17 real(8) rwork(2*n)
18 ! allocatable arrays
19 complex(8), allocatable :: vr(:,:),work(:)
20 lwork=2*n
21 allocate(vr(n,n),work(lwork))
22 ! enable MKL parallelism
23 call holdthd(maxthdmkl,nthd)
24 nts=mkl_set_num_threads_local(nthd)
25 ! determine the eigenvalues and right eigenvectors
26 call zgeev('N','V',n,a,ld,w,vr,1,vr,n,work,lwork,rwork,info)
27 nts=mkl_set_num_threads_local(0)
28 call freethd(nthd)
29 if (info /= 0) then
30  write(*,*)
31  write(*,'("Error(eveqnzg): diagonalisation failed")')
32  write(*,'(" ZGEEV returned INFO = ",I8)') info
33  write(*,*)
34  stop
35 end if
36 ! copy right eigenvectors to output array
37 a(1:n,1:n)=vr(1:n,1:n)
38 deallocate(vr,work)
39 end subroutine
40 
Definition: modomp.f90:6
integer maxthdmkl
Definition: modomp.f90:15
subroutine freethd(nthd)
Definition: modomp.f90:106
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78
subroutine eveqnzg(n, ld, a, w)
Definition: eveqnzg.f90:7