Commit 6cdafa6c authored by mahe's avatar mahe
Browse files

parallel macropol for q-point case

parent b0f22b25
......@@ -533,6 +533,8 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
ENDDO ! BANDS
!
IF(l_macropol) DEALLOCATE(phis)
!
DEALLOCATE(dvpsi)
!
ENDDO ! KPOINT-SPIN
......@@ -644,7 +646,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
USE noncollin_module, ONLY : noncolin,npol
USE buffers, ONLY : get_buffer
USE bar, ONLY : bar_type,start_bar_type,update_bar_type,stop_bar_type
USE distribution_center, ONLY : pert,macropert,ifr,rfr
USE distribution_center, ONLY : pert,macropert,ifr,rfr,occband
USE class_idistribute, ONLY : idistribute
USE wfreq_restart, ONLY : solvewfreq_restart_write,solvewfreq_restart_read,bksq_type
USE types_bz_grid, ONLY : k_grid, q_grid, compute_phase
......@@ -659,7 +661,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
! Workspace
!
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,iks,ik,is,iq,ikqs,ikq,ipol,m
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,ivloc,iks,ik,is,iq,ikqs,ikq,ipol,m
CHARACTER(LEN=25) :: filepot
CHARACTER(LEN=:),ALLOCATABLE :: fname
CHARACTER(LEN=6) :: my_label_b
......@@ -670,7 +672,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
COMPLEX(DP),ALLOCATABLE :: braket(:, :, :)
COMPLEX(DP),ALLOCATABLE :: q_s( :, :, : )
COMPLEX(DP),ALLOCATABLE :: dvpsi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:), phis(:,:,:)
COMPLEX(DP),ALLOCATABLE :: phi_tmp(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP),ALLOCATABLE :: evckpq(:,:)
......@@ -849,23 +851,25 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
bksq%max_band = nbndval
bksq%min_band = 1
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
! MACROPOL CASE
!
DO iv = 1, nbndval
IF(iq==bksq%lastdone_q .AND. iks==bksq%lastdone_ks .AND. iv <= bksq%lastdone_band ) CYCLE
IF(l_macropol .AND. l_gammaq) THEN
!
! MACROPOL CASE
! PHI
!
IF(l_macropol .AND. l_gammaq) THEN
CALL occband%init(nbndval,'i','occband',.TRUE.)
!
ALLOCATE(phis(npwx*npol,3,occband%nloc))
!
phis = 0._DP
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
!
DO ivloc = 1, occband%nloc
!
! PHI
iv = occband%l2g(ivloc)
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
CALL commutator_Hx_psi (iks, 1, 1, evc(1,iv), phi_tmp(1,1), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 2, evc(1,iv), phi_tmp(1,2), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 3, evc(1,iv), phi_tmp(1,3), l_skip_nl_part_of_hcomr)
......@@ -898,10 +902,40 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
WRITE(stdout, '(7X,"** WARNING : MACROPOL not converged, ierr = ",i8)') ierr
ENDIF
!
phis(:,:,ivloc) = phi(:,:)
!
DEALLOCATE( eprec )
DEALLOCATE( e )
DEALLOCATE( phi_tmp )
!
END DO
!
DEALLOCATE( phi, phi_tmp )
!
ENDIF ! macropol
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
!
DO iv = 1, nbndval
IF(iq==bksq%lastdone_q .AND. iks==bksq%lastdone_ks .AND. iv <= bksq%lastdone_band ) CYCLE
!
! MACROPOL CASE
!
IF(l_macropol .AND. l_gammaq) THEN
!
ALLOCATE(phi(npwx*npol,3))
phi = 0._DP
!
DO ivloc = 1, occband%nloc
IF( occband%l2g(ivloc) == iv ) THEN
phi(:,:) = phis(:,:,ivloc)
ENDIF
END DO
!
CALL mp_sum(phi, inter_image_comm)
!
ENDIF
!
......@@ -1156,6 +1190,8 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
ENDDO ! BANDS
!
IF(l_macropol .AND. l_gammaq) DEALLOCATE(phis)
!
DEALLOCATE(dvpsi)
!
ENDDO ! KPOINT-SPIN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment