@@ -277,6 +277,7 @@ subroutine get_ref_vsq(refq2,pol_vecs,rot_3fc,ref_3fc,mapping_triplet,verbose,v1
277277 complex , dimension (nrefq2, n_mode, n_mode, n_mode), intent (out ) :: v1
278278
279279 double precision , dimension (27 ) :: aux_3fc
280+ double precision :: tstart, tend
280281 integer :: n_mode_sc, n_mode, ns, qmu, qnu, mu, nu, at3, iq, index, nrefq2, dimq2, i,j, rq2
281282 integer :: nperm,nsym,nref3,ref3,equiv,iperm,isym,a,b,c,alpha,beta,gamma,nat,nat_sc
282283 complex , dimension (:), allocatable :: laux1, laux2
@@ -293,13 +294,17 @@ subroutine get_ref_vsq(refq2,pol_vecs,rot_3fc,ref_3fc,mapping_triplet,verbose,v1
293294 allocate (laux2(n_mode_sc))
294295
295296 if (verbose) then
296- print * , " ======================= get_ref_vsq() ======================="
297- print * , " Computing all reference V_{a}^{\alpha}(q1,q2)."
297+ tstart = omp_get_wtime()
298+ print * , " ======================= get_ref_vsq() ======================"
299+ print * , " "
300+ print * , " Computing all reference V_{a}^{\alpha}(q1,q2)."
301+ print * , " "
298302 end if
299303 v1 = 0
300304 ! $omp parallel private (qmu,qnu,at3,a,alpha,mu,laux1,lres1,ref3,equiv,iperm,isym,i,j)
301305 ! $omp do schedule (dynamic, 1) private (b,c,aux_3fc,beta,gamma,index,nu,laux2)
302306 do rq2 = 1 , nrefq2
307+ print * , " Calculating V(rq2=" , rq2," ) out of" , nrefq2
303308 qmu = refq2(rq2,1 ,1 )
304309 qnu = refq2(rq2,1 ,2 )
305310 do at3 = 1 , n_mode
@@ -341,6 +346,9 @@ subroutine get_ref_vsq(refq2,pol_vecs,rot_3fc,ref_3fc,mapping_triplet,verbose,v1
341346 ! $omp end do
342347 ! $omp end parallel
343348 if (verbose) then
349+ tend = omp_get_wtime()
350+ print * , " "
351+ print * , " Elapsed time inside get_ref_vsq():" , tend- tstart, " seconds."
344352 print * , " ======================= DONE ======================="
345353 print * , " "
346354 endif
@@ -421,16 +429,20 @@ subroutine get_ref_wsq(refq4,pol_vecs,rot_4fc,ref_4fc,mapping_quadruplet,verbose
421429
422430 if (verbose) then
423431 tstart = omp_get_wtime()
424- print * , " ======================= get_ref_wsq() ======================="
425- print * , " Computing the" , nrefq4, " reference W(-q1,q2,q3,-q4)."
426- print * , " This might take some time..."
432+ print * , " ======================= get_ref_wsq() ======================"
433+ print * , " "
434+ print * , " Computing the" , nrefq4, " reference W(-q1,q2,q3,-q4)."
435+ print * , " "
436+ print * , " This might take some time..."
437+ print * , " "
427438 end if
428439
429440 ns = n_mode_sc
430441
431442 v1 = 0.0d0
432443 tstart = omp_get_wtime()
433444 do rq4 = 1 , nrefq4
445+ print * , " Calculating W(rq4=" , rq4," ) out of" , nrefq4
434446 q1 = refq4(rq4,1 ,1 )+ 1
435447 q2 = refq4(rq4,1 ,2 )+ 1
436448 q3 = refq4(rq4,1 ,3 )+ 1
@@ -520,13 +532,14 @@ subroutine get_ref_wsq(refq4,pol_vecs,rot_4fc,ref_4fc,mapping_quadruplet,verbose
520532 end do
521533 if (verbose) then
522534 tend = omp_get_wtime()
523- print * , " Elapsed time inside get_ref_wsq():" , tend- tstart
535+ print * , " "
536+ print * , " Elapsed time inside get_ref_wsq():" , tend- tstart, " seconds."
524537 print * , " ======================= DONE ======================="
525538 print * , " "
526539 endif
527540end subroutine get_ref_wsq
528541
529- subroutine get_scf_wsq (wsq1 , F , refq4 , refq4o , norbitq4 , P , degs , verbose , &
542+ subroutine get_scf_wsq (wsq1 , F , refq4 , refq4o , norbitq4 , P , degs , verbose , eps , alpha_mix , &
530543wsq_scf , nrefq4 , n_mode , iq , dimq4 , nsym )
531544
532545 implicit none
@@ -543,6 +556,8 @@ subroutine get_scf_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
543556 logical , dimension (iq, n_mode, n_mode), intent (in ) :: degs
544557 logical , intent (in ) :: verbose
545558
559+ double precision , intent (in ) :: eps, alpha_mix
560+
546561 complex (8 ), dimension (nrefq4,n_mode,n_mode,n_mode,n_mode), intent (out ) :: wsq_scf
547562
548563 complex (8 ), dimension (nrefq4,n_mode,n_mode,n_mode,n_mode) :: wsq2
@@ -560,8 +575,6 @@ subroutine get_scf_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
560575 integer :: q10,q20,q30,q40,q5,q6,iperm_1,iperm_2,isym_1,isym_2
561576
562577 complex (8 ) :: ktea1, ktea2, W1, W2
563- double precision , parameter :: eps = 1e-6
564- double precision , parameter :: alpha_mix = 0.5d0
565578 integer , parameter :: maxiter = 50
566579
567580 perms = reshape ([ &
@@ -575,12 +588,16 @@ subroutine get_scf_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
575588 if (verbose) then
576589 tstart = omp_get_wtime()
577590 print * , " ======================= get_scf_wsq() ======================="
578- print * , " Self-consintent loop to compute \Theta(-q1,q2,q3,-q4)."
591+ print * , " "
592+ print * , " Self-consintent loop to compute \Theta(-q1,q2,q3,-q4)."
593+ print * , " "
594+ print * , " eps=" , eps, " alpha_mix=" , alpha_mix
579595 print * , " "
580596 end if
581597 do1 : do iter = 1 , maxiter
582598 if (verbose) then
583599 print * , " Iteration" , iter
600+ print * , " ---------------------"
584601 end if
585602 if (iter == 1 ) then
586603 wsq2 = wsq1
@@ -779,7 +796,7 @@ subroutine get_scf_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
779796 tend = omp_get_wtime()
780797 print * , " Convergence found with" , iter, " iterations"
781798 print * , " "
782- print * , " Elapsed time inside get_scf_wsq():" , tend- tstart
799+ print * , " Elapsed time inside get_scf_wsq():" , tend- tstart, " seconds. "
783800 print * , " ======================= DONE ======================="
784801 print * , " "
785802 endif
@@ -839,6 +856,7 @@ subroutine get_sum_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
839856 do1 : do iter = 1 , maxiter
840857 if (verbose) then
841858 print * , " Iteration" , iter
859+ print * , " -----------------------"
842860 end if
843861 if (iter == 1 ) then
844862 wsq2 = wsq1
@@ -1041,7 +1059,7 @@ subroutine get_sum_wsq(wsq1, F, refq4, refq4o, norbitq4, P, degs, verbose, &
10411059 tend = omp_get_wtime()
10421060 print * , " Convergence found with" , iter, " iterations"
10431061 print * , " "
1044- print * , " Elapsed time inside get_scf_wsq():" , tend- tstart
1062+ print * , " Elapsed time inside get_scf_wsq():" , tend- tstart, " seconds. "
10451063 print * , " ======================= DONE ======================="
10461064 print * , " "
10471065 endif
@@ -1119,8 +1137,13 @@ subroutine get_indep2fc( &
11191137 Vsb = &
11201138dot_product (rot_cart(isym+1 ,beta+1 ,:),vs_q(nat2p_uc* 3+1 :(nat2p_uc+1 )* 3+1 )) * &
11211139exp (- 2 * j* pi* dot_product (q_list(refq2(rq2,1 ,1 )+ 1 ,:)- q_list(refq2(rq2,1 ,2 )+ 1 ,:),T_list(map_tr(nat2p+1 )+ 1 ,:)))
1122- indep_fc(ref2,i) = indep_fc(ref2,i) + &
1140+ if (iperm == 0 ) then
1141+ indep_fc(ref2,i) = indep_fc(ref2,i) + &
11231142real (0.5d0 * F(refq2(rq2,1 ,1 )+ 1 ,refq2(rq2,1 ,2 )+ 1 ,munu(permutations(iperm+1 ,1 )), munu(permutations(iperm+1 ,2 )))* Vsa* CONJG (Vsb))
1143+ else
1144+ indep_fc(ref2,i) = indep_fc(ref2,i) + &
1145+ real (0.5d0 * F(refq2(rq2,1 ,1 )+ 1 ,refq2(rq2,1 ,2 )+ 1 ,munu(permutations(iperm+1 ,1 )), munu(permutations(iperm+1 ,2 )))* CONJG (Vsa)* Vsb)
1146+ end if
11241147 end do
11251148 end do
11261149 end do
0 commit comments