From 6937dd5d575135e3a030ae49704893da653e3afb Mon Sep 17 00:00:00 2001 From: timrov Date: Sun, 7 Feb 2016 15:10:04 +0000 Subject: [PATCH] Moved the debugging subroutines to a more logical place. git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12104 c92efa57-630b-4861-b058-cf58834340f0 --- TDDFPT/src/lr_dav_main.f90 | 3 - TDDFPT/src/lr_dot.f90 | 167 +++++++++++++++++++++++++++++++++++- TDDFPT/src/lr_lanczos.f90 | 1 - TDDFPT/src/lr_main.f90 | 4 - TDDFPT/src/lr_read_wf.f90 | 4 +- TDDFPT/src/lr_variables.f90 | 167 +----------------------------------- 6 files changed, 168 insertions(+), 178 deletions(-) diff --git a/TDDFPT/src/lr_dav_main.f90 b/TDDFPT/src/lr_dav_main.f90 index d53a427a6..761185a10 100755 --- a/TDDFPT/src/lr_dav_main.f90 +++ b/TDDFPT/src/lr_dav_main.f90 @@ -40,9 +40,6 @@ PROGRAM lr_dav_main USE plugin_flags, ONLY : use_environ USE environ_info, ONLY : environ_summary #endif - - !Debugging - USE lr_variables, ONLY: check_all_bands_gamma, check_density_gamma,check_vector_gamma ! IMPLICIT NONE INTEGER :: ibnd_occ,ibnd_virt,ibnd,ip diff --git a/TDDFPT/src/lr_dot.f90 b/TDDFPT/src/lr_dot.f90 index a67aac141..4e211fba3 100755 --- a/TDDFPT/src/lr_dot.f90 +++ b/TDDFPT/src/lr_dot.f90 @@ -1,5 +1,5 @@ ! -! Copyright (C) 2001-2015 Quantum ESPRESSO group +! Copyright (C) 2001-2016 Quantum ESPRESSO group ! This file is distributed under the terms of the ! GNU General Public License. See the file `License' ! in the root directory of the present distribution, @@ -181,3 +181,168 @@ CONTAINS ! END FUNCTION lr_dot !----------------------------------------------------------------------- + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! Debugging subroutines +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +SUBROUTINE check_vector_gamma (x) + !---------------------------------------------------------------------------- + ! Checks the inner product for a given vector, and its imaginary and real component + ! input: evc + ! output : screen output + ! + USE kinds, ONLY : dp + USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm + USE mp, ONLY : mp_sum + USE klist , ONLY : npw_k=>ngk + USE gvect, ONLY : gstart + USE io_global, ONLY : stdout + ! + IMPLICIT NONE + !input/output + COMPLEX(kind=dp),INTENT(in) :: x(:) + ! + ! local variables + ! + REAL(kind=dp) :: temp_gamma + REAL(kind=dp), EXTERNAL :: DDOT + ! + temp_gamma = 2.D0*DDOT(2*npw_k(1),x(:),1,x(:),1) + ! + IF (gstart==2) temp_gamma = temp_gamma - dble(x(1))*dble(x(1)) + ! +#ifdef __MPI + CALL mp_sum(temp_gamma, intra_bgrp_comm) +#endif + ! + WRITE(stdout,'(" = ",E15.8)') temp_gamma + ! + RETURN + ! +END SUBROUTINE check_vector_gamma + +SUBROUTINE check_vector_f (x) + !----------------------------------------------------------------------- + ! + ! Checks the inner product for a given vector, and its imaginary and real component + ! input: evc + ! output: screen output + ! + USE kinds, ONLY : dp + USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm + USE mp, ONLY : mp_sum + USE klist , ONLY : npw_k=>ngk + USE gvect, ONLY : gstart + USE io_global, ONLY : stdout + ! + IMPLICIT NONE + !input/output + COMPLEX(kind=dp),INTENT(in) :: x(:) + ! + ! local variables + ! + COMPLEX(kind=dp) :: temp_f + COMPLEX(kind=dp), EXTERNAL :: ZDOTC + ! + temp_f = ZDOTC(npw_k(1),x(:),1,x(:),1) + ! +#ifdef __MPI + CALL mp_sum(temp_f, intra_bgrp_comm) +#endif + ! + WRITE(stdout,'(" = ",2E15.8,1X)') temp_f + ! + RETURN + ! +END SUBROUTINE check_vector_f + +SUBROUTINE check_all_bands_gamma (x,sx,nbnd1,nbnd2) + !---------------------------------------------------------------------- + ! + ! Checks all bands of given KS states for orthoganilty + ! input: evc and sevc + ! output : screen output + ! + USE kinds, ONLY : dp + USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm + USE mp, ONLY : mp_sum + USE klist , ONLY : npw_k=>ngk + USE io_global, ONLY : stdout + USE gvect, ONLY : gstart + ! + IMPLICIT NONE + !input/output + INTEGER, INTENT(in) :: nbnd1,nbnd2 !Total number of bands for x and sx + COMPLEX(kind=dp),INTENT(in) :: x(:,:), sx(:,:) + ! + ! local variables + ! + INTEGER :: ibnd, jbnd + REAL(kind=dp) :: temp_gamma + REAL(kind=dp), EXTERNAL :: DDOT + ! + DO ibnd=1,nbnd1 + DO jbnd=ibnd,nbnd2 + ! + temp_gamma = 2.D0*DDOT(2*npw_k(1),x(:,ibnd),1,sx(:,jbnd),1) + ! + IF (gstart==2) temp_gamma = temp_gamma - dble(x(1,ibnd))*dble(sx(1,jbnd)) + ! +#ifdef __MPI + CALL mp_sum(temp_gamma, intra_bgrp_comm) +#endif + ! + WRITE(stdout,'(" =",E15.8)') ibnd,jbnd,temp_gamma + ENDDO + ENDDO + ! + RETURN + ! +END SUBROUTINE check_all_bands_gamma + +SUBROUTINE check_density_gamma (rx,nbnd) + !--------------------------------------------------------------------------------- + ! + ! Checks the contirbution of a given function transformed into real space + ! input: revc + ! output : screen output + ! + USE kinds, ONLY : dp + USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm + USE mp, ONLY : mp_sum + USE wvfct, ONLY : wg + USE fft_base, ONLY : dfftp + USE io_global, ONLY : stdout + USE cell_base, ONLY : omega + ! + IMPLICIT NONE + !input/output + INTEGER, INTENT(in) :: nbnd !Total number of bands for x and sx + COMPLEX(kind=dp),INTENT(in) :: rx(:,:) + ! + ! local variables + ! + INTEGER :: ibnd + REAL(kind=dp) :: temp_gamma,w1,w2 + ! + DO ibnd=1,nbnd,2 + w1 = wg(ibnd,1)/omega + ! + IF (ibnd0) ! - ! I. Timrov's comment: It is not a proper place for debugging subroutines - ! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! Debugging subroutines - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -CONTAINS - -SUBROUTINE check_vector_gamma (x) - !---------------------------------------------------------------------------- - ! Checks the inner product for a given vector, and its imaginary and real component - ! input: evc - ! output : screen output - ! - USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm - USE mp, ONLY : mp_sum - USE klist , ONLY : npw_k=>ngk - USE gvect, ONLY : gstart - USE io_global, ONLY : stdout - ! - IMPLICIT NONE - !input/output - COMPLEX(kind=dp),INTENT(in) :: x(:) - ! - ! local variables - ! - REAL(kind=dp) :: temp_gamma - REAL(kind=dp), EXTERNAL :: DDOT - ! - temp_gamma = 2.D0*DDOT(2*npw_k(1),x(:),1,x(:),1) - ! - IF (gstart==2) temp_gamma = temp_gamma - dble(x(1))*dble(x(1)) - ! -#ifdef __MPI - CALL mp_sum(temp_gamma, intra_bgrp_comm) -#endif - ! - WRITE(stdout,'(" = ",E15.8)') temp_gamma - ! - RETURN - ! -END SUBROUTINE check_vector_gamma - -SUBROUTINE check_vector_f (x) - !----------------------------------------------------------------------- - ! - ! Checks the inner product for a given vector, and its imaginary and real component - ! input: evc - ! output: screen output - ! - USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm - USE mp, ONLY : mp_sum - USE klist , ONLY : npw_k=>ngk - USE gvect, ONLY : gstart - USE io_global, ONLY : stdout - ! - IMPLICIT NONE - !input/output - COMPLEX(kind=dp),INTENT(in) :: x(:) - ! - ! local variables - ! - COMPLEX(kind=dp) :: temp_f - COMPLEX(kind=dp), EXTERNAL :: ZDOTC - ! - temp_f = ZDOTC(npw_k(1),x(:),1,x(:),1) - ! -#ifdef __MPI - CALL mp_sum(temp_f, intra_bgrp_comm) -#endif - ! - WRITE(stdout,'(" = ",2E15.8,1X)') temp_f - ! - RETURN - ! -END SUBROUTINE check_vector_f - -SUBROUTINE check_all_bands_gamma (x,sx,nbnd1,nbnd2) - !---------------------------------------------------------------------- - ! - ! Checks all bands of given KS states for orthoganilty - ! input: evc and sevc - ! output : screen output - ! - USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm - USE mp, ONLY : mp_sum - USE klist , ONLY : npw_k=>ngk - USE io_global, ONLY : stdout - USE gvect, ONLY : gstart - ! - IMPLICIT NONE - !input/output - INTEGER, INTENT(in) :: nbnd1,nbnd2 !Total number of bands for x and sx - COMPLEX(kind=dp),INTENT(in) :: x(:,:), sx(:,:) - ! - ! local variables - ! - INTEGER :: ibnd, jbnd - REAL(kind=dp) :: temp_gamma - REAL(kind=dp), EXTERNAL :: DDOT - ! - DO ibnd=1,nbnd1 - DO jbnd=ibnd,nbnd2 - ! - temp_gamma = 2.D0*DDOT(2*npw_k(1),x(:,ibnd),1,sx(:,jbnd),1) - ! - IF (gstart==2) temp_gamma = temp_gamma - dble(x(1,ibnd))*dble(sx(1,jbnd)) - ! -#ifdef __MPI - CALL mp_sum(temp_gamma, intra_bgrp_comm) -#endif - ! - WRITE(stdout,'(" =",E15.8)') ibnd,jbnd,temp_gamma - ENDDO - ENDDO - ! - RETURN - ! -END SUBROUTINE check_all_bands_gamma - -SUBROUTINE check_density_gamma (rx,nbnd) - !--------------------------------------------------------------------------------- - ! - ! Checks the contirbution of a given function transformed into real space - ! input: revc - ! output : screen output - ! - USE mp_global, ONLY : inter_pool_comm, intra_bgrp_comm - USE mp, ONLY : mp_sum - USE wvfct, ONLY : wg - USE fft_base, ONLY : dfftp - USE io_global, ONLY : stdout - USE cell_base, ONLY : omega - ! - IMPLICIT NONE - !input/output - INTEGER, INTENT(in) :: nbnd !Total number of bands for x and sx - COMPLEX(kind=dp),INTENT(in) :: rx(:,:) - ! - ! local variables - ! - INTEGER :: ibnd - REAL(kind=dp) :: temp_gamma,w1,w2 - ! - DO ibnd=1,nbnd,2 - w1 = wg(ibnd,1)/omega - ! - IF (ibnd