pwdft  0.1
PW-DFT code for education
hamiltonian.F90
Go to the documentation of this file.
1 !
2 ! Copyright (c) 2018 Mitsuaki Kawamura
3 !
4 ! Permission is hereby granted, free of charge, to any person obtaining a
5 ! copy of this software and associated documentation files (the
6 ! "Software"), to deal in the Software without restriction, including
7 ! without limitation the rights to use, copy, modify, merge, publish,
8 ! distribute, sublicense, and/or sell copies of the Software, and to
9 ! permit persons to whom the Software is furnished to do so, subject to
10 ! the following conditions:
11 !
12 ! The above copyright notice and this permission notice shall be included
13 ! in all copies or substantial portions of the Software.
14 !
15 ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 ! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ! IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 !
24  !
25  implicit none
26  !
27 contains
28  !
29  subroutine h_psi(kvec,psi, hpsi)
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  !
61  end subroutine h_psi
62  !
63 end module hamiltonian
fftw_wrapper::fft_r2g_w
subroutine fft_r2g_w(wfR, wfG)
w(r) e^{-iGr} -> W(G) -> compress
Definition: fftw_wrapper.F90:105
gvec::g_wf
type(fft), save g_wf
Definition: gvec.F90:38
rho_v
Definition: rho_v.F90:23
fftw_wrapper
Definition: fftw_wrapper.F90:23
hamiltonian::h_psi
subroutine h_psi(kvec, psi, hpsi)
Definition: hamiltonian.F90:30
gvec
Definition: gvec.F90:23
kohn_sham::nbnd
integer, save nbnd
Number of bands.
Definition: kohn_sham.F90:29
rho_v::vks
real(8), dimension(:), allocatable vks
(g_rhnr) Kohn-Sham potential [Htr]
Definition: rho_v.F90:27
gvec::g_rh
type(fft), save g_rh
Definition: gvec.F90:37
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
hamiltonian
Definition: hamiltonian.F90:23
atm_spec
Definition: atm_spec.F90:23
kohn_sham
Definition: kohn_sham.F90:23