xdrf2pdb-m-mult time t_bath printout
[unres.git] / source / xdrfpdb / src-M / xdrf2pdb-m.F
index b665b89..24be584 100644 (file)
       character*3 sequenc(maxres)
       character*50 tytul
       character*8 onethree,cfreq,cntraj,citraj
+      character*3 licz
       character*8 ucase
       external ucase
-      logical oneletter
+      logical oneletter,iblnk
       integer rescode
       external rescode
       
       ifreq=1
-      if (iargc().lt.3) then
+      if (iargc().lt.5) then
         print '(2a)',
-     &   "Usage: xdrf2pdb-m one/three seqfile cxfile [freq] [pdbfile] ",
-     &    " [ntraj] [itraj]"
+     &   "Usage: xdrf2pdb-m one/three seqfile cxfile ntraj itraj",
+     &   " [pdbfile] [freq]"
         stop
       endif
       call getarg(1,onethree)
@@ -39,8 +40,7 @@
    10   continue
         nres=i
         i=0
-c        do while (.not.iblnk(sequenc(i+1)(1:1)))
-        do while (.not.(iblnk(sequenc(i+1)(1:1))==0) )
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
           i=i+1
         enddo 
         nres=i
@@ -52,8 +52,7 @@ c        do while (.not.iblnk(sequenc(i+1)(1:1)))
    11   continue
         nres=i
         i=0
-c        do while (.not.iblnk(sequenc(i+1)(1:1)))
-        do while (.not.(iblnk(sequenc(i+1)(1:1))==0))
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
           i=i+1
         enddo 
         nres=i
@@ -61,7 +60,7 @@ c        do while (.not.iblnk(sequenc(i+1)(1:1)))
           itype(i)=rescode(i,sequenc(i),0)
         enddo
         print *,nres
-        print '(a3,1x)',(sequenc(i),i=1,nres)
+        print '(20(a3,1x))',(sequenc(i),i=1,nres)
       endif
       call getarg(3,arg)
       iext = index(arg,'.cx') - 1
@@ -69,28 +68,21 @@ c        do while (.not.iblnk(sequenc(i+1)(1:1)))
         print *,"Error - not a cx file"
         stop
       endif
-      if (iargc().gt.3) then
-        call getarg(4,cfreq)
-        read (cfreq,*) ifreq
-      endif
-      if (iargc().gt.4) then
-        call getarg(5,pdbfile)
-      else
-        pdbfile=arg(:iext)//'.pdb'
-      endif
+      call getarg(4,cntraj)
+      read (cntraj,*) ntraj
+      call getarg(5,citraj)
+      read (citraj,*) itraj
       if (iargc().gt.5) then
-        call getarg(6,cntraj)
-        read (cntraj,*) ntraj
+        call getarg(6,pdbfile)
       else
-        ntraj=1
+        write(licz,'(bz,i3.3)') itraj
+        pdbfile=arg(:iext)//'_'//licz//'.pdb'
       endif
       if (iargc().gt.6) then
-        call getarg(7,citraj)
-        read (citraj,*) itraj
-      else
-        itraj=1
+        call getarg(7,cfreq)
+        read (cfreq,*) ifreq
       endif
-      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
+c      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
       open(9,file=pdbfile)
       nnt = 1
       if (itype(1).eq.21) nnt = 2
@@ -105,9 +97,9 @@ c        do while (.not.iblnk(sequenc(i+1)(1:1)))
        kk = kk + 1
        call xdrffloat(ixdrf, potE, iret)
        call xdrffloat(ixdrf, uconst, iret)
-#ifdef NEWUNRES
-       call xdrffloat(ixdrf, uconst_back, iret)
-#endif
+c#ifdef NEWUNRES
+c       call xdrffloat(ixdrf, uconst_back, iret)
+c#endif
        call xdrffloat(ixdrf, t_bath, iret)
        call xdrfint(ixdrf, nss, iret) 
        do j=1,nss
@@ -115,11 +107,12 @@ c        do while (.not.iblnk(sequenc(i+1)(1:1)))
         call xdrfint(ixdrf, jhpb(j), iret)
        enddo
        call xdrfint(ixdrf, nfrag, iret)
+       call xdrfint(ixdrf, iset, iret)
        do i=1,nfrag
         call xdrffloat(ixdrf, qfrag(i), iret)
        enddo
        prec=10000.0
-
+c       print *,'nss=',nss,'nfrag=',nfrag,'iset=',iset
        isize=0
        call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
 
@@ -145,7 +138,8 @@ c       write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
            enddo
          enddo
          etot=potE
-         write (tytul,'(a,i6)') "Structure",kk
+         write (tytul,'(a1,i6,a8,f6.1,a6,f10.1)') "#",kk," t_bath ",
+     &             t_bath, " time ",time
          call pdbout(etot,tytul,9)
        endif
       enddo