Commit 7024fc76 authored by Marco Govoni's avatar Marco Govoni
Browse files

Merge branch 'develop' into 'doc_improvement'

# Conflicts:
#   IO_kernel/pdep_io.f90
#   Wfreq/solve_gfreq.f90
#   Wfreq/solve_wfreq.f90
parents 89215e18 0d29121a
......@@ -15,9 +15,9 @@ MODULE pdep_io
!----------------------------------------------------------------------------
!
USE kinds, ONLY : DP
USE mp_global, ONLY : me_bgrp,root_bgrp,nproc_bgrp,intra_bgrp_comm,my_pool_id,my_bgrp_id,inter_bgrp_comm,inter_pool_comm,&
& intra_pool_comm
USE westcom, ONLY : npwq, npwq_g, npwqx, ngq, ngq_g, npwqx, igq_q !, igq_l2g_kdip
USE mp_global, ONLY : me_bgrp,root_bgrp,nproc_bgrp,intra_bgrp_comm,my_pool_id,&
& my_bgrp_id,inter_bgrp_comm,inter_pool_comm,intra_pool_comm
USE westcom, ONLY : npwq,npwq_g,npwqx,ngq,ngq_g,igq_q
USE gvect, ONLY : ig_l2g
USE json_module, ONLY : json_file
USE control_flags, ONLY : gamma_only
......@@ -36,7 +36,7 @@ MODULE pdep_io
SUBROUTINE pdep_merge_and_write_G(fname,pdepg,iq)
!
USE mp_wave, ONLY : mergewf
USE mp, ONLY : mp_bcast, mp_max
USE mp, ONLY : mp_bcast,mp_max
!
IMPLICIT NONE
!
......@@ -49,7 +49,7 @@ MODULE pdep_io
! Workspace
!
COMPLEX(DP),ALLOCATABLE :: tmp_vec(:)
INTEGER :: iun,ierr,ig
INTEGER :: ig
CHARACTER(LEN=:),ALLOCATABLE :: charbase64
INTEGER :: nbytes, ndim, iunit, nlen
CHARACTER(LEN=30) :: endian
......@@ -58,6 +58,8 @@ MODULE pdep_io
INTEGER, PARAMETER :: default_iq = 1
INTEGER :: iq_
!
CALL start_clock('pdep_write')
!
IF( PRESENT(iq) ) THEN
iq_ = iq
ELSE
......@@ -85,9 +87,9 @@ MODULE pdep_io
!
! </NEW>
!
! npwq_g = MAXVAL(igq_l2g_kdip(1:ndim,iq))
! CALL mp_max(npwq_g,intra_pool_comm)
! CALL mp_max(npwq_g,intra_bgrp_comm)
! npwq_g = MAXVAL(igq_l2g_kdip(1:ndim,iq))
! CALL mp_max(npwq_g,intra_pool_comm)
! CALL mp_max(npwq_g,intra_bgrp_comm)
!
ALLOCATE( tmp_vec(npwq_g) )
tmp_vec=0._DP
......@@ -167,6 +169,8 @@ MODULE pdep_io
!
ENDIF
!
CALL stop_clock('pdep_write')
!
END SUBROUTINE
!
! ******************************************
......@@ -194,7 +198,7 @@ MODULE pdep_io
!
TYPE(json_file) :: json
COMPLEX(DP),ALLOCATABLE :: tmp_vec(:)
INTEGER :: iun,ierr,ig
INTEGER :: ig
CHARACTER(LEN=1000) :: line
CHARACTER(LEN=:),ALLOCATABLE :: charbase64
CHARACTER(LEN=:),ALLOCATABLE :: endian
......@@ -205,6 +209,8 @@ MODULE pdep_io
INTEGER, PARAMETER :: default_iq = 1
INTEGER :: iq_
!
CALL start_clock('pdep_read')
!
IF( PRESENT(iq) ) THEN
iq_ = iq
ELSE
......@@ -216,9 +222,9 @@ MODULE pdep_io
! Resume all components
!
ndim = ngq_g(iq_)
! npwq_g = MAXVAL(igq_l2g_kdip(1:ndim,iq))
! CALL mp_max(npwq_g,intra_pool_comm)
! CALL mp_max(npwq_g,intra_bgrp_comm)
! npwq_g = MAXVAL(igq_l2g_kdip(1:ndim,iq))
! CALL mp_max(npwq_g,intra_pool_comm)
! CALL mp_max(npwq_g,intra_bgrp_comm)
!
ALLOCATE( tmp_vec(npwq_g) )
tmp_vec=0._DP
......@@ -326,6 +332,8 @@ MODULE pdep_io
!
ENDIF
!
CALL stop_clock('pdep_read')
!
END SUBROUTINE
!
END MODULE
......@@ -50,13 +50,11 @@ SUBROUTINE solve_gfreq_gamma(l_read_restart)
USE wavefunctions_module, ONLY : evc,psic,psic_nc
USE io_files, ONLY : tmp_dir,nwordwfc,iunwfc
USE fft_at_gamma, ONLY : single_invfft_gamma,single_fwfft_gamma
! USE fft_at_k, ONLY : SINGLEBAND_INVFFT_k,SINGLEBAND_FWFFT_k
USE becmod, ONLY : becp,allocate_bec_type,deallocate_bec_type
USE uspp, ONLY : vkb,nkb
USE pdep_db, ONLY : generate_pdep_fname
USE pdep_io, ONLY : pdep_read_G_and_distribute
USE io_push, ONLY : io_push_title
! USE control_flags, ONLY : gamma_only
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
......@@ -84,6 +82,7 @@ SUBROUTINE solve_gfreq_gamma(l_read_restart)
COMPLEX(DP),ALLOCATABLE :: q_s( :, :, : )
COMPLEX(DP),ALLOCATABLE :: dvpsi(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP),ALLOCATABLE :: pertg_all(:,:)
REAL(DP),ALLOCATABLE :: ps_r(:,:)
TYPE(bar_type) :: barra
INTEGER :: barra_load
......@@ -129,6 +128,18 @@ SUBROUTINE solve_gfreq_gamma(l_read_restart)
CALL start_bar_type( barra, 'glanczos', barra_load )
ENDIF
!
! Read PDEP
!
ALLOCATE(pertg_all(npwqx,pert%nloc))
pertg_all = 0._DP
!
DO ip = 1,pert%nloc
glob_ip = pert%l2g(ip)
CALL generate_pdep_fname(filepot,glob_ip)
fname = TRIM(wstat_save_dir)//"/"//filepot
CALL pdep_read_G_and_distribute(fname,pertg_all(:,ip))
ENDDO
!
! LOOP
!
DO iks = 1, k_grid%nps ! KPOINT-SPIN
......@@ -196,19 +207,12 @@ SUBROUTINE solve_gfreq_gamma(l_read_restart)
!
dvpsi = 0._DP
!
! Read PDEP
!
ALLOCATE( pertg(npwqx) )
ALLOCATE( pertg( npwqx ) )
ALLOCATE( pertr( dffts%nnr ) )
!
DO ip=1,pert%nloc
glob_ip = pert%l2g(ip)
!
! Exhume dbs eigenvalue
!
CALL generate_pdep_fname( filepot, glob_ip )
fname = TRIM( wstat_save_dir ) // "/"// filepot
CALL pdep_read_G_and_distribute(fname,pertg)
pertg = pertg_all(:,ip)
!
! Multiply by sqvc
!pertg(:) = sqvc(:) * pertg(:) ! / SQRT(fpi*e2) ! CONTROLLARE QUESTO
......@@ -306,6 +310,7 @@ SUBROUTINE solve_gfreq_gamma(l_read_restart)
!
ENDDO ! KPOINT-SPIN
!
DEALLOCATE(pertg_all)
!
CALL stop_bar_type( barra, 'glanczos' )
!
......@@ -526,7 +531,7 @@ SUBROUTINE solve_gfreq_k(l_read_restart)
!
! Read PDEP
!
ALLOCATE( pertg(npwqx) )
ALLOCATE( pertg( npwqx ) )
ALLOCATE( pertr( dffts%nnr ) )
!
DO ip=1,pert%nloc
......
......@@ -88,6 +88,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
COMPLEX(DP),ALLOCATABLE :: phi(:,:), phis(:,:,:)
COMPLEX(DP),ALLOCATABLE :: phi_tmp(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP),ALLOCATABLE :: pertg_all(:,:)
COMPLEX(DP) :: zkonstant
TYPE(bar_type) :: barra
INTEGER :: barra_load
......@@ -165,6 +166,20 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
CALL pot3D%init('Wave',.FALSE.,'default')
!
! Read PDEP
!
ALLOCATE(pertg_all(npwqx,mypara%nloc))
pertg_all = 0._DP
!
DO ip = 1,mypara%nloc
glob_ip = mypara%l2g(ip)
IF(glob_ip <= n_pdep_eigen_to_use) THEN
CALL generate_pdep_fname(filepot,glob_ip)
fname = TRIM(wstat_save_dir)//"/"//filepot
CALL pdep_read_G_and_distribute(fname,pertg_all(:,ip))
ENDIF
ENDDO
!
! LOOP
!
DO iks = 1, k_grid%nps ! KPOINT-SPIN
......@@ -312,9 +327,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
dvpsi = 0._DP
!
! Read PDEP
!
ALLOCATE( pertg(npwqx) )
ALLOCATE( pertg( npwqx ) )
ALLOCATE( pertr( dffts%nnr ) )
!
DO ip=1,mypara%nloc
......@@ -325,11 +338,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
IF(glob_ip<=n_pdep_eigen_to_use) THEN
!
! Exhume dbs eigenvalue
!
CALL generate_pdep_fname( filepot, glob_ip )
fname = TRIM( wstat_save_dir ) // "/"// filepot
CALL pdep_read_G_and_distribute(fname,pertg)
pertg = pertg_all(:,ip)
!
! Multiply by sqvc
DO ig = 1, npwq
......@@ -539,6 +548,8 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
ENDDO ! KPOINT-SPIN
!
DEALLOCATE(pertg_all)
!
CALL stop_bar_type( barra, 'wlanczos' )
!
! EPS-1 imfreq
......@@ -675,6 +686,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
COMPLEX(DP),ALLOCATABLE :: phi(:,:), phis(:,:,:)
COMPLEX(DP),ALLOCATABLE :: phi_tmp(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP),ALLOCATABLE :: pertg_all(:,:)
COMPLEX(DP),ALLOCATABLE :: evckpq(:,:)
COMPLEX(DP),ALLOCATABLE :: psick(:),psick_nc(:,:)
COMPLEX(DP),ALLOCATABLE :: phase(:)
......@@ -780,6 +792,20 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
CALL pot3D%init('Wave',.TRUE.,'default',iq)
!
! Read PDEP
!
ALLOCATE(pertg_all(npwqx,mypara%nloc))
pertg_all = 0._DP
!
DO ip = 1,mypara%nloc
glob_ip = mypara%l2g(ip)
IF(glob_ip <= n_pdep_eigen_to_use) THEN
CALL generate_pdep_fname(filepot,glob_ip,iq)
fname = TRIM(wstat_save_dir)//"/"//filepot
CALL pdep_read_G_and_distribute(fname,pertg_all(:,ip),iq)
ENDIF
ENDDO
!
DO iks = 1, k_grid%nps ! KPOINT-SPIN
!
ik = k_grid%ip(iks)
......@@ -952,9 +978,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
dvpsi = 0._DP
!
! Read PDEP
!
ALLOCATE( pertg(npwqx) )
ALLOCATE( pertg( npwqx ) )
ALLOCATE( pertr( dffts%nnr ) )
!
DO ip=1,mypara%nloc
......@@ -965,11 +989,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
IF(glob_ip<=n_pdep_eigen_to_use) THEN
!
! Exhume dbs eigenvalue
!
CALL generate_pdep_fname( filepot, glob_ip, iq )
fname = TRIM( wstat_save_dir ) // "/"// filepot
CALL pdep_read_G_and_distribute(fname,pertg,iq)
pertg = pertg_all(:,ip)
!
! Multiply by sqvc
DO ig = 1, npwq
......@@ -1196,6 +1216,8 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
ENDDO ! KPOINT-SPIN
!
DEALLOCATE(pertg_all)
!
ENDDO ! QPOINT
!
CALL stop_bar_type( barra, 'wlanczos' )
......
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