2 ! implicit real*8 (a-h,o-z)
4 ! include 'COMMON.CHAIN'
5 ! include 'COMMON.INTERACT'
6 ! include 'COMMON.SBRIDGE'
7 use geometry_data, only: nres,c,nfrag
8 use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back
9 use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
12 real(kind=4),allocatable,dimension(:,:) :: coord !(3,2*maxres)
13 real(kind=4) :: prec,time,potE,uconst,t_bath,qfrag(100)
15 character(len=80) arg,seqfile,pdbfileX
16 character(len=3),allocatable,dimension(:) :: sequenc !(maxres)
17 character(len=50) tytul
18 character(len=8) onethree,cfreq
26 integer :: i,ii,j,k,kk,is,ie,ifreq,mnum,molec,iext,isize
35 allocate(sequenc(maxres))
36 allocate(itype(maxres,5))
37 ! allocate(c(3,2*maxres+2))
38 if (iargc().lt.3) then
40 "Usage: xdrf2pdb one/three seqfile cxfile [freq]",&
41 " [start] [end] [pdbfile]"
44 call getarg(1,onethree)
45 onethree = ucase(onethree)
46 if (onethree.eq.'ONE') then
48 else if (onethree.eq.'THREE') then
51 print *,"ONE or THREE must be specified"
53 call getarg(2,seqfile)
54 open (1,file=seqfile,status='old')
56 read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres)
60 do while (.not.iblnk(sequenc(i+1)(1:1)))
65 itype(i,mnum)=rescode(i,sequenc(i),1,molec)
68 read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres)
72 do while (.not.iblnk(sequenc(i+1)(1:1)))
77 itype(i,mnum)=rescode(i,sequenc(i),0,molec)
81 iext = index(arg,'.cx') - 1
83 print *,"Error - not a cx file"
86 if (iargc().gt.3) then
90 if (iargc().gt.4) then
94 if (iargc().gt.5) then
98 if (iargc().gt.6) then
99 call getarg(7,pdbfileX)
101 pdbfileX=arg(:iext)//'.pdb'
103 open(9,file=pdbfileX)
105 if (itype(1,mnum).eq.ntyp1) nnt = 2
107 if (itype(nres,mnum).eq.ntyp1) nct = nres-1
108 print *,"nnt",nnt," nct",nct," nres",nres
110 call xdrfopen(ixdrf,arg, "r", iret)
113 print *,"is",is," ie",ie
115 allocate(coord(3,2*nres))
116 allocate(c(3,2*nres))
117 do while(is.eq.0 .or. kk.lt.ie)
118 call xdrffloat(ixdrf, time, iret)
119 print *,"time",time," iret",iret
122 call xdrffloat(ixdrf, potE, iret)
123 call xdrffloat(ixdrf, uconst, iret)
124 print *,"potE",potE," uconst",uconst
125 call xdrffloat(ixdrf, uconst_back, iret)
126 call xdrffloat(ixdrf, t_bath, iret)
127 print *,"t_bath",t_bath
130 print *,"uconst_back",uconst_back
131 ! call xdrffloat(ixdrf, t_bath, iret)
132 ! print *,"t_bath",t_bath
133 call xdrfint(ixdrf, nss, iret)
135 call xdrfint(ixdrf, ihpb(j), iret)
136 call xdrfint(ixdrf, jhpb(j), iret)
139 ! call xdrffloat(ixdrf, t_bath, iret)
140 ! print *,"t_bath",t_bath
141 call xdrfint(ixdrf, nfrag, iret)
143 call xdrffloat(ixdrf, qfrag(i), iret)
145 print *,"nfrag",nfrag
149 call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
152 ! write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
153 ! write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
154 ! write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
156 write (*,'(3f10.5,i3)') (coord(k,j),k=1,3),j
158 if (kk.ge.is .and. mod(kk,ifreq).eq.0) then
159 if (isize .ne. nres+nct-nnt+1) then
160 print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
171 c(j,i+nres)=coord(j,ii+nres)
175 ! write (*,'(8f10.5)') (c(k,j),k=1,3),(c(i,j+nres),i=1,3)
178 write (tytul,'(a,i6,a,f8.3)') "Structure",kk,"Temp",t_bath
179 call pdbout(etot,tytul,9)