1 implicit real*8 (a-h,o-z)
4 include 'COMMON.INTERACT'
5 include 'COMMON.SBRIDGE'
6 real*4 coord(3,2*maxres)
7 real*4 prec,time,potE,uconst,t_bath,qfrag(100)
9 real*8 cm(3,maxchain),shift_coord(3,maxchain),ccm(3),ccm_prev(3)
10 character*80 arg,seqfile,pdbfile
11 character*3 sequenc(maxres)
13 character*8 onethree,cfreq
21 logical previous,change
22 integer lmin(maxchain),lshift(maxchain)
28 if (iargc().lt.6) then
30 & "Usage: xdrf2pdb one/three seqfile boxx boxy boxz cxfile [freq]",
31 &" [start] [end] [pdbfile]"
34 call getarg(1,onethree)
35 onethree = ucase(onethree)
36 if (onethree.eq.'ONE') then
38 else if (onethree.eq.'THREE') then
41 print *,"ONE or THREE must be specified"
43 call getarg(2,seqfile)
44 open (1,file=seqfile,status='old')
46 read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres)
50 do while (.not.iblnk(sequenc(i+1)(1:1)))
55 itype(i)=rescode(i,sequenc(i),1)
58 read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres)
62 do while (.not.iblnk(sequenc(i+1)(1:1)))
67 itype(i)=rescode(i,sequenc(i),0)
70 call seq2chains(nres,itype,nchain,chain_length,chain_border,
72 print *,"nchain",nchain
73 print *,"chain_border, chain_length"
76 nrestot=nrestot+chain_length(i)
77 print *,chain_border(1,i),chain_border(2,i),chain_length(i)
79 print *,"nrestot",nrestot
81 read(arg,*) boxsize(1)
83 read(arg,*) boxsize(2)
85 read(arg,*) boxsize(3)
87 iext = index(arg,'.cx') - 1
89 print *,"Error - not a cx file"
92 if (iargc().gt.6) then
96 if (iargc().gt.7) then
100 if (iargc().gt.8) then
104 if (iargc().gt.9) then
105 call getarg(10,pdbfile)
107 pdbfile=arg(:iext)//'.pdb'
111 if (itype(1).eq.ntyp1) nnt = 2
113 if (itype(nres).eq.ntyp1) nct = nres-1
114 print *,"nnt",nnt," nct",nct
116 call xdrfopen(ixdrf,arg, "r", iret)
119 print *,"is",is," ie",ie
121 do while(is.eq.0 .or. kk.lt.ie)
122 call xdrffloat(ixdrf, time, iret)
123 print *,"time",time," iret",iret
126 call xdrffloat(ixdrf, potE, iret)
127 call xdrffloat(ixdrf, uconst, iret)
128 print *,"potE",potE," uconst",uconst
130 call xdrffloat(ixdrf, uconst_back, iret)
132 print *,"uconst_back",uconst_back
133 call xdrffloat(ixdrf, t_bath, iret)
134 print *,"t_bath",t_bath
135 call xdrfint(ixdrf, nss, iret)
137 call xdrfint(ixdrf, ihpb(j), iret)
138 call xdrfint(ixdrf, jhpb(j), iret)
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)
150 c write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
151 c write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
152 c write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
153 c write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
154 if (kk.ge.is .and. mod(kk,ifreq).eq.0) then
155 if (isize .ne. nres+nct-nnt+1) then
156 print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
167 c(j,i+nres)=coord(j,ii+nres)
171 c print *,"ichain",ichain
175 do i=chain_border(1,ichain),chain_border(2,ichain)
178 cm(j,ichain)=cm(j,ichain)+c(j,i)
182 cm(j,ichain)=cm(j,ichain)/chain_length(ichain)
187 c write (*,'(i5,3f10.5)') i,(cm(j,i),j=1,3)
195 lshift(ichain)=mod(ii,3)-1
198 c print '(10i3)',(lshift(ichain),ichain=1,nchain)
202 sumodl=sumodl+dabs(cm(j,ichain)+lshift(ichain)*boxsize(j)
203 & -cm(j,jchain)-lshift(jchain)*boxsize(j))
206 c print *,"sumodl",sumodl," sumodl_min",sumodl_min
207 if (sumodl.lt.sumodl_min) then
213 cm(j,ichain)=cm(j,ichain)+lmin(ichain)*boxsize(j)
214 shift_coord(j,ichain)=lmin(ichain)*boxsize(j)
219 ccm(j)=ccm(j)+cm(j,ichain)*chain_length(ichain)
223 ccm(j)=ccm(j)/nrestot
225 c write (*,'(a,3f10.5)') "ccm ",(ccm(j),j=1,3)
226 c write (*,'(a,3f10.5)') "ccm_prev",(ccm_prev(j),j=1,3)
227 c write (*,'(a,3f10.5)') "diff ",(ccm(j)-ccm_prev(j),j=1,3)
228 c write (*,*) "shift_coord"
230 c write (*,'(i5,3f10.5)') i,(shift_coord(j,i),j=1,3)
237 if (ccm(j)-ccm_prev(j).gt.boxsize(j)/2) then
239 shift_coord(j,ichain)=shift_coord(j,ichain)-boxsize(j)
241 ccm(j)=ccm(j)-boxsize(j)
242 else if (ccm(j)-ccm_prev(j).lt.-boxsize(j)/2) then
244 shift_coord(j,ichain)=shift_coord(j,ichain)+boxsize(j)
246 ccm(j)=ccm(j)+boxsize(j)
264 shift_coord(j,ichain)=shift_coord(j,ichain)-ccm(j)
268 c write (*,*) "shift_coord"
270 c write (*,'(i5,3f10.5)') i,(shift_coord(j,i),j=1,3)
273 do i=chain_border(1,ichain),chain_border(2,ichain)
275 c(j,i)=c(j,i)+shift_coord(j,ichain)
276 c(j,i+nres)=c(j,i+nres)+shift_coord(j,ichain)
281 write (tytul,'(a,i6)') "Structure",kk
282 call pdbout(etot,tytul,9)