The Elk Code
readrhos.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2022 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 subroutine readrhos
7 use modmain
8 use modtddft
9 implicit none
10 integer ios
11 integer natmtot_,npmtmax_,ngtot_
12 ! allocate static density and charge global arrays
13 if (allocated(rhosmt)) deallocate(rhosmt)
14 allocate(rhosmt(npmtmax,natmtot,3))
15 if (allocated(rhosir)) deallocate(rhosir)
16 allocate(rhosir(ngtot,3))
17 if (allocated(chgsmt)) deallocate(chgsmt)
18 allocate(chgsmt(natmtot,3))
19 open(100,file='RHOSTAT.OUT',form='UNFORMATTED',action='READ',status='OLD', &
20  iostat=ios)
21 if (ios /= 0) then
22  write(*,*)
23  write(*,'("Error(readrhos): error opening RHOSTAT.OUT")')
24  write(*,*)
25  stop
26 end if
27 read(100) natmtot_
28 if (natmtot /= natmtot_) then
29  write(*,*)
30  write(*,'("Error(readrhos): differing natmtot")')
31  write(*,'(" current : ",I6)') natmtot
32  write(*,'(" RHOSTAT.OUT : ",I6)') natmtot_
33  write(*,*)
34  stop
35 end if
36 read(100) npmtmax_
37 if (npmtmax /= npmtmax_) then
38  write(*,*)
39  write(*,'("Error(readrhos): differing npmtmax")')
40  write(*,'(" current : ",I6)') npmtmax
41  write(*,'(" RHOSTAT.OUT : ",I6)') npmtmax_
42  write(*,*)
43  stop
44 end if
45 read(100) ngtot_
46 if (ngtot /= ngtot_) then
47  write(*,*)
48  write(*,'("Error(readrhos): differing ngtot")')
49  write(*,'(" current : ",I8)') ngtot
50  write(*,'(" RHOSTAT.OUT : ",I8)') ngtot_
51  write(*,*)
52  stop
53 end if
54 read(100) rhosmt,rhosir
55 read(100) chgsmt
56 read(100) chgstot
57 close(100)
58 end subroutine
59 
integer ngtot
Definition: modmain.f90:390
subroutine readrhos
Definition: readrhos.f90:7
real(8), dimension(:,:), allocatable rhosir
Definition: modtddft.f90:82
real(8), dimension(:,:), allocatable chgsmt
Definition: modtddft.f90:86
real(8), dimension(3) chgstot
Definition: modtddft.f90:84
integer npmtmax
Definition: modmain.f90:216
integer natmtot
Definition: modmain.f90:40
real(8), dimension(:,:,:), allocatable rhosmt
Definition: modtddft.f90:82