File: pw_dot.f90

package info (click to toggle)
espresso 6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 311,040 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,502; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (38 lines) | stat: -rw-r--r-- 1,132 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
!
! 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)
!-----------------------------------------------------------------------
  !
  !  calculate m dot products c_i = real( a^*_ij b_ji )
  !  using half G vectors or half PWs
  !
  USE kinds,    ONLY: DP
  USE gvect,    ONLY: gstart
  USE mp_pools, ONLY: intra_pool_comm
  USE mp,       ONLY: mp_sum
  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
#if defined(__MPI)
  IF (sum_over_nodes=='y'.or.sum_over_nodes=='Y') CALL mp_sum( c, intra_pool_comm )
#endif
  RETURN
END SUBROUTINE pw_dot