The Elk Code
getkmat.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2007-2010 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 getkmat(ik,kmat)
7 use modmain
8 use modramdisk
9 implicit none
10 ! arguments
11 integer, intent(in) :: ik
12 complex(8), intent(out) :: kmat(nstsv,nstsv)
13 ! local variables
14 logical tgs
15 integer nstsv_,recl
16 real(8) vkl_(3),t1
17 !$OMP CRITICAL(u220)
18 ! read from RAM disk if required
19 if (ramdisk) then
20  call getrd('KMAT.OUT',ik,tgs,v1=vkl_,n1=nstsv_,nzv=nstsv*nstsv,zva=kmat)
21  if (tgs) goto 10
22 end if
23 ! find the record length
24 inquire(iolength=recl) vkl_,nstsv_,kmat
25 open(220,file='KMAT.OUT',form='UNFORMATTED',access='DIRECT',recl=recl)
26 read(220,rec=ik) vkl_,nstsv_,kmat
27 close(220)
28 10 continue
29 !$OMP END CRITICAL(u220)
30 t1=abs(vkl(1,ik)-vkl_(1))+abs(vkl(2,ik)-vkl_(2))+abs(vkl(3,ik)-vkl_(3))
31 if (t1 > epslat) then
32  write(*,*)
33  write(*,'("Error(getkmat): differing vectors for k-point ",I8)') ik
34  write(*,'(" current : ",3G18.10)') vkl(:,ik)
35  write(*,'(" KMAT.OUT : ",3G18.10)') vkl_
36  write(*,*)
37  stop
38 end if
39 if (nstsv /= nstsv_) then
40  write(*,*)
41  write(*,'("Error(getkmat): differing nstsv for k-point ",I8)') ik
42  write(*,'(" current : ",I8)') nstsv
43  write(*,'(" KMAT.OUT : ",I8)') nstsv_
44  write(*,*)
45  stop
46 end if
47 end subroutine
48 
logical ramdisk
Definition: modramdisk.f90:9
type(file_t), dimension(:), allocatable, private file
Definition: modramdisk.f90:29
subroutine getkmat(ik, kmat)
Definition: getkmat.f90:7
subroutine getrd(fname, irec, tgs, n1, n2, n3, v1, v2, nrv, rva, nzv, zva)
Definition: modramdisk.f90:214
real(8), dimension(:,:), allocatable vkl
Definition: modmain.f90:471
real(8) epslat
Definition: modmain.f90:24