The Elk Code
 
Loading...
Searching...
No Matches
reademd.f90
Go to the documentation of this file.
1
2! Copyright (C) 2014 D. Ernsting, S. Dugdale and J. K. Dewhurst.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine reademd(emds)
7use modmain
8use modpw
9use modtest
10implicit none
11! arguments
12real(4), intent(out) :: emds(nhkmax,nkpt)
13! local variables
14integer ik,recl,nhk_
15real(8) vkl_(3),t1
16! allocatable arrays
17real(8), allocatable :: emd(:)
18allocate(emd(nhkmax))
19! find the record length
20inquire(iolength=recl) vkl_,nhk_,emd
21open(250,file='EMD.OUT',form='UNFORMATTED',access='DIRECT',recl=recl)
22do ik=1,nkpt
23 read(250,rec=ik) vkl_,nhk_,emd
24 t1=abs(vkl(1,ik)-vkl_(1))+abs(vkl(2,ik)-vkl_(2))+abs(vkl(3,ik)-vkl_(3))
25 if (t1 > epslat) then
26 write(*,*)
27 write(*,'("Error(reademd): differing vectors for k-point ",I8)') ik
28 write(*,'(" current : ",3G18.10)') vkl(:,ik)
29 write(*,'(" EMD.OUT : ",3G18.10)') vkl_
30 write(*,*)
31 stop
32 end if
33 if (nhk(1,ik) /= nhk_) then
34 write(*,*)
35 write(*,'("Error(reademd): differing nhk for k-point ",I8)') ik
36 write(*,'(" current : ",I8)') nhk(1,ik)
37 write(*,'(" EMD.OUT : ",I8)') nhk_
38 write(*,*)
39 stop
40 end if
41! store momentum density in single-precision array
42 emds(1:nhk_,ik)=real(emd(1:nhk_))
43end do
44close(250)
45! write the EMD of the last k-point to test file if required
46call writetest(170,'electron momentum density',nv=nhkmax,tol=1.d-4,rva=emd)
47deallocate(emd)
48end subroutine
49
real(8) epslat
Definition modmain.f90:24
real(8), dimension(:,:), allocatable vkl
Definition modmain.f90:471
Definition modpw.f90:6
integer, dimension(:,:), allocatable nhk
Definition modpw.f90:40
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition modtest.f90:16
subroutine reademd(emds)
Definition reademd.f90:7