[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
program main
    use commondata
    
    implicit none
    integer i,style,traj,files,n,j,du
    real*8 xseed
    real bmax,Et,RMAX,RBAR,S
    character*100 ftmp
    character(100) :: cmd
    character(10) :: opinion
    character(80) :: inp_name
    
    
    call ReadInputFile(inp_name,style,traj,files,n,j,Et,bmax,RMAX,RBAR,S)
    open(107,file='../array-bmax.txt',status='old',position='append')
    5 fsbatch='sbatch.sc'
    open(105,file=fsbatch)
    
    ftmp='cp /home/O3/'
    fcpinp='script.cp' 
    open(101,file=fcpinp)
    write(101,'(a)')trim(ftmp)//'new/venus-E.e ./'
    
    call init_random_seed()
    
    do i=1,files !nfile
      call random_number(xseed)
      call writeinp(i,xseed,style,traj,files,n,j,Et,bmax,inp_name,RMAX,RBAR,S)
    enddo
    
    write(101,'(a)') 'cp ./sbatch.sc ./'//trim(inp_name)//'-inpark'
    write(101,'(a)') 'cd '//trim(inp_name)//'-inpark'
    write(101,'(a)') 'chmod +x sbatch.sc'
    write(101,'(a)') "sed -i 's/^.\{19\}/scancel /g' scancel.x" 
    write(101,'(a)') 'chmod +x scancel.x'
    
    close(101)
    
    call execute_command_line("chmod +x script.cp")
    call execute_command_line("./script.cp")
    call execute_command_line('sleep 1s')
    call execute_command_line("rm -r inp0* run0*")
    
    if (style == 1) then
       open(106,file=trim(inp_name)//'-inpark/test-bmax')
       write(106,'(a,f3.1)') "(*.*)zzz---wait---",bmax
       call execute_command_line('sleep 90s')
    
       call testbmax(inp_name,traj,du)
       if (du == 0) then
            call execute_command_line("rm -r sbatch.sc script.cp")
            bmax=bmax+0.1d0
            goto 5
        elseif (du == 1) then
            write(107,'(f5.1,I3,I4,f5.1)') Et,n,j,bmax
            close(107)
        endif
    elseif (style == 0) then
        stop
    endif
    end program main