Commit ce7c1ce2 authored by Stefano de Gironcoli's avatar Stefano de Gironcoli
Browse files

changes to cb_h_psi.f90 to incude !$omp directives... not very useful but should not be harmful.

parent 7d082a3b
......@@ -79,36 +79,64 @@ END SUBROUTINE cb_h_psi
integer :: ivec, ig
do ivec=1,nvec
!$omp parallel
!$omp workshare
aux(:) = psi(:,ivec)
if (use_overlap) aux(1:npw) = (1.d0 + exp(-ekin(1:npw)))*aux(1:npw)
!$omp end workshare nowait
if (use_overlap) then
!$omp workshare
aux(1:npw) = (1.d0 + exp(-ekin(1:npw)))*psi(1:npw,ivec)
!$omp end workshare nowait
end if
! initialize fft_array
!$omp workshare
fft_array(:) = CMPLX(0.d0,0.d0)
!$omp end workshare nowait
! apply the kinetic energy to each wave function
!$omp do
do ig=1,npw
hpsi(ig,ivec) = ekin(ig) * aux(ig)
end do
!$omp end do nowait
! bring the wavefunction to real space
fft_array(:) = CMPLX(0.d0,0.d0)
!$omp do
do ig = 1, npw
fft_array(dfft%nl(igk(ig))) = aux(ig)
end do
!$omp end do nowait
if (gamma_only_save) then
!$omp do
do ig = gstart, npw
fft_array(dfft%nlm(igk(ig))) = CONJG(aux(ig))
end do
!$omp end do nowait
!$omp single
if (gstart==2) fft_array(dfft%nl(igk(1))) = CMPLX(REAL(aux(1)),0.d0,kind=DP)
!$omp end single
end if
!$omp end parallel
call invfft('Wave',fft_array,dfft) ! >>> FFT G->R <<<
! compute the potential energy contribution
fft_array(:) = vloc(:) * fft_array(:)
! back to reciprocal space and add to the kinetic term
call fwfft('Wave',fft_array,dfft) ! >>> FFT R->G <<<
!$omp parallel
!$omp do
do ig = 1, npw
hpsi(ig,ivec) = hpsi(ig,ivec) + fft_array(dfft%nl(igk(ig)))
end do
if (use_overlap) hpsi(1:npw,ivec) = (1.d0 + exp(-ekin(1:npw)))*hpsi(1:npw,ivec)
!$omp end do
if (use_overlap) then
!$omp workshare
hpsi(1:npw,ivec) = (1.d0 + exp(-ekin(1:npw)))*hpsi(1:npw,ivec)
!$omp end workshare nowait
end if
!$omp end parallel
end do
if (gamma_only_save .and. gstart==2) hpsi(1,1:nvec) = CMPLX(REAL(hpsi(1,1:nvec)),0.d0,kind=DP)
end subroutine cb_h_psi_
!----------------------------------------------------------------------------
SUBROUTINE cb_hs_1psi( lda, n, psi, hpsi, spsi )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment