From 8dd7371453c0436c9101cf20eed82710ae40975d Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Fri, 16 Jul 2021 22:00:18 +0200
Subject: [PATCH] CP with CG not working any longer with norm-conserving
pseudopotentials. Fixes issue #340, I hope (no warranty)
---
CPV/src/gram.f90 | 17 +++++------------
upflib/ylmr2_gpu.f90 | 2 +-
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/CPV/src/gram.f90 b/CPV/src/gram.f90
index b7e1192113..9d8bf0c4d3 100644
--- a/CPV/src/gram.f90
+++ b/CPV/src/gram.f90
@@ -74,8 +74,6 @@ SUBROUTINE gram_bgrp( betae, bec_bgrp, nkbx, cp_bgrp, ngwx )
anorm = cscnorm( bec_bgrp, cp_bgrp, ibgrp_i, nbspx_bgrp )
cp_bgrp(:,ibgrp_i) = cp_bgrp(:,ibgrp_i) / anorm
bec_bgrp(:,ibgrp_i) = bec_bgrp(:,ibgrp_i) / anorm
- !CALL dscal( 2*ngw, 1.0d0/anorm, cp_bgrp(1,ibgrp_i), 1 )
- !CALL dscal( nkbx, 1.0d0/anorm, bec_bgrp(1,ibgrp_i), 1 )
END IF
END DO
END DO
@@ -208,16 +206,11 @@ SUBROUTINE gracsc_bgrp( i, csc, iss, nk )
IF( ibgrp_i > 0 ) THEN
DO ia = 1, nat
is = ityp(ia)
- IF( upf(is)%tvanp ) THEN
- DO iv=1,nh(is)
- inl=ofsbeta(ia)+iv
- bec_tmp(inl) = 2.d0 * DDOT( 2*ngw, cp_bgrp(1,ibgrp_i), 1, betae(1,inl), 1) &
- - g0 * DBLE(cp_bgrp(1,ibgrp_i) * CONJG(betae(1,inl)))
- END DO
- ELSE
- inl= ofsbeta(ia)
- bec_tmp( inl + 1: inl + nh(is) ) = 0.0d0
- END IF
+ DO iv=1,nh(is)
+ inl=ofsbeta(ia)+iv
+ bec_tmp(inl) = 2.d0 * DDOT( 2*ngw, cp_bgrp(1,ibgrp_i), 1, betae(1,inl), 1) &
+ - g0 * DBLE(cp_bgrp(1,ibgrp_i) * CONJG(betae(1,inl)))
+ END DO
END DO
CALL mp_sum( bec_tmp, intra_bgrp_comm ) ! parallel sum over G vectors within a band group
bec_bgrp( : , ibgrp_i ) = bec_tmp( : )
diff --git a/upflib/ylmr2_gpu.f90 b/upflib/ylmr2_gpu.f90
index 162ddc1f88..a00ee8bde2 100644
--- a/upflib/ylmr2_gpu.f90
+++ b/upflib/ylmr2_gpu.f90
@@ -6,7 +6,7 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
#define __PGI_1910_WORKAROUND
-! use the CUDA Kernel version insetad of the simple CUF version
+! use the CUDA Kernel version instead of the simple CUF version
! that for some obscure reason crashes on (obsolescent) PGI v.19.10
module ylmr2_gpum