-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathread_numlines_vasp.f90
39 lines (29 loc) · 984 Bytes
/
read_numlines_vasp.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
SUBROUTINE read_numlines_vasp(fname, fid, & ! <- args in
nstot, nktot, nbcder, nb) ! -> args out
! Read header of the WAVEDER file
!! Variables in-out
implicit none
CHARACTER(len=256), intent(in) :: &
fname ! command line input arguments
INTEGER, intent(in) :: &
fid ! file ID
INTEGER, intent(out) :: &
nktot, & ! total number of k-points in WAVEDER file
nstot, & ! total number of spins in WAVEDER file
nbcder, & ! smaller number of bands in WAVEDER file
nb ! total number of bands in VASP calculation
!! Variables internal
INTEGER(kind=4) :: &
xnb, xnbcder, xnktot, xnstot ! temp variable
!! Read the head record of WAVEDER file to determine
!! number of bands, k-points, spins
OPEN (fid, file = TRIM(fname), form = 'unformatted', status = 'old')
READ(fid) xnb, xnbcder, xnktot, xnstot
CLOSE(fid)
!! convert INTEGER(kind=4) into INTEGER
nb=xnb
nbcder=xnbcder
nktot=xnktot
nstot=xnstot
RETURN
END SUBROUTINE read_numlines_vasp