Commit b0f22b25 authored by mahe's avatar mahe
Browse files

first attempt to implement parallel macropol

parent 159328bf
......@@ -25,5 +25,6 @@ MODULE distribution_center
TYPE(idistribute) :: ifr
TYPE(idistribute) :: rfr
TYPE(idistribute) :: aband
TYPE(idistribute) :: occband
!
END MODULE
......@@ -61,7 +61,7 @@ SUBROUTINE solve_wfreq_gamma(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,bks_type
USE types_bz_grid, ONLY : k_grid
......@@ -76,7 +76,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
! Workspace
!
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,iks,ipol,m
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,ivloc,iks,ipol,m
CHARACTER(LEN=25) :: filepot
CHARACTER(LEN=:),ALLOCATABLE :: fname
CHARACTER(LEN=6) :: my_label_b
......@@ -85,7 +85,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
REAL(DP),ALLOCATABLE :: diago( :, : ), subdiago( :, :), bnorm(:), 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) :: zkonstant
......@@ -217,23 +217,24 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
bks%max_band = nbndval
bks%min_band = 1
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
!
DO iv = 1, nbndval
IF(iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
! Parallel macropol
IF(l_macropol) THEN
!
! MACROPOL CASE
! PHI
!
IF(l_macropol) 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)
......@@ -266,9 +267,40 @@ SUBROUTINE solve_wfreq_gamma(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(iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
!
! MACROPOL CASE
!
IF(l_macropol) 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
!
......
......@@ -25,7 +25,7 @@ SUBROUTINE wfreq_setup
USE kinds, ONLY : DP
USE gvect, ONLY : gstart,g
USE io_files, ONLY : tmp_dir
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband,occband
USE class_idistribute, ONLY : idistribute
USE wavefunctions_module, ONLY : evc
USE mod_mpiio, ONLY : set_io_comm
......@@ -64,6 +64,7 @@ SUBROUTINE wfreq_setup
CALL rfr%init(n_refreq,'z','n_refreq',.TRUE.)
aband = idistribute()
CALL aband%init(nbnd,'i','nbnd',.TRUE.)
occband = idistribute()
!
CALL set_freqlists( )
!
......
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