pwdft  0.1
PW-DFT code for education
plot.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 !
23 module plot
24  !
25  implicit none
26  !
27 contains
31  subroutine band_plot()
32  !
33  use constant, only : htr2ev
34  use k_point, only : kvec, nk
35  use kohn_sham, only : nbnd, eval, ef
36  !
37  integer :: fo = 20, ibnd, ik
38  real(8) :: xk(nk), dkvec(3), dxk
39  !
40  write(*,*) " Output band.dat"
41  open(fo, file="band.dat")
42  !
43  xk(1) = 0.0d0
44  do ik = 2, nk
45  dkvec(1:3) = kvec(1:3,ik) - kvec(1:3,ik-1)
46  dxk = sqrt(dot_product(dkvec(1:3), dkvec(1:3)))
47  xk(ik) = xk(ik-1) + dxk
48  end do
49  !
50  write(fo,*) "# k energy[eV]"
51  do ibnd = 1, nbnd
52  do ik = 1, nk
53  write(fo,*) xk(ik), (eval(ibnd, ik)-ef)*htr2ev
54  end do
55  write(fo,*) ""
56  end do
57  !
58  close(fo)
59  !
60  end subroutine band_plot
64  subroutine fermi_plot()
65  !
66  use atm_spec, only : bvec
67  use k_point, only : kgrd, nk, kvec
68  use kohn_sham, only : eval, nbnd, evec, ef
69  use gvec, only : g_wf
70  use constant, only : htr2ev
71  !
72  integer :: ik, ibnd, fo = 20, ii, ipw
73  real(8) :: kgv(g_wf%npw,3), avf(nbnd,nk), vf(3)
74  !
75  do ik = 1, nk
76  do ipw = 1, g_wf%npw
77  kgv(ipw,1:3) = kvec(1:3,ik) + matmul(bvec(1:3,1:3), dble(g_wf%mill(1:3,g_wf%map(ipw))))
78  end do
79  do ibnd = 1, nbnd
80  do ii = 1, 3
81  vf(ii) = dble(sum(conjg(evec(1:g_wf%npw,ibnd,ik)) &
82  & * evec(1:g_wf%npw,ibnd,ik) &
83  & * kgv(1:g_wf%npw,ii ) ))
84  end do
85  avf(ibnd,ik) = sqrt(dot_product(vf(1:3),vf(1:3)))
86  end do
87  end do
88  !
89  write(*,*) " Output vf.frmsf"
90  open(fo, file = "vf.frmsf")
91  write(fo,*) kgrd(3), kgrd(2), kgrd(1)
92  write(fo,*) 1
93  write(fo,*) nbnd
94  write(fo,*) real(bvec(1:3,3))
95  write(fo,*) real(bvec(1:3,2))
96  write(fo,*) real(bvec(1:3,1))
97  do ibnd = 1, nbnd
98  do ik = 1, nk
99  write(fo,*) real((eval(ibnd,ik) - ef)*htr2ev)
100  end do
101  end do
102  do ibnd = 1, nbnd
103  do ik = 1, nk
104  write(fo,*) real(avf(ibnd,ik))
105  end do
106  end do
107  close(fo)
108  !
109  end subroutine fermi_plot
110  !
111 end module plot
plot::fermi_plot
subroutine fermi_plot()
Output FermiSurfer file.
Definition: plot.F90:65
constant
Definition: constant.F90:23
gvec::g_wf
type(fft), save g_wf
Definition: gvec.F90:38
kohn_sham::ef
real(8), save ef
Fermi energy [Htr].
Definition: kohn_sham.F90:31
plot
Definition: plot.F90:23
kohn_sham::evec
complex(8), dimension(:,:,:), allocatable, save evec
(g_wfnpw,nbnd,nk) Kohn-Sham eigenvector (orbital)
Definition: kohn_sham.F90:35
k_point
Definition: k_point.F90:23
gvec
Definition: gvec.F90:23
kohn_sham::nbnd
integer, save nbnd
Number of bands.
Definition: kohn_sham.F90:29
k_point::nk
integer, save nk
Definition: k_point.F90:27
k_point::kgrd
integer, dimension(3), save kgrd
Definition: k_point.F90:28
kohn_sham::eval
real(8), dimension(:,:), allocatable, save eval
(nbnd,nk) Kohn-Sham eigenvalue (energy)
Definition: kohn_sham.F90:33
constant::htr2ev
real(8), parameter htr2ev
Definition: constant.F90:27
atm_spec::bvec
real(8), dimension(3, 3), save bvec
Unit reciplocal lattice vector [Bohr^-1].
Definition: atm_spec.F90:50
k_point::kvec
real(8), dimension(:,:), allocatable, save kvec
Definition: k_point.F90:30
atm_spec
Definition: atm_spec.F90:23
plot::band_plot
subroutine band_plot()
Output band dispersion.
Definition: plot.F90:32
kohn_sham
Definition: kohn_sham.F90:23