40 INTEGER(C_INT),
INTENT(IN) :: ltetra, nb, nge(3), ngw(3)
41 REAL(c_double),
INTENT(IN) :: bvec(9), eig1(nb,product(nge(1:3))), eig2(nb,product(nge(1:3)))
42 REAL(c_double),
INTENT(OUT) :: wght(nb*nb,product(ngw(1:3)))
43 INTEGER(C_INT),
INTENT(IN),
OPTIONAL :: comm
46 INTEGER :: nt_local, nk_local, nkbz, ik, kintp(8)
47 INTEGER,
ALLOCATABLE :: ik_global(:,:), ik_local(:,:)
48 REAL(8) :: wlsm(4,20), wintp(1,8)
49 REAL(8),
ALLOCATABLE :: wghtd(:,:,:), kvec(:,:)
51 IF(
PRESENT(comm))
THEN
53 & nt_local,nkbz,ik_global,ik_local,kvec,comm)
56 & nt_local,nkbz,ik_global,ik_local,kvec)
61 ALLOCATE(wghtd(nb*nb,1,nk_local))
66 wght(1:nb*nb,1:product(ngw(1:3))) = 0d0
69 wght(1:nb*nb,kintp(1:8)) = wght(1:nb*nb, kintp(1:8)) &
70 & + matmul(wghtd(1:nb*nb,1:1,ik), wintp(1:1,1:8))
72 DEALLOCATE(wghtd, kvec)
80 DEALLOCATE(ik_global, ik_local)
95 INTEGER,
INTENT(IN) :: nt_local, nb, nkBZ, nk_local, &
96 & ik_global(20,nt_local), ik_local(20,nt_local)
97 REAL(8),
INTENT(IN) :: wlsm(4,20), eig1(nb,nkBZ), eig2(nb,nkBZ)
98 REAL(8),
INTENT(OUT) :: dblstep(nb,nb,nk_local)
100 INTEGER :: ib, indx(4), it
101 REAL(8) :: e(4), ei1(4,nb), ei2(4), ej1(4,nb), ej2(4,nb), thr = 1d-10, &
102 & tsmall(4,4), v, w1(nb,4), w2(nb,4)
104 dblstep(1:nb,1:nb,1:nk_local) = 0d0
113 ei1(1:4, ib) = matmul(wlsm(1:4,1:20), eig1(ib, ik_global(1:20,it)))
114 ej1(1:4, ib) = matmul(wlsm(1:4,1:20), eig2(ib, ik_global(1:20,it)))
121 e(1:4) = ei1(1:4, ib)
124 IF(e(1) <= 0d0 .AND. 0d0 < e(2) )
THEN
130 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
131 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
133 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
134 & + v * matmul(w2(1:nb, 1:4 ), tsmall(1:4,1:4))
138 ELSE IF(e(2) <= 0d0 .AND. 0d0 < e(3))
THEN
144 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
145 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
147 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
148 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
156 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
157 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
159 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
160 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
168 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
169 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
171 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
172 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
176 ELSE IF( e(3) <= 0d0 .AND. 0d0 < e(4))
THEN
182 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
183 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
185 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
186 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
194 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
195 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
197 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
198 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
206 ei2(1:4 ) = matmul(tsmall(1:4,1:4), ei1(indx(1:4), ib))
207 ej2(1:4,1:nb) = matmul(tsmall(1:4,1:4), ej1(indx(1:4),1:nb))
209 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
210 & + v * matmul(w2(1:nb,1:4), tsmall(1:4,1:4))
214 ELSE IF(e(4) <= 0d0)
THEN
216 ei2(1:4 ) = ei1(1:4, ib)
217 ej2(1:4,1:nb) = ej1(1:4,1:nb)
219 w1(1:nb,1:4) = w1(1:nb,1:4) + w2(1:nb,1:4)
227 dblstep(1:nb,ib,ik_local(1:20,it)) = dblstep(1:nb,ib, ik_local(1:20,it)) &
228 & + matmul(w1(1:nb, 1:4), wlsm(1:4,1:20))
237 dblstep(1:nb,1:nb,1:nk_local) = dblstep(1:nb,1:nb,1:nk_local) / dble(6 * nkbz)
252 INTEGER,
INTENT(IN) :: nb
253 REAL(8),
INTENT(IN) :: ei1(4), ej1(4,nb)
254 REAL(8),
INTENT(OUT) :: w1(nb,4)
256 INTEGER :: ib, indx(4)
257 REAL(8) :: e(4), thr = 1d-8, tsmall(4,4), v
262 e(1:4) = - ei1(1:4) + ej1(1:4,ib)
265 IF(abs(e(1)) < thr .AND. abs(e(4)) < thr)
THEN
270 w1(ib,1:4) = w1(ib,1:4) + v * 0.25d0
272 ELSE IF((e(1) <= 0d0 .AND. 0d0 < e(2)) .OR. (e(1) < 0d0 .AND. 0d0 <= e(2)))
THEN
275 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
277 ELSE IF((e(2) <= 0d0 .AND. 0d0 < e(3)) .OR. (e(2) < 0d0 .AND. 0d0 <= e(3)))
THEN
280 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
283 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
286 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
288 ELSE IF((e(3) <= 0d0 .AND. 0d0 < e(4)) .OR. (e(3) < 0d0 .AND. 0d0 <= e(4)))
THEN
291 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
294 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
297 w1(ib,indx(1:4)) = w1(ib,indx(1:4)) + v * sum(tsmall(1:4,1:4), 1) * 0.25d0
299 ELSE IF(e(4) <= 0d0)
THEN
301 w1(ib,1:4) = w1(ib,1:4) + 0.25d0