The Elk Code
getdevecfv.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2013 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 getdevecfv(ik,iq,is,ia,ip,devecfv)
7 use modmain
8 use modphonon
9 use modramdisk
10 implicit none
11 ! arguments
12 integer, intent(in) :: ik,iq,is,ia,ip
13 complex(8), intent(out) :: devecfv(nmatmax,nstfv,nspnfv)
14 ! local variables
15 logical tgs
16 integer recl,nmatmax_,nstfv_,nspnfv_
17 real(8) vkl_(3),t1
18 character(256) fext,fname
19 ! construct the dynamical matrix file extension
20 call dynfext(iq,is,ia,ip,fext)
21 ! construct filename
22 fname=trim(scrpath)//'DEVECFV'//trim(fext)
23 !$OMP CRITICAL(u222)
24 ! read from RAM disk if required
25 if (ramdisk) then
26  call getrd(fname,ik,tgs,v1=vkl_,n1=nmatmax_,n2=nstfv_,n3=nspnfv_, &
27  nzv=nmatmax*nstfv*nspnfv,zva=devecfv)
28  if (tgs) goto 10
29 end if
30 ! find the record length
31 inquire(iolength=recl) vkl_,nmatmax_,nstfv_,nspnfv_,devecfv
32 open(222,file=fname,form='UNFORMATTED',access='DIRECT',recl=recl)
33 read(222,rec=ik) vkl_,nmatmax_,nstfv_,nspnfv_,devecfv
34 close(222)
35 10 continue
36 !$OMP END CRITICAL(u222)
37 t1=abs(vkl(1,ik)-vkl_(1))+abs(vkl(2,ik)-vkl_(2))+abs(vkl(3,ik)-vkl_(3))
38 if (t1 > epslat) then
39  write(*,*)
40  write(*,'("Error(getdevecfv): differing vectors for k-point ",I8)') ik
41  write(*,'(" current : ",3G18.10)') vkl(:,ik)
42  write(*,'(" ",A," : ",3G18.10)') trim(fname),vkl_
43  write(*,*)
44  stop
45 end if
46 if (nmatmax /= nmatmax_) then
47  write(*,*)
48  write(*,'("Error(getdevecfv): differing nmatmax for k-point ",I8)') ik
49  write(*,'(" current : ",I8)') nmatmax
50  write(*,'(" ",A," : ",I8)') trim(fname),nmatmax_
51  write(*,*)
52  stop
53 end if
54 if (nstfv /= nstfv_) then
55  write(*,*)
56  write(*,'("Error(getdevecfv): differing nstfv for k-point ",I8)') ik
57  write(*,'(" current : ",I8)') nstfv
58  write(*,'(" ",A," : ",I8)') trim(fname),nstfv_
59  write(*,*)
60  stop
61 end if
62 if (nspnfv /= nspnfv_) then
63  write(*,*)
64  write(*,'("Error(getdevecfv): differing nspnfv for k-point ",I8)') ik
65  write(*,'(" current : ",I8)') nspnfv
66  write(*,'(" ",A," : ",I8)') trim(fname),nspnfv_
67  write(*,*)
68  stop
69 end if
70 end subroutine
71 
character(256) scrpath
Definition: modmain.f90:1303
logical ramdisk
Definition: modramdisk.f90:9
subroutine dynfext(iq, is, ia, ip, fext)
Definition: dynfext.f90:7
type(file_t), dimension(:), allocatable, private file
Definition: modramdisk.f90:29
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
subroutine getdevecfv(ik, iq, is, ia, ip, devecfv)
Definition: getdevecfv.f90:7