implicit real*8 (a-h,o-z) include 'DIMENSIONS' include 'COMMON.CHAIN' include 'COMMON.INTERACT' include 'COMMON.SBRIDGE' include 'COMMON.NAMES' include 'COMMON.GEO' real*4 coord(3,1000) real*4 prec,time,potE,uconst,t_bath,qfrag(100) real*8 etot character*80 arg,seqfile,angfile character*3 sequenc(maxres) character*50 tytul character*8 onethree,cfreq character*8 ucase external ucase logical oneletter integer rescode external rescode pi = 4.0d0*datan(1.0d0) deg2rad=pi/180.0d0 rad2deg=1.0d0/deg2rad ifreq=1 if (iargc().lt.3) then print '(a)', & "Usage: xdrf2pdb one/three seqfile cxfile [freq] [angfile]" stop endif call getarg(1,onethree) onethree = ucase(onethree) if (onethree.eq.'ONE') then oneletter = .true. else if (onethree.eq.'THREE') then oneletter = .false. else print *,"ONE or THREE must be specified" endif call getarg(2,seqfile) open (1,file=seqfile,status='old') if (oneletter) then read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres) 10 continue nres=i i=0 do while (.not.iblnk(sequenc(i+1)(1:1))) i=i+1 enddo nres=i do i=1,nres itype(i)=rescode(i,sequenc(i),1) enddo else read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres) 11 continue nres=i i=0 do while (.not.iblnk(sequenc(i+1)(1:1))) i=i+1 enddo nres=i do i=1,nres itype(i)=rescode(i,sequenc(i),0) enddo endif call getarg(3,arg) iext = index(arg,'.cx') - 1 if (iext.lt.0) then 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,angfile) else angfile=arg(:iext)//'.ang' endif open(9,file=angfile) nnt = 1 if (itype(1).eq.21) nnt = 2 nct=nres if (itype(nres).eq.21) nct = nres-1 call xdrfopen(ixdrf,arg, "r", iret) print *,"iret",iret kk = 0 do while(.true.) c call xdrfint(ixdrf, ic, iret) c print *,ic call xdrffloat(ixdrf, time, iret) if(iret.eq.0) exit kk = kk + 1 call xdrffloat(ixdrf, potE, iret) c call xdrffloat(ixdrf, uconst, iret) call xdrffloat(ixdrf, uconst_back, iret) call xdrffloat(ixdrf, t_bath, iret) call xdrfint(ixdrf, nss, iret) do j=1,nss call xdrfint(ixdrf, ihpb(j), iret) call xdrfint(ixdrf, jhpb(j), iret) enddo call xdrfint(ixdrf, nfrag, iret) do i=1,nfrag call xdrffloat(ixdrf, qfrag(i), iret) enddo prec=10000.0 isize=0 call xdrf3dfcoord(ixdrf, coord, isize, prec, iret) c write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss) c write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag) c write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize) if (mod(kk,ifreq).eq.0) then if (isize .ne. nres+nct-nnt+1) then print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1 endif write (9,'(i10,e15.8,2e15.5,f12.5)') kk,time,potE,uconst,t_bath do i=1,nres do j=1,3 c(j,i)=coord(j,i) enddo enddo ii = 0 do i=nnt,nct ii = ii + 1 do j=1,3 c(j,i+nres)=coord(j,ii+nres) enddo enddo etot=potE do i=2,nres-2 write (9,'(a3,1x,2f10.3)') & restyp(itype(i)),alpha(i-1,i,i+1)*rad2deg, & beta(i-1,i,i+1,i+2)*rad2deg enddo write (9,'(a3,1x,f10.3)') & restyp(itype(nres-1)),alpha(nres-2,nres-1,nres)*rad2deg endif enddo end