1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
| module pub implicit none integer N,iternum,hn real err,eta,dk,domg parameter( hn = 4, N = hn,iternum = 200,err = 1e-16,eta = 0.01,dk = 0.01,domg = dk) real,parameter::pi = 3.1415926535 complex,parameter::im = (0.,1.0) complex ones(N,N),GLL(N,N),GRR(N,N),GB(N,N) complex H00(N,N) complex H01(N,N) complex g1(hn,hn),g2(hn,hn),g3(hn,hn) real m0,mu real tx,ty real ax,ay end module pub
program main use pub m0 = 1.5 tx = 1.0 ty = 1.0 ax = 1.0 ay = 1.0 call surfstat() stop end program main
subroutine surfstat() use pub implicit none real kx,omg,re1,re2,re3 real t_start,t_end integer i1 open(20,file="dos.dat") call cpu_time(t_start) do kx = -pi,pi,dk call matset(kx) do omg = -3,3,domg call itera(omg,kx) re1 = log(abs(sum(aimag(GLL)))) re2 = log(abs(sum(aimag(GRR)))) re3 = log(abs(sum(aimag(GB)))) write(20,999)kx/pi,omg,re1,re2,re3 end do write(20,*)" " end do call cpu_time(t_end) close(20) write(*,*)"Timing const is: ",t_end - t_start 999 format(30f16.12) return end subroutine surfstat
subroutine itera(omega,ky) use pub real omega,real_temp,ky integer iter complex omegac complex g0dem(N,N), g0(N,N) complex epsiloni(N,N),epsilons(N,N),epsilons_t(N,N),alphai(N,N),betai(N,N) complex GLLdem(N,N),GRRdem(N,N),GBdem(N,N),mat1(N,N),mat2(N,N) call matset(ky) epsiloni = H00 epsilons = H00 epsilons_t = H00 alphai = H01 betai = conjg(transpose(H01)) omegac = omega + eta*im do iter = 1, iternum
g0dem = omegac*ones - epsiloni call inv(g0dem, g0)
mat1 = matmul(alphai, g0) mat2 = matmul(betai, g0)
g0 = matmul(mat1,betai)
epsiloni = epsiloni + g0
epsilons = epsilons + g0
g0 = matmul(mat2,alphai)
epsiloni = epsiloni + g0
epsilons_t = epsilons_t + g0
g0 = matmul(mat1, alphai) alphai = g0
g0 = matmul(mat2, betai) betai = g0 real_temp = sum(abs(alphai)) if (real_temp .le. err)then exit end if
end do
GLLdem = omegac*ones- epsilons call inv(GLLdem, GLL)
GRRdem = omegac*ones- epsilons_t call inv(GRRdem, GRR)
GBdem = omegac*ones- epsiloni call inv(GBdem, GB) end subroutine itera
subroutine matset(ky) use pub real ky integer m,l call Pauli() do m = 1,hn do l = 1,hn H00(m,l) = (m0-ty*cos(ky))*g1(m,l) + ay*sin(ky)*g3(m,l)
H01(m,l) = (-tx*g1(m,l) - im*ax*g2(m,l))/2 end do end do do ix = 1,N ones(ix,ix) = 1.0 end do return end subroutine matset
subroutine inv(matin,matout) use pub complex,intent(in) :: matin(N,N) complex:: matout(size(matin,1),size(matin,2)) real:: work2(size(matin,1)) integer::ipiv(size(matin,1)) integer info matout = matin call CGETRF(N,N,matout,N,ipiv,info) if (info.ne.0) stop 'Matrix is numerically singular!' call CGETRI(N,matout,N,ipiv,work2,N,info) if (info.ne.0) stop 'Matrix inversion failed!' return end subroutine inv
subroutine Pauli() use pub g1(1,1) = 1 g1(2,2) = -1 g1(3,3) = 1 g1(4,4) = -1 g2(1,2) = 1 g2(2,1) = 1 g2(3,4) = -1 g2(4,3) = -1 g3(1,2) = -im g3(2,1) = im g3(3,4) = -im g3(4,3) = im return end subroutine Pauli
|