! !----------------------------------------------------------------------- subroutine h_psi_c_s ( psi, hpsi, g2kin, vrs) !----------------------------------------------------------------------- ! ! hpsi = H_k | psi > ! complex version ! !----------------------------------------------------------------------- ! use gspace use constants use parameters implicit none ! real(DP) :: g2kin(ngm) complex(kind=DP) :: vrs (nrs), psic (nrs), psi (ngms), hpsi (ngms) integer :: ig, ir ! ! Here we apply the kinetic energy (k+G)^2 psi ! do ig = 1, ngms hpsi (ig) = g2kin (ig) * psi (ig) enddo ! ! the empirical pseudopotential potential V * psi ! We compute the product in real space ! psic = czero do ig = 1, ngms psic ( nls ( ig ) ) = psi (ig) enddo call cfft3s ( psic, nr1s, nr2s, nr3s, 1) ! do ir = 1, nrs psic (ir) = psic(ir) * vrs (ir) enddo ! ! back to G-space (fft order of G-vectors) call cfft3s ( psic, nr1s, nr2s, nr3s, -1) ! ! addition to the total product ! (automatically switch to magnitude-order of G-vectors) ! do ig = 1, ngms hpsi(ig) = hpsi(ig) + psic( nls(ig) ) enddo ! return end subroutine h_psi_c_s !