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)
93 INTEGER,
INTENT(IN) :: nt_local, nb, nkBZ, nk_local, &
94 & ik_global(20,nt_local), ik_local(20,nt_local)
95 REAL(8),
INTENT(IN) :: wlsm(4,20), eig1(nb,nkBZ), eig2(nb,nkBZ)
96 REAL(8),
INTENT(OUT) :: dbldelta(nb,nb,nk_local)
98 INTEGER :: ib, indx(4), it
99 REAL(8) :: e(4), ei1(4,nb), ej1(4,nb), ej2(3,nb), V, thr = 1d-10, &
100 & tsmall(3,4), w1(nb,4), w2(nb,3)
102 dbldelta(1:nb,1:nb,1:nk_local) = 0d0
111 ei1(1:4,ib) = matmul(wlsm(1:4,1:20), eig1(ib, ik_global(1:20,it)))
112 ej1(1:4,ib) = matmul(wlsm(1:4,1:20), eig2(ib, ik_global(1:20,it)))
119 e(1:4) = ei1(1:4, ib)
122 IF(e(1) < 0d0 .AND. 0d0 <= e(2))
THEN
128 ej2(1:3,1:nb) = matmul(tsmall(1:3,1:4), ej1(indx(1:4),1:nb))
130 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
131 & + v * matmul(w2(1:nb,1:3), tsmall(1:3,1:4))
135 ELSE IF( e(2) < 0d0 .AND. 0d0 <= e(3))
THEN
141 ej2(1:3,1:nb) = matmul(tsmall(1:3,1:4), ej1(indx(1:4),1:nb))
143 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
144 & + v * matmul(w2(1:nb,1:3), tsmall(1:3,1:4))
152 ej2(1:3,1:nb) = matmul(tsmall(1:3,1:4), ej1(indx(1:4),1:nb))
154 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
155 & + v * matmul(w2(1:nb,1:3), tsmall(1:3,1:4))
159 ELSE IF(e(3) < 0d0 .AND. 0d0 < e(4))
THEN
165 ej2(1:3,1:nb) = matmul(tsmall(1:3,1:4), ej1(indx(1:4),1:nb))
167 w1(1:nb,indx(1:4)) = w1(1:nb, indx(1:4)) &
168 & + v * matmul(w2(1:nb,1:3), tsmall(1:3,1:4))
174 dbldelta(1:nb,ib,ik_local(1:20,it)) = dbldelta(1:nb,ib, ik_local(1:20,it)) &
175 & + matmul(w1(1:nb,1:4), wlsm(1:4,1:20))
184 dbldelta(1:nb,1:nb,1:nk_local) = dbldelta(1:nb,1:nb,1:nk_local) / dble(6 * nkbz)
195 INTEGER,
INTENT(IN) :: nb
196 REAL(8),
INTENT(IN) :: ej(3,nb)
197 REAL(8),
INTENT(INOUT) :: w(nb,3)
199 INTEGER :: ib, ii, indx(3)
200 REAL(8) :: a(3,3), e(3), V
204 IF(maxval(abs(ej(1:3,ib))) < 1d-10) stop
"Nesting !!"
211 a(1:3,ii) = (0d0 - e(ii)) / (e(1:3) - e(ii))
214 IF((e(1) < 0d0 .AND. 0d0 <= e(2)) .OR. (e(1) <= 0d0 .AND. 0d0 < e(2)))
THEN
217 v = a(2,1) / (e(3) - e(1))
219 w(ib,indx(1)) = v * (a(1,2) + a(1,3))
220 w(ib,indx(2)) = v * a(2,1)
221 w(ib,indx(3)) = v * a(3,1)
223 ELSE IF((e(2) <= 0d0 .AND. 0d0 < e(3)) .OR. (e(2) < 0d0 .AND. 0d0 <= e(3)))
THEN
226 v = a(2,3) / (e(3) - e(1))
228 w(ib,indx(1)) = v * a(1,3)
229 w(ib,indx(2)) = v * a(2,3)
230 w(ib,indx(3)) = v * (a(3,1) + a(3,2))