[Q-e-commits] r8228 - branches/espresso-EXX/PW
marsamos at democritos.it
marsamos at democritos.it
Mon Nov 7 17:49:47 CET 2011
Author: marsamos
Date: 2011-11-07 17:49:47 +0100 (Mon, 07 Nov 2011)
New Revision: 8228
Modified:
branches/espresso-EXX/PW/ccgdiagg.f90
branches/espresso-EXX/PW/electrons.f90
branches/espresso-EXX/PW/esm.f90
branches/espresso-EXX/PW/exx.f90
branches/espresso-EXX/PW/get_locals.f90
branches/espresso-EXX/PW/h_psi.f90
branches/espresso-EXX/PW/make.depend
branches/espresso-EXX/PW/realus.f90
branches/espresso-EXX/PW/scf_mod.f90
branches/espresso-EXX/PW/sum_band.f90
Log:
__BANDS now also for diagonalization=cg
Modified: branches/espresso-EXX/PW/ccgdiagg.f90
===================================================================
--- branches/espresso-EXX/PW/ccgdiagg.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/ccgdiagg.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -22,7 +22,7 @@
!
USE constants, ONLY : pi
USE kinds, ONLY : DP
- USE mp_global, ONLY : intra_pool_comm
+ USE mp_global, ONLY : intra_pool_comm, intra_bgrp_comm
USE mp, ONLY : mp_sum
!
IMPLICIT NONE
@@ -117,7 +117,11 @@
!
CALL ZGEMV( 'C', kdim, m, ONE, psi, kdmx, spsi, 1, ZERO, lagrange, 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( lagrange( 1:m ), intra_bgrp_comm )
+#else
CALL mp_sum( lagrange( 1:m ), intra_pool_comm )
+#endif
!
psi_norm = DBLE( lagrange(m) )
!
@@ -144,7 +148,11 @@
!
e(m) = ddot( kdim2, psi(1,m), 1, hpsi, 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( e(m), intra_bgrp_comm )
+#else
CALL mp_sum( e(m), intra_pool_comm )
+#endif
!
! ... start iteration for this band
!
@@ -161,7 +169,11 @@
es(1) = ddot( kdim2, spsi(1), 1, g(1), 1 )
es(2) = ddot( kdim2, spsi(1), 1, ppsi(1), 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( es , intra_bgrp_comm )
+#else
CALL mp_sum( es , intra_pool_comm )
+#endif
!
es(1) = es(1) / es(2)
!
@@ -178,7 +190,11 @@
CALL ZGEMV( 'C', kdim, ( m - 1 ), ONE, psi, &
kdmx, scg, 1, ZERO, lagrange, 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( lagrange( 1:m-1 ), intra_bgrp_comm )
+#else
CALL mp_sum( lagrange( 1:m-1 ), intra_pool_comm )
+#endif
!
DO j = 1, ( m - 1 )
!
@@ -193,7 +209,11 @@
!
gg1 = ddot( kdim2, g(1), 1, g0(1), 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( gg1, intra_bgrp_comm )
+#else
CALL mp_sum( gg1 , intra_pool_comm )
+#endif
!
END IF
!
@@ -205,7 +225,11 @@
!
gg = ddot( kdim2, g(1), 1, g0(1), 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( gg, intra_bgrp_comm )
+#else
CALL mp_sum( gg , intra_pool_comm )
+#endif
!
IF ( iter == 1 ) THEN
!
@@ -245,7 +269,11 @@
!
cg0 = ddot( kdim2, cg(1), 1, scg(1), 1 )
!
+#ifdef __BANDS
+ CALL mp_sum( cg0 , intra_bgrp_comm )
+#else
CALL mp_sum( cg0 , intra_pool_comm )
+#endif
!
cg0 = SQRT( cg0 )
!
@@ -259,11 +287,19 @@
!
a0 = 2.D0 * ddot( kdim2, psi(1,m), 1, ppsi(1), 1 ) / cg0
!
+#ifdef __BANDS
+ CALL mp_sum( a0 , intra_bgrp_comm )
+#else
CALL mp_sum( a0 , intra_pool_comm )
+#endif
!
b0 = ddot( kdim2, cg(1), 1, ppsi(1), 1 ) / cg0**2
!
+#ifdef __BANDS
+ CALL mp_sum( b0 , intra_bgrp_comm )
+#else
CALL mp_sum( b0 , intra_pool_comm )
+#endif
!
e0 = e(m)
!
Modified: branches/espresso-EXX/PW/electrons.f90
===================================================================
--- branches/espresso-EXX/PW/electrons.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/electrons.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -540,6 +540,7 @@
!
first = .NOT. exx_is_active()
!
+write(0,*) "calling exxinit"
CALL exxinit()
!
IF ( first ) THEN
Modified: branches/espresso-EXX/PW/esm.f90
===================================================================
--- branches/espresso-EXX/PW/esm.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/esm.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -452,9 +452,10 @@
z1=z0+abs(esm_w)
g=sqrt(alpha)
sa=omega/L
-
+#ifdef __OPENMP
!$omp parallel private( nth, ith, ew, it1, it2, z, zp, tt, kk1, kk2, cc1, cc2, &
!$omp ng_2d, k1, k2, gp2, ipol, t, gp, ff, arg1, arg2, t1, t2 )
+#endif
#ifdef __OPENMP
nth=omp_get_num_threads()
ith=omp_get_thread_num()
@@ -570,10 +571,13 @@
endif
enddo
enddo
+#ifdef __OPENMPI
!$omp atomic
+#endif
ewg=ewg+ew
+#ifdef __OPENMPI
!$omp end parallel
-
+#endif
ewg=2.0*ewg
if( gstart == 2 ) then
Modified: branches/espresso-EXX/PW/exx.f90
===================================================================
--- branches/espresso-EXX/PW/exx.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/exx.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -522,14 +522,15 @@
integer, allocatable :: rir(:,:)
call start_clock ('exxinit')
-
! Beware: not the same as nrxxs in parallel case
nxxs = dffts%nr1x * dffts%nr2x * dffts%nr3x
nrxxs= dffts%nnr
#ifdef __PARA
allocate(psic_all(nxxs), temppsic_all(nxxs) )
+#ifdef __BANDS
CALL init_index_over_band(inter_bgrp_comm,nbnd)
#endif
+#endif
allocate(present(nsym),rir(nxxs,nsym))
allocate(temppsic(nrxxs), psic(nrxxs),tempevc( npwx, nbnd ))
@@ -549,7 +550,6 @@
write(stdout,*) "exxinit, yukawa set to: ", yukawa
#endif
!
-
call start_exx
endif
@@ -682,7 +682,6 @@
do ik =1,nks
x_occupation(1:nbnd,ik) = wg (1:nbnd, ik) / wk(ik)
end do
-
call stop_clock ('exxinit')
@@ -721,8 +720,8 @@
USE parallel_include
USE mp_global, ONLY : nproc, inter_image_comm, me_image, my_image_id,&
- & nimage, nproc_image, ibnd_start, ibnd_end, mpime, inter_bgrp_comm
- USE mp, ONLY : mp_sum
+ & nimage, nproc_image, ibnd_start, ibnd_end, mpime, inter_bgrp_comm, intra_bgrp_comm
+ USE mp, ONLY : mp_sum, mp_barrier
IMPLICIT NONE
@@ -793,7 +792,7 @@
#endif
h_ibnd = h_ibnd + 1
x1 = x_occupation(ibnd, ik)
- IF (ibnd < nbnd) THEN
+ IF (ibnd < ibnd_end) THEN
x2 = x_occupation(ibnd + 1,ik)
ELSE
x2 = 0.d0
@@ -870,20 +869,27 @@
result(1:nrxxs)=result(1:nrxxs)+vc(1:nrxxs)*tempphic(1:nrxxs)
END DO
END IF
+!#ifdef __BANDS
+! CALL mp_sum( result(1:nrxxs), inter_bgrp_comm)
+!#endif
+ END DO
#ifdef __BANDS
CALL mp_sum( result(1:nrxxs), inter_bgrp_comm)
#endif
- END DO
+
!
! Was used for parallelization on images
! CALL mp_sum( result(1:nrxxs), inter_image_comm )
!brings back result in G-space
CALL fwfft ('Wave', result, dffts)
!adds it to hpsi
+! write(mpime+100,*) im, hpsi(1,im)*conjg(hpsi(1,im))
hpsi(1:npw,im)=hpsi(1:npw,im) - exxalfa*result(nls(igk(1:npw)))
+! write(mpime+200,*) im, result(nls(igk(1)))*conjg(result(nls(igk(1))))
+! write(mpime+300,*) im, hpsi(1,im)*conjg(hpsi(1,im))
END DO
- !write(mpime+100,*) sum(result)
- !stop
+write(0,*) "who is out? ", mpime
+! stop
DEALLOCATE (tempphic,temppsic, result, rhoc, vc, fac )
Modified: branches/espresso-EXX/PW/get_locals.f90
===================================================================
--- branches/espresso-EXX/PW/get_locals.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/get_locals.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -19,7 +19,7 @@
USE ions_base, ONLY : nat
USE cell_base, ONLY : omega
USE lsda_mod, ONLY : nspin
- USE mp_global, ONLY : intra_pool_comm
+ USE mp_global, ONLY : intra_pool_comm, intra_bgrp_comm
USE mp, ONLY : mp_sum
USE fft_base, ONLY : dfftp
USE noncollin_module, ONLY : pointlist, factlist, noncolin
@@ -45,7 +45,11 @@
auxrholoc(pointlist(i),1:nspin) = auxrholoc(pointlist(i),1:nspin) + &
rho(i,1:nspin) * factlist(i)
end do
+#ifdef __BANDS
+ call mp_sum( auxrholoc( 0:nat, 1:nspin), intra_bgrp_comm )
+#else
call mp_sum( auxrholoc( 0:nat, 1:nspin ), intra_pool_comm )
+#endif
!
fact = omega/(dfftp%nr1*dfftp%nr2*dfftp%nr3)
if (nspin.eq.2) then
Modified: branches/espresso-EXX/PW/h_psi.f90
===================================================================
--- branches/espresso-EXX/PW/h_psi.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/h_psi.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -118,7 +118,10 @@
!
END IF
#ifdef EXX
- IF ( exx_is_active() ) CALL vexx( lda, n, m, psi, hpsi )
+ IF ( exx_is_active() ) then
+write(0,*) "CALLING VEXX"
+ CALL vexx( lda, n, m, psi, hpsi )
+ ENDIF
#endif
!
! ... electric enthalpy if required
Modified: branches/espresso-EXX/PW/make.depend
===================================================================
--- branches/espresso-EXX/PW/make.depend 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/make.depend 2011-11-07 16:49:47 UTC (rev 8228)
@@ -82,6 +82,7 @@
allocate_fft.o : ../Modules/funct.o
allocate_fft.o : ../Modules/io_global.o
allocate_fft.o : ../Modules/ions_base.o
+allocate_fft.o : ../Modules/mp_global.o
allocate_fft.o : ../Modules/recvec.o
allocate_fft.o : ../Modules/wavefunctions.o
allocate_fft.o : noncol.o
@@ -693,10 +694,12 @@
init_run.o : ../Modules/control_flags.o
init_run.o : ../Modules/fft_base.o
init_run.o : ../Modules/ions_base.o
+init_run.o : ../Modules/mp_global.o
init_run.o : ../Modules/paw_variables.o
init_run.o : ../Modules/recvec_subs.o
init_run.o : ../Modules/uspp.o
init_run.o : ../Modules/wannier_new.o
+init_run.o : ../Modules/wavefunctions.o
init_run.o : dynamics_module.o
init_run.o : esm.o
init_run.o : newd.o
@@ -1741,6 +1744,7 @@
wfcinit.o : ../Modules/io_files.o
wfcinit.o : ../Modules/io_global.o
wfcinit.o : ../Modules/kind.o
+wfcinit.o : ../Modules/mp_global.o
wfcinit.o : ../Modules/random_numbers.o
wfcinit.o : ../Modules/recvec.o
wfcinit.o : ../Modules/uspp.o
Modified: branches/espresso-EXX/PW/realus.f90
===================================================================
--- branches/espresso-EXX/PW/realus.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/realus.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -1518,11 +1518,10 @@
charge = sum( rho_1(:,1:nspin_lsda) )*omega / ( dfftp%nr1*dfftp%nr2*dfftp%nr3 )
#ifdef __BANDS
CALL mp_sum( charge , intra_bgrp_comm )
- CALL mp_sum( charge , inter_bgrp_comm )
#else
CALL mp_sum( charge , intra_pool_comm )
- CALL mp_sum( charge , inter_pool_comm )
#endif
+ CALL mp_sum( charge , inter_pool_comm )
IF ( abs( charge - nelec ) / charge > tolerance ) THEN
!
Modified: branches/espresso-EXX/PW/scf_mod.f90
===================================================================
--- branches/espresso-EXX/PW/scf_mod.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/scf_mod.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -578,7 +578,7 @@
USE cell_base, ONLY : omega, tpiba2
USE gvect, ONLY : gg, gstart
USE control_flags, ONLY : gamma_only
- USE mp_global, ONLY : intra_pool_comm
+ USE mp_global, ONLY : intra_pool_comm, intra_bgrp_comm
USE mp, ONLY : mp_sum
!
IMPLICIT NONE
@@ -665,7 +665,11 @@
!
tauk_ddot = fac * tauk_ddot * omega * 0.5D0
!
+#ifdef __BANDS
+ CALL mp_sum( tauk_ddot , intra_bgrp_comm )
+#else
CALL mp_sum( tauk_ddot , intra_pool_comm )
+#endif
!
RETURN
!
@@ -718,7 +722,7 @@
USE cell_base, ONLY : omega, tpiba2
USE gvect, ONLY : gg, gstart
USE control_flags, ONLY : gamma_only
- USE mp_global, ONLY : intra_pool_comm
+ USE mp_global, ONLY : intra_pool_comm, intra_bgrp_comm
USE mp, ONLY : mp_sum
!
IMPLICIT NONE
@@ -742,7 +746,11 @@
!
IF ( gamma_only ) local_tf_ddot = 2.D0 * local_tf_ddot
!
+#ifdef __BANDS
+ CALL mp_sum( local_tf_ddot , intra_bgrp_comm )
+#else
CALL mp_sum( local_tf_ddot , intra_pool_comm )
+#endif
!
RETURN
!
Modified: branches/espresso-EXX/PW/sum_band.f90
===================================================================
--- branches/espresso-EXX/PW/sum_band.f90 2011-11-04 16:51:07 UTC (rev 8227)
+++ branches/espresso-EXX/PW/sum_band.f90 2011-11-07 16:49:47 UTC (rev 8228)
@@ -780,7 +780,9 @@
!
CALL start_clock( 'sum_band:becsum' )
!
+#ifdef __OPENMP
!$omp parallel default(shared), private(ibnd,w1,ijkb0,np,na,ijh,ih,jh,ikb,jkb,is,js,mytid,ntids,icnt)
+#endif
#ifdef __OPENMP
mytid = omp_get_thread_num() ! take the thread ID
ntids = omp_get_num_threads() ! take the number of threads
@@ -888,13 +890,17 @@
!
END IF
!
+#ifdef __OPENMP
!$omp barrier
+#endif
!
END DO
!
END DO
!
+#ifdef __OPENMP
!$omp end parallel
+#endif
!
CALL stop_clock( 'sum_band:becsum' )
!
More information about the Q-e-commits
mailing list