The Elk Code
tdbackup.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2018 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 tdbackup
7 use modmain
8 use modtddft
9 use modmpi
10 use modramdisk
11 implicit none
12 ! local variables
13 integer ik
14 ! allocatable arrays
15 complex(8), allocatable :: evecsvt(:,:)
16 if (ntsbackup < 1) return
17 if (mod(itimes-1,ntsbackup) /= 0) return
18 ! ensure eigenvectors are written to disk
20 wrtdsk=.true.
21 allocate(evecsvt(nstsv,nstsv))
22 do ik=1,nkpt
23 ! distribute among MPI processes
24  if (mod(ik-1,np_mpi) /= lp_mpi) cycle
25 ! read in time-dependent Kohn-Sham eigenvectors
26  call getevecsv(filext,ik,vkl(:,ik),evecsvt)
27 ! write eigenvectors to backup file
28  call putevecsv('_TD_BACKUP.OUT',ik,evecsvt)
29 end do
30 deallocate(evecsvt)
31 ! write the time step backup file
32 if (mp_mpi) then
33  open(50,file='TIMESTEP_BACKUP.OUT',form='FORMATTED')
34  write(50,'(I8,G18.10)') itimes,times(itimes)
35  close(50)
36 end if
38 ! synchronise MPI processes
39 call mpi_barrier(mpicom,ierror)
40 end subroutine
41 
subroutine getevecsv(fext, ikp, vpl, evecsv)
Definition: getevecsv.f90:7
character(256) filext
Definition: modmain.f90:1301
logical mp_mpi
Definition: modmpi.f90:17
integer nkpt
Definition: modmain.f90:461
type(file_t), dimension(:), allocatable, private file
Definition: modramdisk.f90:29
integer np_mpi
Definition: modmpi.f90:13
integer nstsv
Definition: modmain.f90:889
logical wrtdsk
Definition: modramdisk.f90:15
real(8), dimension(:,:), allocatable vkl
Definition: modmain.f90:471
subroutine tdbackup
Definition: tdbackup.f90:7
Definition: modmpi.f90:6
real(8), dimension(:), allocatable times
Definition: modtddft.f90:48
integer itimes
Definition: modtddft.f90:46
logical wrtdsk0
Definition: modramdisk.f90:15
integer lp_mpi
Definition: modmpi.f90:15
subroutine putevecsv(fext, ik, evecsv)
Definition: putevecsv.f90:7
integer ntsbackup
Definition: modtddft.f90:54
integer mpicom
Definition: modmpi.f90:11
integer ierror
Definition: modmpi.f90:19