implicit real*8 (a-h,o-z) include 'DIMENSIONS' c include 'mpif.h' include 'COMMON.MD' include 'COMMON.IOUNITS' include 'COMMON.REMD' include 'COMMON.SETUP' include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) character*128 restin,restout integer idir,n irest2=33 ixdrf=34 n=iargc() print *,"n",n if (n.lt.5) then print'(2a)',"Usage: restbin 0/1 NTRAJ NRES INRESTFILE", & " OUTRESTFILE [REMD_M] [USAMPL]" print'(a)',"0 - conversion from bin to ascii / from ascii to bin" print'(a)',"NTRAJ: number of trajectories" print'(a)',"NRES: number of residues" print'(a)',"INRESTFILE: input UNRES/MREMD restart file" print'(a)',"OUTRESTFILE: output UNRES/MREMD restart file" print'(a)',"USAMPL [T/F] flag for umbrella-sampling" stop endif call getarg(1,liczba) read (liczba,*) idir if (idir. ne. 0 .and. idir.ne.1) stop "idir must be 0 or 1" call getarg(2,liczba) read (liczba,*) nodes call getarg(3,liczba) read (liczba,*) nres call getarg (4,restin) call getarg (5,restout) print *,"idir",idir," nodes",nodes," nres",nres print *,"restin ",restin print *,"restout ",restout if (n.eq.6) then call getarg(6,liczba) read(liczba,*) remd_m(1) do i=2,nodes remd_m(i)=remd_m(1) enddo else do i=2,nodes remd_m(i)=1 enddo endif if (n.eq.7) then call getarg(7,liczba) read(liczba,'(L1)') usampl endif print *,"usampl",usampl print *,"remd_m",(remd_m(i),i=1,nodes) if (idir.eq.0) then mremd_rst_name=restin call read1restart(i_index) mremd_rst_name=restout call write1rst_asc(i_index) else mremd_rst_name=restin call read1restart_asc(i_index) mremd_rst_name=restout call write1rst(i_index) endif end c------------------------------------------------------------------------------ subroutine read1restart(i_index) implicit real*8 (a-h,o-z) include 'DIMENSIONS' c include 'mpif.h' include 'COMMON.MD' include 'COMMON.IOUNITS' include 'COMMON.REMD' include 'COMMON.SETUP' include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & d_restart2(3,2*maxres*maxprocs),t5_restart1(5) integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) common /przechowalnia/ d_restart1,d_restart2 write (*,*) "Processor",me," called read1restart" #ifdef AIX call xdrfopen_(ixdrf,mremd_rst_name, "r", iret) print *,"restart file ",mremd_rst_name print *,"iret",iret do i=0,nodes-1 call xdrfint_(ixdrf, i2rep(i), iret) enddo print *,"iret",iret do i=1,remd_m(1) call xdrfint_(ixdrf, ifirst(i), iret) enddo do il=1,nodes call xdrfint_(ixdrf, nupa(0,il), iret) print *,"nupa(0,",il,")=",nupa(0,il) do i=1,nupa(0,il) call xdrfint_(ixdrf, nupa(i,il), iret) enddo print *,"nupa",(nupa(i,il),i=1,nupa(0,il)) call xdrfint_(ixdrf, ndowna(0,il), iret) print *,"ndowna(0",il,")=",ndowna(0,il) do i=1,ndowna(0,il) call xdrfint_(ixdrf, ndowna(i,il), iret) enddo print *,"ndowna",(ndowna(i,il),i=1,ndowna(0,il)) enddo do il=1,nodes do j=1,4 call xdrffloat_(ixdrf, t_restart1(j,il), iret) enddo print *,"il",il,"t_restart",(t_restart1(j,il),j=1,4) enddo #else call xdrfopen(ixdrf,mremd_rst_name, "r", iret) do i=0,nodes-1 call xdrfint(ixdrf, i2rep(i), iret) enddo do i=1,remd_m(1) call xdrfint(ixdrf, ifirst(i), iret) enddo do il=1,nodes call xdrfint(ixdrf, nupa(0,il), iret) do i=1,nupa(0,il) call xdrfint(ixdrf, nupa(i,il), iret) enddo call xdrfint(ixdrf, ndowna(0,il), iret) do i=1,ndowna(0,il) call xdrfint(ixdrf, ndowna(i,il), iret) enddo enddo do il=1,nodes do j=1,4 call xdrffloat(ixdrf, t_restart1(j,il), iret) enddo enddo #endif totT=t5_restart1(1) EK=t5_restart1(2) potE=t5_restart1(3) t_bath=t5_restart1(4) do il=0,nodes-1 do i=1,2*nres do j=1,3 #ifdef AIX call xdrffloat_(ixdrf, d_restart1(j,i+2*nres*il), iret) #else call xdrffloat(ixdrf, d_restart1(j,i+2*nres*il), iret) #endif enddo enddo enddo do il=0,nodes-1 do i=1,2*nres do j=1,3 #ifdef AIX call xdrffloat_(ixdrf, d_restart2(j,i+2*nres*il), iret) #else call xdrffloat(ixdrf, d_restart2(j,i+2*nres*il), iret) #endif enddo enddo enddo if (usampl) then #ifdef AIX call xdrfint_(ixdrf, nset, iret) do i=1,nset call xdrfint_(ixdrf,mset(i), iret) enddo do i=0,nodes-1 call xdrfint_(ixdrf,i2set(i), iret) enddo do il=1,nset do il1=1,mset(il) do i=1,nrep do j=1,remd_m(i) call xdrfint_(ixdrf,itmp, iret) i_index(i,j,il,il1)=itmp enddo enddo enddo enddo #else call xdrfint(ixdrf, nset, iret) do i=1,nset call xdrfint(ixdrf,mset(i), iret) enddo do i=0,nodes-1 call xdrfint(ixdrf,i2set(i), iret) enddo do il=1,nset do il1=1,mset(il) do i=1,nrep do j=1,remd_m(i) call xdrfint(ixdrf,itmp, iret) i_index(i,j,il,il1)=itmp enddo enddo enddo enddo #endif c call mpi_scatter(i2set,1,mpi_integer, c & iset,1,mpi_integer,king, c & CG_COMM,ierr) c endif #ifdef AIX call xdrfclose_(ixdrf, iret) #else call xdrfclose(ixdrf, iret) #endif return end c------------------------------------------------------------------------------------ subroutine write1rst(i_index) implicit real*8 (a-h,o-z) include 'DIMENSIONS' c include 'mpif.h' include 'COMMON.MD' include 'COMMON.IOUNITS' include 'COMMON.REMD' include 'COMMON.SETUP' include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & d_restart2(3,2*maxres*maxprocs) real t5_restart1(5) integer iret,itmp integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) common /przechowalnia/ d_restart1,d_restart2 #ifdef AIX call xdrfopen_(ixdrf,mremd_rst_name, "w", iret) do i=0,nodes-1 call xdrfint_(ixdrf, i2rep(i), iret) enddo do i=1,remd_m(1) call xdrfint_(ixdrf, ifirst(i), iret) enddo do il=1,nodes do i=0,nupa(0,il) call xdrfint_(ixdrf, nupa(i,il), iret) enddo do i=0,ndowna(0,il) call xdrfint_(ixdrf, ndowna(i,il), iret) enddo enddo do il=1,nodes do j=1,4 call xdrffloat_(ixdrf, t_restart1(j,il), iret) enddo enddo do il=0,nodes-1 do i=1,2*nres do j=1,3 call xdrffloat_(ixdrf, d_restart1(j,i+2*nres*il), iret) enddo enddo enddo do il=0,nodes-1 do i=1,2*nres do j=1,3 call xdrffloat_(ixdrf, d_restart2(j,i+2*nres*il), iret) enddo enddo enddo if(usampl) then call xdrfint_(ixdrf, nset, iret) do i=1,nset call xdrfint_(ixdrf,mset(i), iret) enddo do i=0,nodes-1 call xdrfint_(ixdrf,i2set(i), iret) enddo do il=1,nset do il1=1,mset(il) do i=1,nrep do j=1,remd_m(i) itmp=i_index(i,j,il,il1) call xdrfint_(ixdrf,itmp, iret) enddo enddo enddo enddo endif call xdrfclose_(ixdrf, iret) #else call xdrfopen(ixdrf,mremd_rst_name, "w", iret) do i=0,nodes-1 call xdrfint(ixdrf, i2rep(i), iret) enddo do i=1,remd_m(1) call xdrfint(ixdrf, ifirst(i), iret) enddo do il=1,nodes do i=0,nupa(0,il) call xdrfint(ixdrf, nupa(i,il), iret) enddo do i=0,ndowna(0,il) call xdrfint(ixdrf, ndowna(i,il), iret) enddo enddo do il=1,nodes do j=1,4 call xdrffloat(ixdrf, t_restart1(j,il), iret) enddo enddo do il=0,nodes-1 do i=1,2*nres do j=1,3 call xdrffloat(ixdrf, d_restart1(j,i+2*nres*il), iret) enddo enddo enddo do il=0,nodes-1 do i=1,2*nres do j=1,3 call xdrffloat(ixdrf, d_restart2(j,i+2*nres*il), iret) enddo enddo enddo if(usampl) then call xdrfint(ixdrf, nset, iret) do i=1,nset call xdrfint(ixdrf,mset(i), iret) enddo do i=0,nodes-1 call xdrfint(ixdrf,i2set(i), iret) enddo do il=1,nset do il1=1,mset(il) do i=1,nrep do j=1,remd_m(i) itmp=i_index(i,j,il,il1) call xdrfint(ixdrf,itmp, iret) enddo enddo enddo enddo endif call xdrfclose(ixdrf, iret) #endif return end c---------------------------------------------------------------------------- subroutine read1restart_asc(i_index) implicit real*8 (a-h,o-z) include 'DIMENSIONS' include 'COMMON.MD' include 'COMMON.IOUNITS' include 'COMMON.REMD' include 'COMMON.SETUP' include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & d_restart2(3,2*maxres*maxprocs) real t5_restart1(5) integer iret,itmp integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) common /przechowalnia/ d_restart1,d_restart2 open(irest2,file=mremd_rst_name,status="old") read (irest2,*) (i2rep(i),i=0,nodes-1) read (irest2,*) (ifirst(i),i=1,remd_m(1)) do il=1,nodes read (irest2,*) nupa(0,il),(nupa(i,il),i=1,nupa(0,il)) read (irest2,*) ndowna(0,il),(ndowna(i,il),i=1,ndowna(0,il)) enddo do il=1,nodes read (irest2,*) (t_restart1(j,il),j=1,4) enddo do il=0,nodes-1 do i=1,2*nres read (irest2,*) (d_restart1(j,i+2*nres*il),j=1,3) enddo enddo do il=0,nodes-1 do i=1,2*nres read (irest2,*) (d_restart2(j,i+2*nres*il),j=1,3) enddo enddo if (usampl) then read (irest2,*) nset read (irest2,*) (mset(i),i=1,nset) read (irest2,*) (i2set(i),i=1,nodes-1) do il=1,nset do il1=1,mset(il) do i=1,nrep read (irest2,*) (i_index(i,j,il,il1),j=1,remd_m(i)) enddo enddo enddo endif return end c--------------------------------------------------------------------------- subroutine write1rst_asc(i_index) implicit real*8 (a-h,o-z) include 'DIMENSIONS' include 'COMMON.MD' include 'COMMON.IOUNITS' include 'COMMON.REMD' include 'COMMON.SETUP' include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & d_restart2(3,2*maxres*maxprocs) real t5_restart1(5) integer iret,itmp integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) common /przechowalnia/ d_restart1,d_restart2 open(irest2,file=mremd_rst_name,status="unknown") write (irest2,*) (i2rep(i),i=0,nodes-1) write (irest2,*) (ifirst(i),i=1,remd_m(1)) do il=1,nodes write (irest2,*) nupa(0,il),(nupa(i,il),i=1,nupa(0,il)) write (irest2,*) ndowna(0,il),(ndowna(i,il),i=1,ndowna(0,il)) enddo do il=1,nodes write (irest2,*) (t_restart1(j,il),j=1,4) enddo do il=0,nodes-1 do i=1,2*nres write (irest2,*) (d_restart1(j,i+2*nres*il),j=1,3) enddo enddo do il=0,nodes-1 do i=1,2*nres write (irest2,*) (d_restart2(j,i+2*nres*il),j=1,3) enddo enddo if (usampl) then write (irest2,*) nset write (irest2,*) (mset(i),i=1,nset) write (irest2,*) (i2set(i),i=1,nodes-1) do il=1,nset do il1=1,mset(il) do i=1,nrep write (irest2,*) (i_index(i,j,il,il1),j=1,remd_m(i)) enddo enddo enddo endif return end