00001 subroutine make_eks(NTK,NWF,Na1,Na2,Na3,HmatR,pf,EKS,VKS)
00002 implicit none
00003 integer::NTK,NWF,Na1,Na2,Na3
00004 complex(8)::pf(-Na1:Na1,-Na2:Na2,-Na3:Na3,NTK)
00005 complex(8)::HmatR(NWF,NWF,-Na1:Na1,-Na2:Na2,-Na3:Na3)
00006 complex(8),allocatable::Hin(:,:)
00007 real(8),allocatable::E_TMP_R(:)
00008 integer::ik,ib,jb,ia1,ia2,ia3
00009 complex(8)::SUM_CMPX
00010 real(8)::EKS(NWF,NTK)
00011 complex(8)::VKS(NWF,NWF,NTK)
00012
00013
00014
00015 allocate(Hin(NWF,NWF)); Hin=0.0d0
00016 allocate(E_TMP_R(NWF)); E_TMP_R=0.0d0
00017
00018 EKS=0.0d0
00019 VKS=0.0d0
00020 do ik=1,NTK
00021 Hin(:,:)=0.0D0
00022 do ib=1,NWF
00023 do jb=1,NWF
00024 SUM_CMPX=0.0D0
00025 do ia1=-Na1,Na1
00026 do ia2=-Na2,Na2
00027 do ia3=-Na3,Na3
00028 SUM_CMPX=SUM_CMPX+HmatR(ib,jb,ia1,ia2,ia3)*pf(ia1,ia2,ia3,ik)
00029 enddo
00030 enddo
00031 enddo
00032 Hin(ib,jb)=SUM_CMPX
00033 enddo
00034 enddo
00035 E_TMP_R(:)=0.0D0
00036 call diagV(NWF,Hin(1,1),E_TMP_R(1))
00037 EKS(:,ik)=E_TMP_R(:)
00038 VKS(:,:,ik)=Hin(:,:)
00039 enddo
00040 deallocate(Hin,E_TMP_R)
00041
00042 return
00043 end
00044
00045 subroutine make_emk(NTK,NWF,nsgm,Na1,Na2,Na3,HmatT,pf,EMK)
00046 implicit none
00047 integer::NTK,NWF,nsgm,Na1,Na2,Na3
00048 complex(8)::pf(-Na1:Na1,-Na2:Na2,-Na3:Na3,NTK)
00049
00050 complex(4)::HmatT(NWF,NWF,-Na1:Na1,-Na2:Na2,-Na3:Na3,nsgm)
00051 complex(8)::larger_en
00052 complex(8),allocatable::Hin(:,:)
00053 complex(8),allocatable::E_TMP_C(:)
00054 integer::LDVL,LDVR,LWORK,ind
00055 complex(8),ALLOCATABLE::VL(:,:)
00056 complex(8),ALLOCATABLE::VR(:,:)
00057 complex(8),ALLOCATABLE::work_zgeev(:)
00058 real(8),ALLOCATABLE::rwork_zgeev(:)
00059 integer::ie,ik,ib,jb,ia1,ia2,ia3,i,j
00060 complex(8)::SUM_CMPX
00061 complex(8)::EMK(NWF,NTK,nsgm)
00062
00063 do ie=1,nsgm
00064 LWORK=5*NWF;LDVL=NWF;LDVR=NWF;ind=0
00065
00066 allocate(VL(LDVL,NWF))
00067 allocate(VR(LDVR,NWF))
00068 allocate(work_zgeev(LWORK))
00069 allocate(rwork_zgeev(2*NWF))
00070 allocate(Hin(NWF,NWF)); Hin=0.0d0
00071 allocate(E_TMP_C(NWF)); E_TMP_C=0.0d0
00072
00073 do ik=1,NTK
00074 Hin(:,:)=0.0D0
00075 do ib=1,NWF
00076 do jb=1,NWF
00077 SUM_CMPX=0.0D0
00078 do ia1=-Na1,Na1
00079 do ia2=-Na2,Na2
00080 do ia3=-Na3,Na3
00081 SUM_CMPX=SUM_CMPX+HmatT(ib,jb,ia1,ia2,ia3,ie)*pf(ia1,ia2,ia3,ik)
00082 enddo
00083 enddo
00084 enddo
00085 Hin(ib,jb)=SUM_CMPX
00086 ENDDO
00087 ENDDO
00088
00089 E_TMP_C(:)=0.0d0
00090 call zgeev("N","N",NWF,Hin,NWF,E_TMP_C,VL,NWF,VR,NWF,work_zgeev,LWORK,rwork_zgeev,ind)
00091 if(ind/=0) write(6,*) ind,ik,ib
00092
00093 do i=1,NWF-1
00094 do j=i+1,NWF
00095 if(dble(E_TMP_C(i))>dble(E_TMP_C(j)))then
00096 larger_en=E_TMP_C(i)
00097 E_TMP_C(i)=E_TMP_C(j)
00098 E_TMP_C(j)=larger_en
00099 endif
00100 enddo
00101 enddo
00102 do ib=1,NWF
00103 EMK(ib,ik,ie)=E_TMP_C(ib)
00104 enddo
00105
00106 enddo
00107
00108 deallocate(VL,VR,work_zgeev,rwork_zgeev,Hin,E_TMP_C)
00109
00110 write(6,*)'ie=',ie
00111 enddo
00112
00113
00114 return
00115 end