pwdft  0.1
PW-DFT code for education
hamiltonian Module Reference

Functions/Subroutines

subroutine h_psi (kvec, psi, hpsi)
 

Function/Subroutine Documentation

◆ h_psi()

subroutine hamiltonian::h_psi ( real(8), dimension(3), intent(in)  kvec,
complex(8), dimension(g_wf%npw,nbnd), intent(in)  psi,
complex(8), dimension(g_wf%npw,nbnd), intent(out)  hpsi 
)

Definition at line 30 of file hamiltonian.F90.

30  !
31  use gvec, only : g_wf, g_rh
32  use kohn_sham, only : nbnd
33  use fftw_wrapper, only : fft_g2r_w, fft_r2g_w
34  use rho_v, only : vks
35  use atm_spec, only : bvec
36  !
37  real(8),intent(in) :: kvec(3)
38  complex(8),intent(in) :: psi(g_wf%npw,nbnd)
39  complex(8),intent(out) :: hpsi(g_wf%npw,nbnd)
40  !
41  integer :: ipw, ibnd
42  real(8) :: kgv(3)
43  complex(8) :: psir(g_rh%nr)
44  !
45  ! Local potential
46  !
47  do ibnd = 1, nbnd
48  call fft_g2r_w(psi(1:g_wf%npw,ibnd), psir)
49  psir(1:g_rh%nr) = psir(1:g_rh%nr) * vks(1:g_rh%nr)
50  call fft_r2g_w(psir, hpsi(1:g_wf%npw,ibnd))
51  end do
52  !
53  ! Kinetic energy term
54  !
55  do ipw = 1, g_wf%npw
56  kgv(1:3) = kvec(1:3) + matmul(bvec(1:3,1:3), dble(g_wf%mill(1:3,g_wf%map(ipw))))
57  hpsi(ipw,1:nbnd) = hpsi(ipw,1:nbnd) &
58  & + 0.5d0 * dot_product(kgv,kgv) * psi(ipw,1:nbnd)
59  end do
60  !

References atm_spec::bvec, fftw_wrapper::fft_g2r_w(), fftw_wrapper::fft_r2g_w(), gvec::g_rh, gvec::g_wf, kohn_sham::nbnd, and rho_v::vks.

Referenced by lobpcg::lobpcg_main().

Here is the call graph for this function:
Here is the caller graph for this function:
fftw_wrapper::fft_r2g_w
subroutine fft_r2g_w(wfR, wfG)
w(r) e^{-iGr} -> W(G) -> compress
Definition: fftw_wrapper.F90:105
rho_v
Definition: rho_v.F90:23
fftw_wrapper
Definition: fftw_wrapper.F90:23
gvec
Definition: gvec.F90:23
rho_v::vks
real(8), dimension(:), allocatable vks
(g_rhnr) Kohn-Sham potential [Htr]
Definition: rho_v.F90:27
atm_spec::bvec
real(8), dimension(3, 3), save bvec
Unit reciplocal lattice vector [Bohr^-1].
Definition: atm_spec.F90:50
fftw_wrapper::fft_g2r_w
subroutine fft_g2r_w(wfG, wfR)
Uncompress -> W(G) e^{iGr} -> w(r)
Definition: fftw_wrapper.F90:121
atm_spec
Definition: atm_spec.F90:23
kohn_sham
Definition: kohn_sham.F90:23