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,boxxsize,boxysize,boxzsize
8 use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back,molnum
9 use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
10 ! use geometry, only: returnbox
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,boxtraj
16 character(len=3),allocatable,dimension(:) :: sequenc !(maxres)
17 character(len=50) :: tytul
18 character(len=8) :: onethree,cfreq,cntraj,citraj
19 character(len=3) :: licz
21 logical oneletter !,iblnk
24 integer :: i,ii,j,k,kk,is,ie,ifreq,mnum,molec,iext,isize
25 integer :: iret,ixdrf,itraj,ntraj
26 print *,"begin program"
27 ! if(.not.allocated(molnum)) allocate(molnum(maxres))
32 allocate(sequenc(maxres))
33 allocate(molnum(maxres))
34 allocate(itype(maxres,5))
35 if (iargc().lt.6) then
37 "Usage: xdrf2pdb-m one/three seqfile cxfile ntraj itraj",&
38 "boxsize [pdbfile] [freq]"
41 call getarg(1,onethree)
42 onethree = ucase(onethree)
43 if (onethree.eq.'ONE') then
45 else if (onethree.eq.'THREE') then
48 print *,"ONE or THREE must be specified"
50 call getarg(2,seqfile)
51 open (1,file=seqfile,status='old')
53 read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres)
57 do while (.not.iblnk(sequenc(i+1)(1:1)))
62 itype(i,mnum)=rescode(i,sequenc(i),1,molec)
65 read(1,'(20(a3,i1))',end=11,err=11) (sequenc(i),molnum(i),i=1,maxres)
69 do while (.not.iblnk(sequenc(i+1)(1:1)))
74 itype(i,molnum(i))=rescode(i,sequenc(i),0,molnum(i))
77 print '(20(a3,1x))',(sequenc(i),i=1,nres)
80 iext = index(arg,'.cx') - 1
82 print *,"Error - not a cx file"
89 call getarg(6,boxtraj)
90 read (boxtraj,*) boxxsize
93 if (iargc().gt.6) then
94 call getarg(7,pdbfileX)
96 write(licz,'(bz,i3.3)') itraj
97 pdbfileX=arg(:iext)//'_'//licz//'.pdb'
99 if (iargc().gt.7) then
103 ! print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
104 open(9,file=pdbfileX)
107 if (itype(1,mnum).eq.ntyp1) nnt = 2
110 if (itype(nres,mnum).eq.ntyp1) nct = nres-1
111 print *,"nnt",nnt," nct",nct
112 call xdrfopen(ixdrf,arg, "r", iret)
114 allocate(coord(3,2*nres))
115 allocate(c(3,2*nres))
117 call xdrffloat(ixdrf, time, iret)
120 call xdrffloat(ixdrf, potE, iret)
121 call xdrffloat(ixdrf, uconst, iret)
123 call xdrffloat(ixdrf, uconst_back, iret)
125 call xdrffloat(ixdrf, t_bath, iret)
126 call xdrfint(ixdrf, nss, iret)
128 call xdrfint(ixdrf, ihpb(j), iret)
129 call xdrfint(ixdrf, jhpb(j), iret)
131 call xdrfint(ixdrf, nfrag, iret)
133 call xdrffloat(ixdrf, qfrag(i), iret)
138 call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
141 ! write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
142 ! write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
143 ! write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
145 write (*,'(3f10.5,i3)') (coord(k,j),k=1,3),j
147 if (mod(kk/ntraj,ifreq).eq.0 .and. mod(kk,ntraj).eq.itraj) then
148 if (isize .ne. nres+nct-nnt+1) then
149 print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
160 c(j,i+nres)=coord(j,ii+nres)
165 write (tytul,'(a,i6)') "Structure",kk
166 call pdbout(etot,tytul,9)
172 use geometry_data, only: nres,c,nfrag,boxxsize,boxysize,boxzsize
173 use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back,molnum
174 use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
175 integer :: allareout,i,j,k,nojumpval,chain_beg,mnum
176 integer :: chain_end,ireturnval
177 real*8 :: difference,xi,boxsize,x,xtemp,box2shift
180 if (molnum(i).eq.5) then
181 c(1,i)=dmod(c(1,i),boxxsize)
182 ! if (c(1,i).lt.0) c(1,i)=c(1,i)+boxxsize
184 print *,"return box,before wrap",c(1,i)
186 xtemp=dmod(x,boxsize)
187 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
188 box2shift=xtemp-boxsize
189 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
190 box2shift=xtemp+boxsize
195 ! print *,c(1,2),xi,xtemp,box2shift
197 print *,"after",c(1,2),xi,xtemp,box2shift,c(1,i)
199 c(2,i)=dmod(c(2,i),boxysize)
200 ! if (c(2,i).lt.0) c(2,i)=c(2,i)+boxysize
203 xtemp=dmod(x,boxsize)
204 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
205 box2shift=xtemp-boxsize
206 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
207 box2shift=xtemp+boxsize
213 ! c(3,i)=dmod(c(3,i),boxzsize)
214 if (c(3,i).lt.0) c(3,i)=c(3,i)+boxzsize
217 xtemp=dmod(x,boxsize)
218 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
219 box2shift=xtemp-boxsize
220 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
221 box2shift=xtemp+boxsize
228 c(1,i+nres)=dmod(c(1,i+nres),boxxsize)
229 c(2,i+nres)=dmod(c(2,i+nres),boxysize)
230 c(3,i+nres)=dmod(c(3,i+nres),boxzsize)
234 end subroutine returnbox