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)
127 call xdrffloat(ixdrf, uconst_back, iret)
130 call xdrfint(ixdrf, nss, iret)
132 call xdrfint(ixdrf, ihpb(j), iret)
133 call xdrfint(ixdrf, jhpb(j), iret)
135 call xdrfint(ixdrf, nfrag, iret)
137 call xdrffloat(ixdrf, qfrag(i), iret)
142 call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
144 print *,"search here"
145 write (*,'(e15.8,2e15.5,2f12.5)') time,potE,uconst,t_bath,&
147 ! write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
148 ! write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
150 write (*,'(3f10.5,i3)') (coord(k,j),k=1,3),j
152 if (mod(kk/ntraj,ifreq).eq.0 .and. mod(kk,ntraj).eq.itraj) then
153 if (isize .ne. nres+nct-nnt+1) then
154 print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
165 c(j,i+nres)=coord(j,ii+nres)
170 ! write (tytul,'(a,i6)') "Structure",kk
171 write (tytul,'(a,i6,a,f8.3)') "Structure",kk,"Temp",t_bath
172 call pdbout(etot,tytul,9)
178 use geometry_data, only: nres,c,nfrag,boxxsize,boxysize,boxzsize
179 use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back,molnum
180 use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
181 integer :: allareout,i,j,k,nojumpval,chain_beg,mnum
182 integer :: chain_end,ireturnval
183 real*8 :: difference,xi,boxsize,x,xtemp,box2shift
186 if (molnum(i).eq.5) then
187 c(1,i)=dmod(c(1,i),boxxsize)
188 ! if (c(1,i).lt.0) c(1,i)=c(1,i)+boxxsize
190 print *,"return box,before wrap",c(1,i)
192 xtemp=dmod(x,boxsize)
193 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
194 box2shift=xtemp-boxsize
195 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
196 box2shift=xtemp+boxsize
201 ! print *,c(1,2),xi,xtemp,box2shift
203 print *,"after",c(1,2),xi,xtemp,box2shift,c(1,i)
205 c(2,i)=dmod(c(2,i),boxysize)
206 ! if (c(2,i).lt.0) c(2,i)=c(2,i)+boxysize
209 xtemp=dmod(x,boxsize)
210 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
211 box2shift=xtemp-boxsize
212 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
213 box2shift=xtemp+boxsize
219 ! c(3,i)=dmod(c(3,i),boxzsize)
220 if (c(3,i).lt.0) c(3,i)=c(3,i)+boxzsize
223 xtemp=dmod(x,boxsize)
224 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
225 box2shift=xtemp-boxsize
226 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
227 box2shift=xtemp+boxsize
234 c(1,i+nres)=dmod(c(1,i+nres),boxxsize)
235 c(2,i+nres)=dmod(c(2,i+nres),boxysize)
236 c(3,i+nres)=dmod(c(3,i+nres),boxzsize)
240 end subroutine returnbox