2 C Read the PDB file and convert the peptide geometry into virtual-chain
6 include 'DIMENSIONS.ZSCOPT'
7 include 'COMMON.CONTROL'
10 include 'COMMON.CHAIN'
11 include 'COMMON.INTERACT'
12 include 'COMMON.IOUNITS'
14 include 'COMMON.NAMES'
15 include 'COMMON.SBRIDGE'
16 character*3 seq,atom,res
18 double precision sccor(3,50)
19 integer i,j,iii,ibeg,ishift,ishift1,ity,ires,ires_old
21 integer rescode,kkk,lll,icha,cou,kupa,iprzes
25 read (ipdbin,'(a80)',end=10) card
26 if (card(:3).eq.'END') then
28 else if (card(:3).eq.'TER') then
32 itype(ires_old-1)=ntyp1
35 c write (iout,*) "Chain ended",ires,ishift,ires_old
36 call sccenter(ires,iii,sccor)
38 C Fish out the ATOM cards.
39 if (index(card(1:4),'ATOM').gt.0) then
40 read (card(14:16),'(a3)') atom
41 if (atom.eq.'CA' .or. atom.eq.'CH3') then
42 C Calculate the CM of the preceding residue.
44 call sccenter(ires,iii,sccor)
47 c write (iout,'(a80)') card
48 read (card(23:26),*) ires
49 read (card(18:20),'(a3)') res
52 if (res.ne.'GLY' .and. res.ne. 'ACE') then
56 c write (iout,*) "ires",ires," ibeg",ibeg," ishift",ishift
58 else if (ibeg.eq.2) then
60 ishift=-ires_old+ires-1
61 c write (iout,*) "New chain started",ires,ishift
65 c write (2,*) "ires",ires," ishift",ishift
66 if (res.eq.'ACE') then
69 itype(ires)=rescode(ires,res,0)
71 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
72 read(card(61:66),*) bfac(ires)
73 write (iout,'(2i3,2x,a,3f8.3,5x,f8.3)')
74 & ires,itype(ires),res,(c(j,ires),j=1,3),bfac(ires)
77 sccor(j,iii)=c(j,ires)
79 else if (atom.ne.'O '.and.atom(1:1).ne.'H' .and.
80 & atom(1:1).ne.'Q' .and. atom(1:2).ne.'1H' .and.
81 & atom(1:2).ne.'2H' .and. atom(1:2).ne.'3H' .and.
82 & atom.ne.'N ' .and. atom.ne.'C ') then
84 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
88 10 write (iout,'(a,i5)') ' Nres: ',ires
89 C Calculate dummy residue coordinates inside the "chain" of a multichain
93 c write (iout,*) i,itype(i)
95 if (itype(i).eq.ntyp1) then
96 if (itype(i+1).eq.ntyp1) then
97 C 16/01/2014 by Adasko: Adding to dummy atoms in the chain
98 C first is connected prevous chain (itype(i+1).eq.ntyp1)=true
99 C second dummy atom is conected to next chain itype(i+1).eq.ntyp1=false
100 C if (unres_pdb) then
101 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
102 C call refsys(i-3,i-2,i-1,e1,e2,e3,fail)
109 C c(j,i)=c(j,i-1)-1.9d0*e2(j)
113 dcj=(c(j,i-2)-c(j,i-3))/2.0
118 else !itype(i+1).eq.ntyp1
119 C if (unres_pdb) then
120 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
121 C call refsys(i+1,i+2,i+3,e1,e2,e3,fail)
128 C c(j,i)=c(j,i+1)-1.9d0*e2(j)
132 dcj=(c(j,i+3)-c(j,i+2))/2.0
137 endif !itype(i+1).eq.ntyp1
138 endif !itype.eq.ntyp1
140 C Calculate the CM of the last side chain.
141 call sccenter(ires,iii,sccor)
144 if (itype(nres).ne.10) then
148 dcj=(c(j,nres-2)-c(j,nres-3))/2.0
149 c(j,nres)=c(j,nres-1)+dcj
150 c(j,2*nres)=c(j,nres)
160 c(j,2*nres)=c(j,nres)
162 if (itype(1).eq.ntyp1) then
166 dcj=(c(j,4)-c(j,3))/2.0
171 C Calculate internal coordinates.
173 write (iout,'(2i3,2x,a,3f8.3,5x,3f8.3)')
174 & ires,itype(ires),restyp(itype(ires)),(c(j,ires),j=1,3),
175 & (c(j,nres+ires),j=1,3)
177 call int_from_cart(.true.,.false.)
178 write (iout,*) "After int_from_cart"
182 dc(j,i)=c(j,i+1)-c(j,i)
183 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
188 dc(j,i+nres)=c(j,i+nres)-c(j,i)
189 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
191 c write (iout,*) i,(dc(j,i+nres),j=1,3),(dc_norm(j,i+nres),j=1,3),
195 C Copy the coordinates to reference coordinates
199 cref(j,i+nres)=c(j,i+nres)
202 100 format (//' alpha-carbon coordinates ',
203 & ' centroid coordinates'/
204 1 ' ', 6X,'X',11X,'Y',11X,'Z',
205 & 10X,'X',11X,'Y',11X,'Z')
206 110 format (a,'(',i3,')',6f12.5)
211 c---------------------------------------------------------------------------
212 subroutine int_from_cart(lside,lprn)
215 include 'DIMENSIONS.ZSCOPT'
216 include 'COMMON.LOCAL'
218 include 'COMMON.CHAIN'
219 include 'COMMON.INTERACT'
220 include 'COMMON.IOUNITS'
222 include 'COMMON.NAMES'
223 character*3 seq,atom,res
225 double precision sccor(3,50)
227 double precision dist,alpha,beta,di
232 & 'Internal coordinates calculated from crystal structure.'
234 write (iout,'(8a)') ' Res ',' dvb',' Theta',
235 & ' Phi',' Dsc_id',' Dsc',' Alpha',
238 write (iout,'(4a)') ' Res ',' dvb',' Theta',
244 c write (iout,*) i,i-1,(c(j,i),j=1,3),(c(j,i-1),j=1,3),dist(i,i-1)
245 if (itype(i-1).ne.ntyp1 .and. itype(i).ne.ntyp1 .and.
246 & (dist(i,i-1).lt.1.0D0 .or. dist(i,i-1).gt.6.0D0)) then
247 write (iout,'(a,i4)') 'Bad Cartesians for residue',i
250 theta(i+1)=alpha(i-1,i,i+1)
251 if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
253 if (itype(1).eq.ntyp1) then
255 c(j,1)=c(j,2)+(c(j,3)-c(j,4))
258 if (itype(nres).eq.ntyp1) then
260 c(j,nres)=c(j,nres-1)+(c(j,nres-2)-c(j,nres-3))
266 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
271 alph(i)=alpha(nres+i,i,maxres2)
272 omeg(i)=beta(nres+i,i,maxres2,i+1)
275 & write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
276 & rad2deg*theta(i),rad2deg*phi(i),dsc(iti),di,
277 & rad2deg*alph(i),rad2deg*omeg(i)
282 write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
283 & rad2deg*theta(i),rad2deg*phi(i)
288 c---------------------------------------------------------------------------
289 subroutine sccenter(ires,nscat,sccor)
292 include 'COMMON.CHAIN'
293 integer ires,nscat,i,j
294 double precision sccor(3,50),sccmj
298 sccmj=sccmj+sccor(j,i)
300 dc(j,ires)=sccmj/nscat