subroutine MoveFCIMCStatsFiles() #ifdef NAGF95 USe f90_unix_dir, only: rename #endif integer :: extension logical :: exists character(len=22) :: abstr ! character(len=36) :: command character(len=*), parameter :: t_r = 'MoveFCIMCStatsFiles' if (tMolpro) then inquire (file='FCIQMCStats', exist=exists) else inquire (file='FCIMCStats', exist=exists) end if if (exists) then !We already have an FCIMCStats file - move it to the end of the list of FCIMCStats files. extension = 1 do while (.true.) if (tMolpro) then abstr = 'FCIQMCStats.'//str(extension) else abstr = 'FCIMCStats.'//str(extension) end if inquire (file=trim(adjustl(abstr)), exist=exists) if (.not. exists) exit extension = extension + 1 if (extension > 10000) then call stop_all(t_r, "Error finding free FCIMCStats name") end if end do if (tMolpro) then call rename('FCIQMCStats', trim(adjustl(abstr))) else call rename('FCIMCStats', trim(adjustl(abstr))) end if end if end subroutine MoveFCIMCStatsFiles