00001 module m_rd_dat_wan
00002 use m_rd_dat_wfn
00003 implicit none
00004 private
00005 public::rd_dat_ns_nb
00006 public::rd_dat_umat
00007 public::rd_dat_wan
00008 public::rd_dat_hmatr
00009
00010 integer,public::Mb,Mt
00011 integer,public,allocatable::Ns(:)
00012 integer,public,allocatable::Nb(:)
00013 integer,public,allocatable::Nt(:)
00014
00015 integer,public::NWF
00016 complex(8),public,allocatable::UNT(:,:,:)
00017
00018 complex(8),public,allocatable::C0_WN(:,:,:)
00019
00020 complex(8),public,allocatable::H_MAT_R(:,:,:,:,:)
00021 contains
00022 subroutine rd_dat_ns_nb
00023 implicit none
00024 integer::ik
00025
00026 OPEN(149,FILE='./dir-wan/dat.ns-nb')
00027 rewind(149)
00028 allocate(Ns(NTK));Ns=0
00029 allocate(Nb(NTK));Nb=0
00030 allocate(Nt(NTK));Nt=0
00031 do ik=1,NTK
00032 read(149,*) Ns(ik),Nb(ik)
00033 enddo
00034 Mb=maxval(Nb)
00035
00036 Nt(:)=0
00037 do ik=1,NTK
00038 Nt(ik)=Ns(ik)+Nb(ik)
00039 enddo
00040 Mt=maxval(Nt)
00041
00042
00043 end subroutine
00044
00045 subroutine rd_dat_umat
00046 implicit none
00047 integer::ik,jb,jw
00048 OPEN(150,FILE='./dir-wan/dat.umat')
00049 rewind(150)
00050 read(150,*) NWF
00051 allocate(UNT(Mb,NWF,NTK));UNT(:,:,:)=0.0d0
00052 do ik=1,NTK
00053 do jb=1,Nb(ik)
00054 read(150,*)(UNT(jb,jw,ik),jw=1,NWF)
00055 enddo
00056 enddo
00057
00058 end subroutine
00059
00060 subroutine rd_dat_wan
00061 implicit none
00062 integer::ik,iw,ig,nwftmp
00063 OPEN(113,FILE='./dir-wan/dat.wan',FORM='unformatted')
00064 REWIND(113)
00065 read(113) nwftmp
00066 if(nwftmp/=NWF)then
00067 write(6,*)'ERROR; STOP; nwftmp should be NWF'
00068 write(6,*)'nwftmp=',nwftmp,'NWF=',NWF;STOP
00069 endif
00070 allocate(C0_WN(NTG,NWF,NTK));C0_WN(:,:,:)=0.0D0
00071 do ik=1,NTK
00072 read(113)((C0_WN(ig,iw,ik),ig=1,NG0(ik)),iw=1,NWF)
00073
00074
00075
00076
00077
00078
00079 enddo
00080 CLOSE(113)
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 end subroutine
00095
00096 subroutine rd_dat_hmatr
00097 implicit none
00098 character(99)::header1,header2,header3
00099 integer::ia1,ia2,ia3,idum1,idum2,idum3,ib,jb
00100 real(8),parameter::au=27.21151d0
00101 OPEN(122,FILE='./dir-wan/dat.h_mat_r')
00102 allocate(H_MAT_R(NWF,NWF,-Na1:Na1,-Na2:Na2,-Na3:Na3));H_MAT_R(:,:,:,:,:)=0.0d0
00103 REWIND(122)
00104 read(122,'(a)') header1
00105 read(122,'(a)') header2
00106 read(122,'(a)') header3
00107 do ia1=-Na1,Na1
00108 do ia2=-Na2,Na2
00109 do ia3=-Na3,Na3
00110 read(122,*) idum1,idum2,idum3
00111 do ib=1,NWF
00112 do jb=1,NWF
00113 read(122,'(i5,i5,2f20.10)') idum1,idum2,H_MAT_R(ib,jb,ia1,ia2,ia3)
00114 enddo
00115 enddo
00116 read(122,*)
00117 enddo
00118 enddo
00119 enddo
00120 CLOSE(122)
00121 H_MAT_R=H_MAT_R/au
00122 end subroutine
00123
00124 end module