implicit real*8 (a-h,o-z) include 'DIMENSIONS' include 'COMMON.CHAIN' include 'COMMON.INTERACT' include 'COMMON.SBRIDGE' include 'COMMON.DISTFIT' real*4 coord(3,2*maxres) real*4 prec,time,potE,uconst,t_bath,qfrag(100) real*8 etot character*80 arg,seqfile,pdbfile character*3 sequenc(maxres) character*50 tytul character*8 onethree,cfreq character*8 ucase external ucase logical oneletter integer rescode external rescode logical iblnk external iblnk double precision cm(3) ifreq=1 is=1 ie=1000000000 if (iargc().lt.3) then print '(2a)', & "Usage: xdrf2pdb one/three seqfile cxfile [freq]", & " [start] [end] [pdbfile]" 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,cfreq) read (cfreq,*) is endif if (iargc().gt.5) then call getarg(6,cfreq) read (cfreq,*) ie endif if (iargc().gt.6) then call getarg(7,pdbfile) else pdbfile=arg(:iext)//'.pdb' endif open(9,file=pdbfile) nnt = 1 if (itype(1).eq.21) nnt = 2 nct=nres if (itype(nres).eq.21) nct = nres-1 print *,"nnt",nnt," nct",nct print *,"file",arg do i=nnt,nct if (itype(i).ne.20) then itel(i)=1 else itel(i)=2 endif enddo call xdrfopen(ixdrf,arg, "r", iret) if (iret.eq.0) stop c print *,"iret",iret c print *,"is",is," ie",ie kk = 0 do while(is.eq.0 .or. kk.lt.ie) call xdrffloat(ixdrf, time, iret) c print *,"time",time," iret",iret if(iret.eq.0) exit kk = kk + 1 call xdrffloat(ixdrf, potE, iret) call xdrffloat(ixdrf, uconst, iret) c print *,"potE",potE," uconst",uconst #ifdef NEWUNRES call xdrffloat(ixdrf, uconst_back, iret) c print *,"uconst_back",uconst_back #endif call xdrffloat(ixdrf, t_bath, iret) c print *,"t_bath",t_bath call xdrfint(ixdrf, nss, iret) do j=1,nss call xdrfint(ixdrf, ihpb(j), iret) call xdrfint(ixdrf, jhpb(j), iret) enddo c print *,"nss",nss c print *," ",(ihpb(j),"-",jhpb(j),j=1,nss) call xdrfint(ixdrf, nfrag, iret) do i=1,nfrag call xdrffloat(ixdrf, qfrag(i), iret) enddo c print *,"nfrag",nfrag prec=10000.0 isize=0 call xdrf3dfcoord(ixdrf, coord, isize, prec, iret) c write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath 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 (kk.ge.is .and. mod(kk,ifreq).eq.0) then if (isize .ne. nres+nct-nnt+1) then print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1 endif 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 c Calculate the CM do j=1,3 cm(j)=0.0d0 do i=1,nres cm(j)=cm(j)+c(j,i) enddo cm(j)=cm(j)/nres enddo do i=1,nres do j=1,3 c(j,i)=c(j,i)-cm(j) c(j,i+nres)=c(j,i+nres)-cm(j) enddo enddo etot=potE write (tytul,'(a,i6)') "Structure",kk #ifdef SECONDARY call secondary2(.false.) #endif call pdbout(etot,tytul,9) endif enddo end