Commit 49f7d2bc authored by Marco Govoni's avatar Marco Govoni
Browse files

Upgraded Modules/westcom.f90. Removed unused variables: sqvc_q0, sqvc_q, and...

Upgraded Modules/westcom.f90. Removed unused variables: sqvc_q0, sqvc_q, and qp_krange. Modified nq1,nq2,nq3 --> nq(1:3). Removed current_iq and l_gammaq from the module, they are used locally.
parent 844c9536
......@@ -456,11 +456,11 @@ SUBROUTINE store_vcspecial_H(vc_tmp,numg)
qq = SUM(q(:)**2)
!
on_double_grid = .TRUE.
x= 0.5_DP/tpiba*(q(1)*at(1,1)+q(2)*at(2,1)+q(3)*at(3,1))!*nq1
x= 0.5_DP/tpiba*(q(1)*at(1,1)+q(2)*at(2,1)+q(3)*at(3,1)) ! * nq(1)
on_double_grid = on_double_grid .AND. (ABS(x-NINT(x))<eps)
x= 0.5_DP/tpiba*(q(1)*at(1,2)+q(2)*at(2,2)+q(3)*at(3,2))!*nq2
x= 0.5_DP/tpiba*(q(1)*at(1,2)+q(2)*at(2,2)+q(3)*at(3,2)) ! * nq(2)
on_double_grid = on_double_grid .AND. (ABS(x-NINT(x))<eps)
x= 0.5_DP/tpiba*(q(1)*at(1,3)+q(2)*at(2,3)+q(3)*at(3,3))!*nq3
x= 0.5_DP/tpiba*(q(1)*at(1,3)+q(2)*at(2,3)+q(3)*at(3,3)) ! * nq(3)
on_double_grid = on_double_grid .AND. (ABS(x-NINT(x))<eps)
!
IF( on_double_grid ) THEN
......
......@@ -355,11 +355,11 @@ SUBROUTINE dfpt_q (m,dvg,dng,tr2,iq)
USE control_flags, ONLY : gamma_only, io_level
USE io_files, ONLY : tmp_dir, nwordwfc, iunwfc, diropn
USE uspp, ONLY : nkb, vkb, okvan
USE westcom, ONLY : sqvc,nbnd_occ,iuwfc,lrwfc,l_gammaq,npwqx,npwq,igq_q
USE westcom, ONLY : sqvc,nbnd_occ,iuwfc,lrwfc,npwqx,npwq,igq_q
USE io_push, ONLY : io_push_title
USE mp_world, ONLY : mpime,world_comm
USE class_bz_grid, ONLY : bz_grid
USE types_bz_grid, ONLY : kmq_grid
USE types_bz_grid, ONLY : kmq_grid,q_grid
!
IMPLICIT NONE
!
......@@ -632,7 +632,7 @@ SUBROUTINE dfpt_q (m,dvg,dng,tr2,iq)
!
ENDDO ! K-POINT and SPIN
!
IF ( l_gammaq ) THEN
IF ( q_grid%l_gammap(iq) ) THEN
IF ( gstart == 2 ) dng(1,1:m) = CMPLX( 0._DP, 0._DP, KIND=DP )
ENDIF
!
......
......@@ -18,16 +18,12 @@ MODULE scratch_area
!
SAVE
!
! Coulomb
! COULOMB
REAL(DP),ALLOCATABLE :: sqvc(:)
INTEGER :: npwq,npwqx,npwq_g
CHARACTER(LEN=6) :: fftdriver
!INTEGER,ALLOCATABLE :: q0ig_l2g(:)
INTEGER,ALLOCATABLE :: iks_l2g(:)
!
REAL(DP), ALLOCATABLE :: sqvc_q0(:)
REAL(DP), ALLOCATABLE :: sqvc_q(:,:)
!
! DBS
REAL(DP),ALLOCATABLE :: ev(:)
REAL(DP),ALLOCATABLE :: ev_distr(:)
......@@ -39,13 +35,11 @@ MODULE scratch_area
INTEGER,ALLOCATABLE :: nbnd_occ(:)
!
! Q-POINTS
INTEGER :: current_iq
LOGICAL :: l_gammaq
INTEGER, ALLOCATABLE :: ngq(:)
INTEGER, ALLOCATABLE :: igq_q(:,:)
INTEGER, ALLOCATABLE :: ngq_g(:)
INTEGER, ALLOCATABLE :: igq_l2g(:,:)
INTEGER, ALLOCATABLE :: igq_l2g_kdip(:,:)
INTEGER, ALLOCATABLE :: ngq(:) ! equivalent of ngk(:) --> ex. ngq(iq) = LOCAL number of PW for q-point iq (global in iq)
INTEGER, ALLOCATABLE :: igq_q(:,:) ! equivalent of igk_k(:,:) --> ex. igq_q(ig,iq) = map for FFT (global in iq )
INTEGER, ALLOCATABLE :: ngq_g(:) ! equivalent of ngk_g(:) --> ex. ngk_g(iq) = TOTAL number of PW for q-point iq (global in iq)
INTEGER, ALLOCATABLE :: igq_l2g(:,:) ! equivalent of igk_l2g(:,:) --> ex. iqq_l2g(ig,iq) = global PW index (G+q) of for local PW index (G+q) (global in iq)
INTEGER, ALLOCATABLE :: igq_l2g_kdip(:,:) ! to be understood
!
! EPSILON
REAL(DP),ALLOCATABLE :: d_epsm1_ifr(:,:,:)
......@@ -53,8 +47,8 @@ MODULE scratch_area
COMPLEX(DP),ALLOCATABLE :: z_epsm1_rfr(:,:,:)
!
! EPSILON with q-points
COMPLEX(DP), ALLOCATABLE :: z_epsm1_ifr_q(:,:,:,:)
COMPLEX(DP), ALLOCATABLE :: z_epsm1_rfr_q(:,:,:,:)
COMPLEX(DP), ALLOCATABLE :: z_epsm1_ifr_q(:,:,:,:) ! EPSILON + iq (global in iq)
COMPLEX(DP), ALLOCATABLE :: z_epsm1_rfr_q(:,:,:,:) ! EPSILON + iq (global in iq)
!
! CORRELATION
REAL(DP),ALLOCATABLE :: d_head_ifr(:)
......@@ -68,10 +62,10 @@ MODULE scratch_area
COMPLEX(DP),ALLOCATABLE :: z_body_rfr(:,:,:,:)
!
! CORRELATION with q-points
COMPLEX(DP), ALLOCATABLE :: z_body1_ifr_q(:,:,:,:,:)
COMPLEX(DP), ALLOCATABLE :: z_body2_ifr_q(:,:,:,:,:,:)
REAL(DP), ALLOCATABLE :: d_diago_q(:,:,:,:,:)
COMPLEX(DP), ALLOCATABLE :: z_body_rfr_q (:,:,:,:,:)
COMPLEX(DP), ALLOCATABLE :: z_body1_ifr_q(:,:,:,:,:) ! CORRELATION + iq (global in iq)
COMPLEX(DP), ALLOCATABLE :: z_body2_ifr_q(:,:,:,:,:,:) ! CORRELATION + iq (global in iq)
REAL(DP), ALLOCATABLE :: d_diago_q(:,:,:,:,:) ! CORRELATION + iq (global in iq)
COMPLEX(DP), ALLOCATABLE :: z_body_rfr_q (:,:,:,:,:) ! CORRELATION + iq (global in iq)
!
! I/O
!INTEGER :: io_comm ! communicator for head of images (me_bgrp==0)
......@@ -121,9 +115,7 @@ MODULE wstat_center
LOGICAL :: l_kinetic_only
LOGICAL :: l_minimize_exx_if_active
LOGICAL :: l_use_ecutrho
INTEGER :: nq1
INTEGER :: nq2
INTEGER :: nq3
INTEGER :: nq(3)
!
! Common workspace
!
......@@ -149,7 +141,6 @@ MODULE wfreq_center
INTEGER :: n_imfreq
INTEGER :: n_refreq
INTEGER :: qp_bandrange(2)
INTEGER :: qp_krange(2)
REAL(DP) :: ecut_imfreq
REAL(DP) :: ecut_refreq
REAL(DP) :: wfreq_eta
......
......@@ -54,7 +54,7 @@ MODULE class_bz_grid
USE cell_base, ONLY : at, bg
USE klist, ONLY : xk, wk, nkstot
USE start_k, ONLY : nk1, nk2, nk3
USE westcom, ONLY : nq1, nq2, nq3
USE westcom, ONLY : nq
!
IMPLICIT NONE
!
......@@ -97,23 +97,23 @@ MODULE class_bz_grid
!
CASE ( 'Q', 'q')
!
grid%np1 = nq1
grid%np2 = nq2
grid%np3 = nq3
grid%np1 = nq(1)
grid%np2 = nq(2)
grid%np3 = nq(3)
!
grid%nps = nq1 * nq2 * nq3
grid%nps = nq(1) * nq(2) * nq(3)
!
ALLOCATE ( grid%xp_cryst(3,grid%nps) )
ALLOCATE ( grid%xp_cart(3,grid%nps) )
ALLOCATE ( grid%wp(grid%nps) )
!
dq1 = 1._DP / DBLE(nq1)
dq2 = 1._DP / DBLE(nq2)
dq3 = 1._DP / DBLE(nq3)
dq1 = 1._DP / DBLE(nq(1))
dq2 = 1._DP / DBLE(nq(2))
dq3 = 1._DP / DBLE(nq(3))
iq = 0
DO iq1 = 1, nq1
DO iq2 = 1, nq2
DO iq3 = 1, nq3
DO iq1 = 1, nq(1)
DO iq2 = 1, nq(2)
DO iq3 = 1, nq(3)
iq = iq + 1
grid%xp_cryst(1,iq) = DBLE( iq1 - 1 ) * dq1
grid%xp_cryst(2,iq) = DBLE( iq2 - 1 ) * dq2
......@@ -262,7 +262,7 @@ MODULE class_bz_grid
USE cell_base, ONLY : at, bg
USE klist, ONLY : xk, wk, nkstot
USE pwcom, ONLY : nspin
USE westcom, ONLY : nq1, nq2, nq3
USE westcom, ONLY : nq
!
IMPLICIT NONE
!
......@@ -286,18 +286,18 @@ MODULE class_bz_grid
!
nks = kgrid%nps
nks1 = k1grid%nps
temp_nqs = nq1*nq2*nq3
temp_nqs = nq(1)*nq(2)*nq(3)
!
ALLOCATE( temp_xq(3,temp_nqs), temp_wq(temp_nqs) )
ALLOCATE( new_iq(temp_nqs), temp_index_iq(temp_nqs) )
!
dq1 = 1._DP / DBLE(nq1)
dq2 = 1._DP / DBLE(nq2)
dq3 = 1._DP / DBLE(nq3)
dq1 = 1._DP / DBLE(nq(1))
dq2 = 1._DP / DBLE(nq(2))
dq3 = 1._DP / DBLE(nq(3))
iq = 0
DO iq1 = 1, nq1
DO iq2 = 1, nq2
DO iq3 = 1, nq3
DO iq1 = 1, nq(1)
DO iq2 = 1, nq(2)
DO iq3 = 1, nq(3)
iq = iq + 1
temp_xq(1,iq) = DBLE( iq1 - 1 ) * dq1
temp_xq(2,iq) = DBLE( iq2 - 1 ) * dq2
......@@ -305,7 +305,7 @@ MODULE class_bz_grid
ENDDO
ENDDO
ENDDO
temp_wq = 1 / DBLE(nq1*nq2*nq3)
temp_wq = 1 / DBLE(nq(1)*nq(2)*nq(3))
!
ALLOCATE( qgrid%index_q(nks,nks) )
ALLOCATE( qgrid%g0(3,nks,nks) )
......
......@@ -74,9 +74,7 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
l_kinetic_only = .FALSE.
l_minimize_exx_if_active = .FALSE.
l_use_ecutrho = .FALSE.
nq1 = 0
nq2 = 0
nq3 = 0
nq = (/ 1, 1, 1 /)
ENDIF
!
! ** wfreq_control **
......@@ -156,12 +154,8 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
IF( found ) l_minimize_exx_if_active = lval
CALL json%get('wstat_control.l_use_ecutrho', lval, found)
IF( found ) l_use_ecutrho = lval
CALL json%get('wstat_control.nq1', ival, found)
IF( found ) nq1 = ival
CALL json%get('wstat_control.nq2', ival, found)
IF( found ) nq2 = ival
CALL json%get('wstat_control.nq3', ival, found)
IF( found ) nq3 = ival
CALL json%get('wstat_control.nq', ivec, found)
IF( found ) nq(1:3) = ivec(:)
ENDIF
!
IF ( ANY(driver(:)==3) ) THEN
......@@ -264,9 +258,7 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
CALL mp_bcast(l_kinetic_only,root,world_comm)
CALL mp_bcast(l_minimize_exx_if_active,root,world_comm)
CALL mp_bcast(l_use_ecutrho,root,world_comm)
CALL mp_bcast(nq1,root,world_comm)
CALL mp_bcast(nq2,root,world_comm)
CALL mp_bcast(nq3,root,world_comm)
CALL mp_bcast(nq,root,world_comm)
!
! CHECKS
!
......@@ -309,9 +301,6 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
CALL mp_bcast(o_restart_time,root,world_comm)
CALL mp_bcast(ecut_spectralf,root,world_comm)
CALL mp_bcast(n_spectralf,root,world_comm)
CALL mp_bcast(nq1,root,world_comm)
CALL mp_bcast(nq2,root,world_comm)
CALL mp_bcast(nq3,root,world_comm)
!
! CHECKS
!
......@@ -400,11 +389,9 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
CALL io_push_value('l_kinetic_only',l_kinetic_only,numsp)
CALL io_push_value('l_minimize_exx_if_active',l_minimize_exx_if_active,numsp)
CALL io_push_value('l_use_ecutrho',l_use_ecutrho,numsp)
IF ( nq1 * nq2 * nq3 >= 1 )THEN
CALL io_push_value('nq1',nq1,numsp)
CALL io_push_value('nq2',nq2,numsp)
CALL io_push_value('nq3',nq3,numsp)
ENDIF
CALL io_push_value('nq(1)',nq(1),numsp)
CALL io_push_value('nq(2)',nq(2),numsp)
CALL io_push_value('nq(3)',nq(3),numsp)
!
CALL io_push_bar()
!
......@@ -532,9 +519,7 @@ SUBROUTINE add_intput_parameters_to_json_file( num_drivers, driver, json )
CALL json%add('input.wstat_control.l_kinetic_only',l_kinetic_only)
CALL json%add('input.wstat_control.l_minimize_exx_if_active',l_minimize_exx_if_active)
CALL json%add('input.wstat_control.l_use_ecutrho',l_use_ecutrho)
CALL json%add('input.wstat_control.nq1', nq1)
CALL json%add('input.wstat_control.nq2', nq2)
CALL json%add('input.wstat_control.nq3', nq3)
CALL json%add('input.wstat_control.nq', nq)
!
ENDIF
!
......
......@@ -227,7 +227,7 @@ SUBROUTINE calc_corr_k( sigma_corr, energy, l_verbose)
USE pwcom, ONLY : et,nks,current_spin,isk,xk,nbnd,lsda,g2kin,nspin,current_k,wk
USE westcom, ONLY : qp_bandrange,isz,&
& nbnd_occ,l_enable_lanczos,&
& n_lanczos,iks_l2g,l_macropol,l_gammaq,&
& n_lanczos,iks_l2g,l_macropol,&
& z_head_ifr,z_head_rfr,z_body1_ifr_q,z_body2_ifr_q,d_diago_q,z_body_rfr_q
USE bar, ONLY : bar_type,start_bar_type,update_bar_type,stop_bar_type
USE io_push, ONLY : io_push_bar,io_push_value,io_push_title
......@@ -258,6 +258,7 @@ SUBROUTINE calc_corr_k( sigma_corr, energy, l_verbose)
REAL(DP) :: segno, enrg
COMPLEX(DP) :: residues_b,residues_h
LOGICAL :: this_is_a_pole
LOGICAL :: l_gammaq
!
TYPE(bz_grid) :: k1_grid,q_grid_aux
!
......
......@@ -64,7 +64,6 @@ SUBROUTINE calc_exx2_gamma( sigma_exx, nb1, nb2 )
REAL(DP) :: peso
TYPE(bar_type) :: barra
INTEGER :: barra_load
INTEGER :: nq1, nq2, nq3 ! integers defining the X integration mesh
REAL(DP),ALLOCATABLE :: mysqvc(:)
REAL(DP) :: q(3)
REAL(DP) :: ecutvcut
......@@ -274,7 +273,6 @@ SUBROUTINE calc_exx2_k( sigma_exx, nb1, nb2 )
REAL(DP) :: peso
TYPE(bar_type) :: barra
INTEGER :: barra_load
INTEGER :: nq1, nq2, nq3 ! integers defining the X integration mesh
REAL(DP),ALLOCATABLE :: mysqvc(:)
REAL(DP) :: q(3)
LOGICAL :: l_gammaq
......
......@@ -136,7 +136,7 @@ END SUBROUTINE
!
!
!-----------------------------------------------------------------------
SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
SUBROUTINE chi_invert_complex(matilda,head,lambda,nma,l_gammaq)
!-----------------------------------------------------------------------
!
! For each frequency and q-point I calculate X, ky, head and lambda
......@@ -154,7 +154,7 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
!
USE kinds, ONLY : DP
USE linear_algebra_kernel, ONLY : matinvrs_zge
USE westcom, ONLY : west_prefix,n_pdep_eigen_to_use,l_macropol,l_gammaq
USE westcom, ONLY : west_prefix,n_pdep_eigen_to_use,l_macropol
USE io_files, ONLY : tmp_dir
!
! I/O
......@@ -162,6 +162,7 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
COMPLEX(DP),INTENT(IN) :: matilda(nma,nma)
COMPLEX(DP),INTENT(OUT) :: head,lambda(n_pdep_eigen_to_use,n_pdep_eigen_to_use)
INTEGER,INTENT(IN) :: nma
LOGICAL,OPTIONAL :: l_gammaq
!
! Workspace
!
......@@ -175,6 +176,13 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
COMPLEX(DP),ALLOCATABLE :: templ(:,:)
COMPLEX(DP) :: tempt(3,3)
COMPLEX(DP) :: ky,Zone,Zzero
LOGICAL :: l_dohead
!
IF( PRESENT(l_gammaq) ) THEN
l_dohead = l_macropol .AND. l_gammaq
ELSE
l_dohead = l_macropol
ENDIF
!
ALLOCATE( body(n_pdep_eigen_to_use,n_pdep_eigen_to_use) )
ALLOCATE( x(n_pdep_eigen_to_use,n_pdep_eigen_to_use) )
......@@ -188,7 +196,7 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
ENDDO
ENDDO
!
IF(l_macropol .AND. l_gammaq) THEN
IF(l_dohead) THEN
!
f = Zzero
DO i1 = 1, 3
......@@ -219,7 +227,7 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
!
CALL matinvrs_zge(n_pdep_eigen_to_use,x)
!
IF(l_macropol .AND. l_gammaq) THEN
IF(l_dohead) THEN
!
! temph = X * wh
ALLOCATE( temph(n_pdep_eigen_to_use,3) )
......@@ -251,7 +259,7 @@ SUBROUTINE chi_invert_complex(matilda,head,lambda,nma)
CALL ZGEMM( 'N', 'N', n_pdep_eigen_to_use, n_pdep_eigen_to_use, n_pdep_eigen_to_use, Zone, x, n_pdep_eigen_to_use, &
& body, n_pdep_eigen_to_use, Zzero, lambda, n_pdep_eigen_to_use )
!
IF( l_macropol .AND. l_gammaq ) THEN
IF( l_dohead ) THEN
CALL ZGEMM( 'N', 'N', n_pdep_eigen_to_use, n_pdep_eigen_to_use, 3, Zone/(3._DP*ky), temph, &
& n_pdep_eigen_to_use, templ, 3, Zone, lambda, n_pdep_eigen_to_use )
DEALLOCATE( temph )
......
......@@ -341,7 +341,7 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
USE kinds, ONLY : DP
USE westcom, ONLY : sqvc,west_prefix,n_pdep_eigen_to_use,n_lanczos,npwq,qp_bandrange,iks_l2g,&
& l_enable_lanczos,nbnd_occ,iuwfc,lrwfc,o_restart_time,npwqx,fftdriver, &
& wstat_save_dir,l_gammaq,ngq,igq_q,isz
& wstat_save_dir,ngq,igq_q,isz
USE mp_global, ONLY : my_image_id,nimage,inter_image_comm,intra_bgrp_comm,inter_pool_comm
USE mp, ONLY : mp_bcast,mp_barrier,mp_sum
USE io_global, ONLY : stdout, ionode
......@@ -498,12 +498,11 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
!
CALL preallocate_solvegfreq_q( iks_l2g(ikks), iks_l2g(iks), qp_bandrange(1), qp_bandrange(2), pert)
!
l_gammaq = q_grid_aux%l_gammap(iq)
npwq = ngq(iq)
!
! compute Coulomb potential
!
IF (l_gammaq) THEN
IF ( q_grid_aux%l_gammap(iq) ) THEN
CALL store_sqvc(sqvc,npwq,1,isz,.FALSE.)
ELSE
CALL store_sqvc_q(sqvc,npwq,1,iq,.TRUE.)
......
......@@ -36,7 +36,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
USE kinds, ONLY : DP
USE westcom, ONLY : sqvc,west_prefix,n_pdep_eigen_to_use,n_lanczos,npwq,l_macropol,iks_l2g,d_epsm1_ifr,z_epsm1_rfr,&
& l_enable_lanczos,nbnd_occ,iuwfc,lrwfc,wfreq_eta,imfreq_list,refreq_list,tr2_dfpt,l_gammaq,isz,&
& l_enable_lanczos,nbnd_occ,iuwfc,lrwfc,wfreq_eta,imfreq_list,refreq_list,tr2_dfpt,isz,&
& z_head_rfr,d_head_ifr,o_restart_time,l_skip_nl_part_of_hcomr,npwqx,fftdriver, wstat_save_dir
USE mp_global, ONLY : my_image_id,nimage,inter_image_comm,intra_bgrp_comm
USE mp_world, ONLY : mpime
......@@ -160,7 +160,6 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
CALL start_bar_type ( barra, 'wlanczos', barra_load )
ENDIF
!
l_gammaq = .TRUE.
CALL store_sqvc(sqvc,npwq,1,isz,.FALSE.)
!
! LOOP
......@@ -609,7 +608,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!-----------------------------------------------------------------------
!
USE kinds, ONLY : DP
USE westcom, ONLY : sqvc,west_prefix,n_pdep_eigen_to_use,n_lanczos,npwq,l_macropol,iks_l2g,z_epsm1_ifr_q,l_gammaq,&
USE westcom, ONLY : sqvc,west_prefix,n_pdep_eigen_to_use,n_lanczos,npwq,l_macropol,iks_l2g,z_epsm1_ifr_q,&
& z_epsm1_rfr_q,l_enable_lanczos,nbnd_occ,iuwfc,lrwfc,wfreq_eta,imfreq_list,refreq_list,tr2_dfpt,&
& z_head_rfr,z_head_ifr,o_restart_time,l_skip_nl_part_of_hcomr,npwqx,fftdriver, wstat_save_dir,&
& ngq, igq_q, isz
......@@ -679,6 +678,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
COMPLEX(DP),ALLOCATABLE :: zmati_q(:,:,:,:)
COMPLEX(DP),ALLOCATABLE :: zmatr_q(:,:,:,:)
LOGICAL :: l_iks_skip, l_iv_skip
LOGICAL :: l_gammaq
REAL(DP) :: time_spent(2)
REAL(DP),EXTERNAL :: get_clock
TYPE(bks_type) :: bks
......@@ -960,9 +960,10 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
ELSE
!
ipol = glob_ip-n_pdep_eigen_to_use
!
IF (l_gammaq) dvpsi(:,ip) = phi(:,ipol) * DSQRT(fpi * e2)
IF (l_gammaq) THEN
ipol = glob_ip-n_pdep_eigen_to_use
dvpsi(:,ip) = phi(:,ipol) * DSQRT(fpi * e2)
ENDIF
!
ENDIF
!
......@@ -1186,7 +1187,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
CALL mp_sum( zmatilda, inter_image_comm )
!
CALL chi_invert_complex( zmatilda, zhead, zlambda, mypara%nglob)
CALL chi_invert_complex( zmatilda, zhead, zlambda, mypara%nglob, l_gammaq)
!
DO ip = 1, pert%nloc
glob_ip = pert%l2g(ip)
......@@ -1225,13 +1226,13 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
ENDDO
!
CALL mp_sum( zmatilda, inter_image_comm )
CALL chi_invert_complex( zmatilda, zhead, zlambda, mypara%nglob)
CALL chi_invert_complex( zmatilda, zhead, zlambda, mypara%nglob, l_gammaq)
!
DO ip = 1, pert%nloc
glob_ip = pert%l2g(ip)
z_epsm1_rfr_q(1:n_pdep_eigen_to_use,ip,ifreq,iq) = zlambda( 1:n_pdep_eigen_to_use, glob_ip)
ENDDO
IF( l_macropol .AND. l_gammaq ) z_head_rfr( ifreq) = zhead
IF( l_macropol .AND. l_gammaq ) z_head_rfr( ifreq ) = zhead
!
ENDDO
!
......@@ -1251,14 +1252,13 @@ END SUBROUTINE
SUBROUTINE output_eps_head( )
!
USE kinds, ONLY : DP
USE westcom, ONLY : d_head_ifr,z_head_ifr,z_head_rfr,refreq_list,l_macropol,imfreq_list,wfreq_save_dir,l_gammaq
USE westcom, ONLY : d_head_ifr,z_head_ifr,z_head_rfr,refreq_list,l_macropol,imfreq_list,wfreq_save_dir
USE constants, ONLY : rytoev,fpi
!USE west_io, ONLY : serial_table_output
USE mp_world, ONLY : mpime,root
USE distribution_center, ONLY : ifr,rfr
USE mp, ONLY : mp_sum
USE mp_global, ONLY : intra_bgrp_comm
USE control_flags, ONLY : gamma_only
USE bar, ONLY : bar_type,start_bar_type,update_bar_type,stop_bar_type
USE io_push, ONLY : io_push_title,io_push_bar
USE io_global, ONLY : stdout
......@@ -1280,7 +1280,7 @@ SUBROUTINE output_eps_head( )
TYPE(json_file) :: json
INTEGER :: iunit
!
IF(l_macropol .AND. l_gammaq) THEN
IF(l_macropol) THEN
!
CALL io_push_title("(O)ptics")
!
......
......@@ -462,7 +462,7 @@ SUBROUTINE davidson_diago_k ( )
USE westcom, ONLY : dvg,dng,n_pdep_eigen,trev_pdep,n_pdep_maxiter,n_pdep_basis,wstat_calculation,ev,conv,&
& n_pdep_restart_from_itr,n_pdep_read_from_file,n_steps_write_restart,n_pdep_times,&
& trev_pdep_rel,tr2_dfpt,l_is_wstat_converged, &
& sqvc,isz,l_gammaq,ngq,npwq,igq_q,npwqx,current_iq
& sqvc,isz,ngq,npwq,igq_q,npwqx
USE pdep_db, ONLY : pdep_db_write,pdep_db_read
USE wstat_restart, ONLY : wstat_restart_write, wstat_restart_clear, wstat_restart_read
USE mp_world, ONLY : mpime
......@@ -578,15 +578,13 @@ SUBROUTINE davidson_diago_k ( )
notcnv = nvec
dav_iter = -2
!
l_gammaq = q_grid%l_gammap(iq)
!
! set local number of G vectors for perturbation at q
!
npwq = ngq(iq)
!
! compute Coulomb potential
!
IF (l_gammaq) THEN
IF ( q_grid%l_gammap(iq) ) THEN
CALL store_sqvc(sqvc,npwq,1,isz,.TRUE.)
ELSE
CALL store_sqvc_q(sqvc,npwq,1,iq,.TRUE.)
......@@ -619,8 +617,7 @@ SUBROUTINE davidson_diago_k ( )
!
IF ( .NOT. l_restart_q_done ) THEN
!
current_iq = iq
CALL wstat_restart_read( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, lastdone_iq )
CALL wstat_restart_read( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, lastdone_iq, iq )
!
IF ( iq < lastdone_iq ) THEN
CYCLE QPOINTS_LOOP
......
......@@ -461,12 +461,12 @@ MODULE wstat_restart
END SUBROUTINE
!
!------------------------------------------------------------------------
SUBROUTINE wstat_restart_read_complex( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, lastdone_iq)
SUBROUTINE wstat_restart_read_complex( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, lastdone_iq, iq )
!------------------------------------------------------------------------
!
USE mp_global, ONLY : world_comm
USE mp, ONLY : mp_barrier
USE westcom, ONLY : n_pdep_eigen,west_prefix,n_pdep_basis,wstat_restart_dir,current_iq
USE westcom, ONLY : n_pdep_eigen,west_prefix,n_pdep_basis,wstat_restart_dir
USE io_global, ONLY : stdout
USE distribution_center, ONLY : pert
USE class_bz_grid, ONLY : bz_grid
......@@ -480,7 +480,8 @@ MODULE wstat_restart
REAL(DP),INTENT(OUT) :: ew(n_pdep_basis)
COMPLEX(DP),INTENT(OUT) :: hr_distr(n_pdep_basis,pert%nlocx)
COMPLEX(DP),INTENT(OUT) :: vr_distr(n_pdep_basis,pert%nlocx)
INTEGER, INTENT(OUT), OPTIONAL :: lastdone_iq
INTEGER, INTENT(OUT) :: lastdone_iq
INTEGER, INTENT(IN) :: iq
!
! Workspace
!
......@@ -497,19 +498,11 @@ MODULE wstat_restart
CALL start_clock('wstat_restart')
time_spent(1)=get_clock('wstat_restart')
!
IF ( PRESENT(lastdone_iq) ) THEN
CALL read_restart12_( dav_iter, notcnv, nbase, ew, lastdone_iq )
ELSE
CALL read_restart12_( dav_iter, notcnv, nbase, ew )
ENDIF
CALL read_restart12_( dav_iter, notcnv, nbase, ew, lastdone_iq )
!
CALL read_restart3z_( hr_distr, vr_distr )
!
IF ( PRESENT(lastdone_iq) ) THEN
CALL read_restart4_( nbase, lastdone_iq )
ELSE
CALL read_restart4_( nbase )
ENDIF
CALL read_restart4_( nbase, lastdone_iq )
!
! BARRIER