Commit e8a96bc5 authored by Matteo Gerosa's avatar Matteo Gerosa
Browse files

Reviewed restart in W. Works correctly.

parent fcc1ddfc
......@@ -25,14 +25,14 @@ MODULE wfreq_restart
TYPE :: bks_type
INTEGER :: lastdone_q
INTEGER :: lastdone_ks
INTEGER :: lastdone_ki
INTEGER :: lastdone_band
INTEGER :: old_q
INTEGER :: old_ks
INTEGER :: old_ki
INTEGER :: old_band
INTEGER :: max_q
INTEGER :: max_ks
INTEGER :: max_band
INTEGER :: min_q
INTEGER :: min_ks
INTEGER :: min_band
END TYPE bks_type
......@@ -149,8 +149,10 @@ MODULE wfreq_restart
CALL iotk_write_dat( iunout, "old_q" , bks%old_q )
CALL iotk_write_dat( iunout, "old_ks" , bks%old_ks )
CALL iotk_write_dat( iunout, "old_band" , bks%old_band )
CALL iotk_write_dat( iunout, "max_q" , bks%max_q )
CALL iotk_write_dat( iunout, "max_ks" , bks%max_ks )
CALL iotk_write_dat( iunout, "max_band" , bks%max_band )
CALL iotk_write_dat( iunout, "min_q" , bks%min_q )
CALL iotk_write_dat( iunout, "min_ks" , bks%min_ks )
CALL iotk_write_dat( iunout, "min_band" , bks%min_band )
CALL iotk_write_end( iunout, "BKS-SUMMARY" )
......@@ -270,8 +272,10 @@ MODULE wfreq_restart
CALL iotk_scan_dat( iunout, "old_q" , bks%old_q )
CALL iotk_scan_dat( iunout, "old_ks" , bks%old_ks )
CALL iotk_scan_dat( iunout, "old_band" , bks%old_band )
CALL iotk_scan_dat( iunout, "max_q" , bks%max_q )
CALL iotk_scan_dat( iunout, "max_ks" , bks%max_ks )
CALL iotk_scan_dat( iunout, "max_band" , bks%max_band )
CALL iotk_scan_dat( iunout, "min_q" , bks%min_q )
CALL iotk_scan_dat( iunout, "min_ks" , bks%min_ks )
CALL iotk_scan_dat( iunout, "min_band" , bks%min_band )
CALL iotk_scan_end( iunout, "BKS-SUMMARY" )
......@@ -286,8 +290,10 @@ MODULE wfreq_restart
CALL mp_bcast( bks%old_q , root , world_comm )
CALL mp_bcast( bks%old_ks , root , world_comm )
CALL mp_bcast( bks%old_band , root , world_comm )
CALL mp_bcast( bks%max_q , root , world_comm )
CALL mp_bcast( bks%max_ks , root , world_comm )
CALL mp_bcast( bks%max_band , root , world_comm )
CALL mp_bcast( bks%min_q , root , world_comm )
CALL mp_bcast( bks%min_ks , root , world_comm )
CALL mp_bcast( bks%min_band , root , world_comm )
!
......
......@@ -414,13 +414,15 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
CALL solvegfreq_restart_read( bks )
ELSE
bks%lastdone_ks = 0
bks%lastdone_ki = 0
bks%lastdone_q = 0
bks%lastdone_band = 0
bks%old_ks = 0
bks%old_ki = 0
bks%old_q = 0
bks%old_band = 0
bks%max_ks = k_grid%nps
bks%min_ks = 1
bks%max_q = k_grid%nps
bks%min_q = 1
ENDIF
!
ALLOCATE( evck(npwx*npol,nbnd) )
......@@ -433,11 +435,14 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
!
barra_load = 0
DO ikks = 1, k_grid%nps
ikk = k_grid%ip(ikks)
IF(ikks<bks%lastdone_ks) CYCLE
DO ib = qp_bandrange(1), qp_bandrange(2)
IF(ikks==bks%lastdone_ks .AND. ib < bks%lastdone_band ) CYCLE
DO iks = 1, k_grid%nps
IF (ikks==bks%lastdone_ks .AND. ib == bks%lastdone_band .AND. iks <= bks%lastdone_ki) CYCLE
ik = k_grid%ip(iks)
CALL q_grid%find( k_grid%p_cart(:,ikk) - k_grid%p_cart(:,ik), 1, 'cart', iq, g0 )
IF (ikks==bks%lastdone_ks .AND. ib == bks%lastdone_band .AND. iq <= bks%lastdone_q) CYCLE
barra_load = barra_load + 1
ENDDO
ENDDO
......@@ -487,13 +492,13 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
ENDIF
!
DO iks = 1, k_grid%nps ! KPOINT-SPIN (INTEGRAL OVER K')
IF (ikks==bks%lastdone_ks .AND. ib==bks%lastdone_band .AND. iks <= bks%lastdone_ki) CYCLE
!
ik = k_grid%ip(iks)
!
time_spent(1) = get_clock( 'glanczos' )
!
CALL q_grid%find( k_grid%p_cart(:,ikk) - k_grid%p_cart(:,ik), 1, 'cart', iq, g0 )
IF (ikks==bks%lastdone_ks .AND. ib==bks%lastdone_band .AND. iq <= bks%lastdone_q) CYCLE
!
CALL preallocate_solvegfreq_q( iks_l2g(ikks), iks_l2g(iks), qp_bandrange(1), qp_bandrange(2), pert)
!
......@@ -651,11 +656,11 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
IF( o_restart_time >= 0._DP ) THEN
IF( (time_spent(2)-time_spent(1)) > o_restart_time*60._DP .OR. ib == qp_bandrange(2) ) THEN
bks%lastdone_ks=ikks
bks%lastdone_ki=iks
bks%lastdone_q=iq
bks%lastdone_band=ib
CALL solvegfreq_restart_write( bks )
bks%old_ks=ikks
bks%old_ki=iks
bks%old_q=iq
bks%old_band=ib
time_spent(1) = get_clock( 'glanczos' )
ENDIF
......
......@@ -737,7 +737,9 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
bks%old_ks = 0
bks%old_q = 0
bks%old_band = 0
bks%max_q = q_grid%np
bks%max_ks = k_grid%np
bks%min_q = 1
bks%min_ks = 1
ENDIF
!
......@@ -745,9 +747,9 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
DO iq = 1, q_grid%np
IF (iq<bks%lastdone_q) CYCLE
DO iks = 1, k_grid%nps
IF(iks<bks%lastdone_ks) CYCLE
IF(iq==bks%lastdone_q .AND. iks<bks%lastdone_ks) CYCLE
DO iv = 1, nbnd_occ(iks)
IF(iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
IF(iq==bks%lastdone_q .AND. iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
barra_load = barra_load + 1
ENDDO
ENDDO
......@@ -902,7 +904,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
! ELSE
IF(noncolin) THEN
CALL single_invfft_k(dffts,npwkq,npwx,evckpq(1 ,iv),psick_nc(1,1),'Wave',igk_k(1,ikqs))
CALL single_invfft_k(dffts,npwkq,npwx,evckpq(1+npwx,iv),psick_nc(1,2),'Wave',igk_k(1,ikqs))
CALL single_invfft_k(dffts,npwkq,npwx,evckpq(npwx+1,iv),psick_nc(1,2),'Wave',igk_k(1,ikqs))
ELSE
CALL single_invfft_k(dffts,npwkq,npwx,evckpq(1,iv),psick,'Wave',igk_k(1,ikqs))
ENDIF
......@@ -954,7 +956,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
DO ir=1,dffts%nnr
pertr(ir)=phase(ir)*psick_nc(ir,2)*DCONJG(pertr(ir))
ENDDO
CALL single_fwfft_k(dffts,npw,npwx,pertr,dvpsi(1+npwx,ip),'Wave',igk_k(1,current_k))
CALL single_fwfft_k(dffts,npw,npwx,pertr,dvpsi(npwx+1,ip),'Wave',igk_k(1,current_k))
ELSE
CALL single_invfft_k(dffts,npwq,npwqx,pertg(1),pertr,'Wave',igq_q(1,iq))
DO ir=1,dffts%nnr
......@@ -1145,7 +1147,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
bks%lastdone_q=iq
bks%lastdone_ks=iks
bks%lastdone_band=iv
CALL solvewfreq_restart_write(bks,zmati_q(:,:,:,iq),zmatr_q(:,:,:,iq),mypara%nglob,mypara%nloc)
CALL solvewfreq_restart_write(bks,zmati_q(:,:,:,:),zmatr_q(:,:,:,:),mypara%nglob,mypara%nloc)
bks%old_q = iq
bks%old_ks = iks
bks%old_band = iv
......
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