1
2! Copyright (C) 2015 K. Krieger, 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
6subroutine readtimes(itimes0)
7use modmain
8use modtddft
9implicit none
10! arguments
11integer, intent(out) :: itimes0
12! local variables
13integer ios
14real(8) times_,t1
15open(50,file='TIMESTEP.OUT',form='FORMATTED',status='OLD',iostat=ios)
16if (ios.ne.0) then
17  write(*,*)
18  write(*,'("Error(readtimes): error opening TIMESTEP.OUT")')
19  write(*,*)
20  stop
21end if
22read(50,*,iostat=ios) itimes0,times_
23if (ios.ne.0) then
24  write(*,*)
25  write(*,'("Error(readtimes): error reading time step from TIMESTEP.OUT")')
26  write(*,*)
27  stop
28end if
29if ((itimes0.lt.1).or.(itimes0.gt.ntimes)) then
30  write(*,*)
31  write(*,'("Error(readtimes): invalid itimes : ",I8)') itimes0
32  write(*,*)
33  stop
34end if
35t1=abs(times(itimes0)-times_)
36if (t1.gt.1.d-8) then
37  write(*,*)
38  write(*,'("Error(readtimes): differing time step")')
39  write(*,'(" current      : ",G18.10)') times(itimes0)
40  write(*,'(" TIMESTEP.OUT : ",G18.10)') times_
41  write(*,*)
42  stop
43end if
44close(50)
45end subroutine
46
47