2016-03-25 22:42:17 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2003 PWSCF 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,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
SUBROUTINE pw_dot(sum_over_nodes,n,m,a,lda,b,ldb,c)
|
2021-02-25 20:33:34 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!! Calculate m dot products \(c_i = \text{real}( a^*_{ij} b_{ji} )\)
|
|
|
|
!! using half G vectors or half PWs.
|
2016-03-25 22:42:17 +08:00
|
|
|
!
|
Cleanup of parallel modules:
- mp_world and world_comm should be used only in MPI initialization,
not directly in codes - replaced by mp_images and intra_image_comm
(except in a few cases whose usage is unclear to me)
- mp_global should be used only to provide initialization routines
mp_startup, mp_global_end
- specific mp_* modules should be used for parallelization level on *
(* = images, pools, bands, orhtoh, ...)
Nothing actually changes (I hope) but things will look cleaner if the module
for the required parallelization level is USEd instead of a generic one that
does too meny things at the same time. The final goal of this operation is to
better disentangle the various parallelization levels and to have a better
organized, more granular MPI initialization that does not introduces artificial
and meaningless dependencies. Not done for: PHonon, CPV, TDDFPT, GWW, EPW
2019-01-31 22:51:00 +08:00
|
|
|
USE kinds, ONLY: DP
|
|
|
|
USE gvect, ONLY: gstart
|
|
|
|
USE mp_pools, ONLY: intra_pool_comm
|
|
|
|
USE mp, ONLY: mp_sum
|
2016-03-25 22:42:17 +08:00
|
|
|
IMPLICIT NONE
|
|
|
|
! input
|
|
|
|
INTEGER :: n, m, lda, ldb
|
|
|
|
CHARACTER(len=1) sum_over_nodes
|
|
|
|
COMPLEX(DP) :: a(lda,m), b(ldb,m)
|
|
|
|
! output
|
|
|
|
real(DP) :: c(m)
|
|
|
|
! local
|
|
|
|
INTEGER i
|
|
|
|
real(DP), EXTERNAL :: ddot
|
|
|
|
!
|
|
|
|
DO i= 1,m
|
|
|
|
c(i) = 2.d0*ddot(2*n,a(1,i),1,b(1,i),1)
|
|
|
|
IF (gstart==2) c(i) = c(i) - dble(a(1,i))*dble(b(1,i))
|
|
|
|
ENDDO
|
2016-09-19 03:42:05 +08:00
|
|
|
#if defined(__MPI)
|
2016-03-25 22:42:17 +08:00
|
|
|
IF (sum_over_nodes=='y'.or.sum_over_nodes=='Y') CALL mp_sum( c, intra_pool_comm )
|
|
|
|
#endif
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE pw_dot
|