Cleaning and beautification of the code.

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12666 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
sponce 2016-08-04 17:30:15 +00:00
parent 3d33ec4a5c
commit c0fddb2696
9 changed files with 144 additions and 104 deletions

View File

@ -32,7 +32,6 @@
USE constants_epw, ONLY : ryd2mev, ryd2ev, kelvin2eV, two, zero
#ifdef __PARA
USE mp, ONLY : mp_barrier, mp_sum
USE mp_global, ONLY : my_pool_id, npool
USE mp_world, ONLY : mpime, world_comm
USE io_global, ONLY : ionode_id
#endif

View File

@ -23,7 +23,7 @@
USE eliashbergcom, ONLY : nkfs, ixkf, equivk, xkfs, wkfs, ekfs, nbndfs, memlt_pool
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm, npool
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
USE mp_world, ONLY : mpime
#endif
@ -203,7 +203,7 @@
USE symm_base, ONLY : nrot
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
USE mp_world, ONLY : mpime
#endif
@ -446,9 +446,7 @@
USE kinds, ONLY : DP
USE epwcom, ONLY : nkf1, nkf2, nkf3
#ifdef __PARA
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp, ONLY : mp_bcast, mp_barrier
USE mp_world, ONLY : mpime
#endif
!
IMPLICIT NONE

View File

@ -9,33 +9,44 @@
!-----------------------------------------------------------------------
SUBROUTINE createkmap ( xq )
!-----------------------------------------------------------------------
!
! This subroutine is called from elphon_shuffle_wrap for each
! nq1*nq2*nq3 phonon on the coarse mesh.
!
!
!!
!! This subroutine is called from elphon_shuffle_wrap for each
!! nq1*nq2*nq3 phonon on the coarse mesh.
!!
!!
USE kinds, ONLY : DP
USE cell_base, ONLY : at, bg
USE klist, ONLY : nkstot, xk
USE start_k, ONLY : nk1, nk2, nk3
USE epwcom, ONLY : xk_cryst
USE io_global, ONLY : stdout
USE io_files, ONLY : prefix
USE klist_epw, ONLY : kmap
USE kfold, ONLY : g0vec_all, ng0vec, shift, g0vec_all_r
! SP: iverbosity cannot be tested here. Generates Tb of data ...
! USE control_flags, ONLY : iverbosity
#ifdef __PARA
USE mp_global, ONLY : inter_pool_comm,my_pool_id
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_barrier
USE mp_world, ONLY : mpime
#endif
USE elph2, ONLY : xkq
implicit none
!
real(kind=DP) :: eps, xq (3), xk_q(3)
REAL(kind=DP), INTENT(in) :: xq (3)
!! Q-point
!
integer :: ik, jk, j
! Local variables
INTEGER :: ik
!! K-point index
INTEGER :: jk
!! other k-point index
INTEGER :: i
!! Index of the k+q in the k-grid
INTEGER :: j
!! Index of the k+q in the k-grid
INTEGER :: k
!! Index of the k+q in the k-grid
real(kind=DP) :: eps, xk_q(3)
!
! obsolete:
!
@ -60,7 +71,7 @@
!
!
real(kind=DP) :: xx, yy, zz, xx_n, yy_n, zz_n, xx_c, yy_c, zz_c
integer :: i, k, n, g0vec(3), ig0, iukmap, ig1, ig2, ig3
integer :: n, g0vec(3), ig0, iukmap, ig1, ig2, ig3
logical :: in_the_list, found
!
IF (.not. ALLOCATED(xkq) ) ALLOCATE(xkq (3, nkstot) )
@ -299,15 +310,22 @@
USE klist_epw, ONLY : kmap
USE start_k, ONLY : nk1, nk2, nk3
USE epwcom, ONLY : xk_cryst
USE io_global, ONLY : stdout
! SP: iverbosity cannot be tested. Generate too much data
! USE control_flags, ONLY : iverbosity
USE elph2, ONLY : xkq
implicit none
!
real(kind=DP) :: eps, xxq (3), xx, yy, zz, xx_c, yy_c, zz_c
integer :: n, ik, jk
! integer :: i,j,k
REAL(kind=DP), INTENT(in) :: xxq (3)
!! The current q-point
!
! Local variables
INTEGER :: ik
!! K-point index
INTEGER :: jk
!! Another k-point index
INTEGER :: n
!! Mapping index
real(kind=DP) :: eps, xx, yy, zz, xx_c, yy_c, zz_c
logical :: in_the_list, found
!
! the first proc keeps a copy of all kpoints !
@ -420,10 +438,10 @@
!-------------------------------------------------------------------------
SUBROUTINE createkmap_pw2(xk_all,nkstot,xq0)
!-------------------------------------------------------------------------
!
! Creates the first instances of [prefix].kmap and [prefix].kgmap. Previously
! this was done in PW2 (or set_kplusq, refold, etc. even earlier).
!
!!
!! Creates the first instances of [prefix].kmap and [prefix].kgmap. Previously
!! this was done in PW2 (or set_kplusq, refold, etc. even earlier).
!!
!-------------------------------------------------------------------------
USE kinds, ONLY : DP
USE pwcom, ONLY : at,bg
@ -444,7 +462,7 @@ USE kfold
USE f90_unix_io, ONLY : flush
#endif
#ifdef __PARA
USE mp_global, ONLY : inter_pool_comm, my_pool_id
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_barrier
USE mp_world, ONLY : mpime
#endif
@ -452,10 +470,14 @@ USE kfold
IMPLICIT NONE
INTEGER, INTENT(IN) :: nkstot
!! Total number of k-points
REAL(kind=DP), INTENT(IN) :: xq0(3)
!! K-point coordinate
REAL(kind=DP), INTENT(IN), DIMENSION(3,nkstot) :: xk_all
real(kind=DP) :: xkq_all(3,nkstot)
!! All the k-points coordinate among all pools
!
! Local variables
REAL(kind=DP) :: xq0(3)
real(kind=DP) :: xkq_all(3,nkstot)
INTEGER:: ik, jk, j
REAL(KIND=DP) :: xx, yy, zz, xx_n, yy_n, zz_n, xx_c, yy_c, zz_c, eps
INTEGER :: i,k,n,g0vec(3),ig0,iukmap,iukgmap,ig_1,ig_2,ig_3, s
@ -520,7 +542,7 @@ END DO
! ONLY the even points are from the result of a k+q operation
DO ik=1,nkstot
!
IF (ik.eq.1) THEN
IF (ik == 1) THEN
WRITE(6,'(5x,"Progress kmap: ")',advance='no')
indold = 0
ENDIF

View File

@ -58,22 +58,22 @@
!
! And the local variables
!
integer :: nt, na, nb, ig, nta, ntb, ir, ih, jh, ijh, ipol, jpol, is, nspin0
INTEGER :: nt, na, nb, ig, nta, ntb, ir, ih, jh, ijh, ipol, jpol, is, nspin0
!
real(DP), ALLOCATABLE :: qmod (:), qmodg (:), qpg (:,:), &
real(kind=DP), ALLOCATABLE :: qmod (:), qmodg (:), qpg (:,:), &
ylmkq (:,:), ylmk0 (:,:)
! the modulus of q+G
! the modulus of G
! the q+G vectors
! the spherical harmonics
complex(DP) :: fact, fact1, ZDOTC
complex(DP), ALLOCATABLE :: aux1 (:), aux2 (:),&
COMPLEX(kind=DP) :: fact, fact1, ZDOTC
COMPLEX(kind=DP), ALLOCATABLE :: aux1 (:), aux2 (:),&
aux3 (:), aux5 (:), veff (:,:), sk(:)
! work space
complex(DP), ALLOCATABLE, TARGET :: qgm(:)
complex(kind=DP), ALLOCATABLE, TARGET :: qgm(:)
! the augmentation function at G
complex(DP), POINTER :: qgmq (:)
complex(kind=DP), POINTER :: qgmq (:)
! the augmentation function at q+G
character (len=256) :: tempfile
#ifdef __PARA
@ -124,11 +124,11 @@
DO is = 1, nspin
IF (nspin.ne.4.or.is==1) THEN
DO ir = 1, dfftp%nnr
veff (ir, is) = CMPLX (vltot (ir) + v%of_r (ir, is), 0.d0)
veff (ir, is) = CMPLX (vltot (ir) + v%of_r (ir, is), 0.d0, kind=DP)
ENDDO
ELSE
DO ir = 1, dfftp%nnr
veff (ir, is) = CMPLX (v%of_r (ir, is), 0.d0)
veff (ir, is) = CMPLX (v%of_r (ir, is), 0.d0, kind=DP)
ENDDO
ENDIF
CALL fwfft ('Dense', veff(:,is), dfftp)
@ -136,7 +136,7 @@
!
! We compute here two of the three integrals needed in the phonon
!
fact1 = CMPLX (0.d0, - tpiba * omega)
fact1 = CMPLX (0.d0, - tpiba * omega, kind=DP)
!
tempfile = trim(tmp_dir) // trim(prefix) // '.recover'
#ifdef __PARA

View File

@ -12,15 +12,15 @@
!----------------------------------------------------------------------
subroutine dvqpsi_us_only3 (ik, uact,xxk)
!----------------------------------------------------------------------
!
! This routine calculates dV_bare/dtau * psi for one perturbation
! with a given q. The displacements are described by a vector uact.
! The result is stored in dvpsi. The routine is called for each k point
! and for each pattern u. It computes simultaneously all the bands.
! This routine implements Eq. B29 of PRB 64, 235118 (2001).
! Only the contribution of the nonlocal potential is calculated here.
!
!
!!
!! This routine calculates dV_bare/dtau * psi for one perturbation
!! with a given q. The displacements are described by a vector uact.
!! The result is stored in dvpsi. The routine is called for each k point
!! and for each pattern u. It computes simultaneously all the bands.
!! This routine implements Eq. B29 of PRB 64, 235118 (2001).
!! Only the contribution of the nonlocal potential is calculated here.
!!
!-----------------------------------------------------------------------
USE kinds, ONLY : DP
USE cell_base, ONLY : tpiba
USE gvect, ONLY : g
@ -39,37 +39,51 @@
implicit none
!
! The dummy variables
!
integer :: ik
! input: the k point
real(kind=DP) :: xxk(3)
! input: the k point (cartesian coordinates)
complex(DP) :: uact (3 * nat)
! input: the pattern of displacements
INTEGER, INTENT(in) :: ik
!! Input: the k point
REAL(kind=DP), INTENT(in) :: xxk(3)
!! input: the k point (cartesian coordinates)
COMPLEX(kind=DP), INTENT(in) :: uact (3 * nat)
!! input: the pattern of displacements
!
! And the local variables
!
INTEGER :: na
!! Counter on atoms
INTEGER :: nb
!! Counter on atoms
INTEGER :: mu
!! Counter on modes
INTEGER :: nu
!! Counter on modes
INTEGER :: ig
!! Counter on G vectors
INTEGER :: igg
!! Auxiliary counter on G vectors
INTEGER :: nt
!! Counter on atomic types
INTEGER :: ibnd
!! Counter on bands
INTEGER :: ijkb0
!! Auxiliary variable for counting
INTEGER :: ikb
!! Counter on becp functions
INTEGER :: jkb
!! Counter on becp functions
INTEGER :: ipol
!! Counter on polarizations
INTEGER :: ih
!! Counter on nh
INTEGER :: jh
!! Counter on nh
INTEGER :: is
!! Counter on polarization
INTEGER :: js
!! Counter on polarization
INTEGER :: ijs
!! Counter on combined is and js polarization
integer :: na, nb, mu, nu, ig, igg, nt, ibnd, ijkb0, &
ikb, jkb, ih, jh, ipol, is, js, ijs
! counter on atoms
! counter on modes
! the point k
! the point k+q
! counter on G vectors
! auxiliary counter on G vectors
! counter on atomic types
! counter on bands
! auxiliary variable for counting
! counter on becp functions
! counter on becp functions
! counter on n index
! counter on m index
! counter on polarizations
real(DP), parameter :: eps = 1.d-12
REAL(kind=DP), parameter :: eps = 1.d-12
complex(DP), allocatable :: ps1 (:,:), ps2 (:,:,:), aux (:), deff_nc(:,:,:,:)
real(DP), allocatable :: deff(:,:,:)

View File

@ -15,12 +15,6 @@
USE io_global, ONLY : stdout
USE epwcom, ONLY : liso, fila2f, gap_edge, lreal, limag, laniso
USE eliashbergcom, ONLY : gap0
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
#endif
!
IMPLICIT NONE
!

View File

@ -30,14 +30,14 @@
USE phcom, ONLY : nmodes
USE elph2, ONLY : wqf, wf
USE epwcom, ONLY : nqstep, degaussq, nsiter, conv_thr_racon, fsthick, &
lacon, lpade, eps_acustic
lpade, eps_acustic
USE eliashbergcom, ONLY : nsw, estemp, dwsph, ws, wsph, gap, Agap, Gp, Gm, ADsumi, AZsumi, &
Delta, Znorm, ADelta, ADeltap, AZnorm, AZnormp, g2, lacon_fly, &
a2fij, wkfs, dosef, ixkqf, ixqfs, nqfs, w0g, nkfs, nbndfs, ef0, ekfs
USE constants_epw, ONLY : pi, ci
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
#endif
@ -46,13 +46,16 @@
!
INTEGER :: i, iw, iwp, iwph, itemp, iter, ik, iq, iq0, ibnd, jbnd, imode, &
lower_bnd, upper_bnd, imelt
REAL(DP) :: rgammap, rgammam, absdelta, reldelta, errdelta, weight, a2f_
REAL(DP), EXTERNAL :: w0gauss
COMPLEX(DP) :: esqrt, root
REAL(kind=DP) :: rgammap, rgammam, absdelta, reldelta, errdelta, weight, a2f_
REAL(kind=DP), EXTERNAL :: w0gauss
COMPLEX(kind=DP) :: esqrt, root
COMPLEX(DP), ALLOCATABLE, SAVE :: Deltaold(:)
LOGICAL :: conv
CHARACTER (len=256) :: cname
!
! SP: Need initialization
a2f_ = 0.0_DP
!
IF ( iter .eq. 1 ) THEN
!
! get the size of required allocated memory for
@ -285,14 +288,14 @@
!
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE epwcom, ONLY : fsthick, lpade
USE epwcom, ONLY : fsthick
USE eliashbergcom, ONLY : nsw, ws, wsi, gap, Agap, Delta, Znorm, &
ADelta, AZnorm, ADeltai, AZnormi, &
wkfs, dosef, w0g, nkfs, nbndfs, ef0, ekfs
USE constants_epw, ONLY : cone, ci
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
#endif

View File

@ -15,17 +15,16 @@
!
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE io_files, ONLY : prefix
USE control_flags, ONLY : iverbosity
USE epwcom, ONLY : nsiter, nstemp, broyden_beta, broyden_ndim, &
limag, lpade, lacon, fsthick, imag_read, wscut
USE eliashbergcom, ONLY : nsw, nsiw, ADelta, ADeltap, ADeltai, ADeltaip, Agap, gap, &
Delta, Deltai, estemp, nkfs, nbndfs, ekfs, ef0
USE eliashbergcom, ONLY : nsw, nsiw, ADelta, ADeltap, ADeltai, ADeltaip, &
estemp, nkfs, nbndfs, ekfs, ef0
USE constants_epw, ONLY : kelvin2eV, ci, pi
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_bcast, mp_barrier
USE mp_world, ONLY : mpime
#endif
!
@ -251,10 +250,8 @@
!
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE io_files, ONLY : prefix
USE elph2, ONLY : wqf
USE epwcom, ONLY : nsiter, nstemp, muc, conv_thr_iaxis, fsthick, nkf1, &
nkf2, nkf3
USE epwcom, ONLY : nsiter, nstemp, muc, conv_thr_iaxis, fsthick
USE eliashbergcom, ONLY : nsiw, estemp, gap0, gap, Agap, wsi, AKeri, limag_fly, &
NAZnormi, AZnormi, ADeltai, ADeltaip, NZnormi, Znormi, &
Deltai, wsphmax, nkfs, nbndfs, dosef, ef0, ixkqf, ixqfs, &
@ -262,7 +259,7 @@
USE constants_epw, ONLY : pi
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
#endif
@ -479,13 +476,14 @@
!-----------------------------------------------------------------------
SUBROUTINE eliashberg_read_aniso_iaxis( itemp )
!-----------------------------------------------------------------------
!
! This routine reads from file the anisotropic Delta and Znorm on the imaginary-axis
!
! input
!
! itemp - temperature point
!
!!
!! This routine reads from file the anisotropic Delta and Znorm on the imaginary-axis
!!
!! input
!!
!! itemp - temperature point
!!
!----------------------------------------------------------------------
USE kinds, ONLY : DP
USE io_epw, ONLY : iufilgap
USE io_files, ONLY : prefix
@ -497,14 +495,26 @@
USE constants_epw, ONLY : kelvin2eV
#ifdef __PARA
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp_global, ONLY : inter_pool_comm
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum
#endif
!
IMPLICIT NONE
!
INTEGER :: i, iw, itemp, ik, ibnd, imelt, ios
INTEGER, INTENT(in) :: itemp
!
! Local variables
INTEGER :: iw
!! Counter on frequency
INTEGER :: ik
!! Counter on k-poin
INTEGER :: ibnd
!! Counter on band
INTEGER :: imelt
!! Required allocation of memory
INTEGER :: ios
!! Status variables when reading a file
REAL(DP) :: temp, eband, omega, weight
REAL(DP) :: eps=1.0d-6
CHARACTER (len=256) :: name1, word

View File

@ -24,7 +24,7 @@
#ifdef __PARA
USE mp, ONLY : mp_bcast, mp_barrier
USE mp_world, ONLY : mpime
USE mp_global, ONLY : my_pool_id, mp_startup, ionode_id, mp_global_end
USE mp_global, ONLY : mp_startup, ionode_id, mp_global_end
#endif
USE control_flags, ONLY : gamma_only
USE control_epw, ONLY : wannierize