2 C Read the PDB file and convert the peptide geometry into virtual-chain
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
26 read (ipdbin,'(a80)',end=10) card
27 if (card(:3).eq.'END') then
29 else if (card(:3).eq.'TER') then
33 itype(ires_old-1)=ntyp1
36 c write (iout,*) "Chain ended",ires,ishift,ires_old
37 call sccenter(ires,iii,sccor)
39 C Fish out the ATOM cards.
40 if (index(card(1:4),'ATOM').gt.0) then
41 read (card(14:16),'(a3)') atom
42 if (atom.eq.'CA' .or. atom.eq.'CH3') then
43 C Calculate the CM of the preceding residue.
45 call sccenter(ires,iii,sccor)
48 c write (iout,'(a80)') card
49 read (card(23:26),*) ires
50 read (card(18:20),'(a3)') res
53 if (res.ne.'GLY' .and. res.ne. 'ACE') then
57 c write (iout,*) "ires",ires," ibeg",ibeg," ishift",ishift
59 else if (ibeg.eq.2) then
61 ishift=-ires_old+ires-1
62 c write (iout,*) "New chain started",ires,ishift
66 c write (2,*) "ires",ires," ishift",ishift
67 if (res.eq.'ACE') then
70 itype(ires)=rescode(ires,res,0)
72 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
73 read(card(61:66),*) bfac(ires)
74 write (iout,'(2i3,2x,a,3f8.3)')
75 & ires,itype(ires),res,(c(j,ires),j=1,3)
78 sccor(j,iii)=c(j,ires)
80 else if (atom.ne.'O '.and.atom(1:1).ne.'H' .and.
81 & atom(1:1).ne.'Q' .and. atom(1:2).ne.'1H' .and.
82 & atom(1:2).ne.'2H' .and. atom(1:2).ne.'3H' .and.
83 & atom.ne.'N ' .and. atom.ne.'C ') then
85 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
89 10 write (iout,'(a,i5)') ' Nres: ',ires
90 C Calculate dummy residue coordinates inside the "chain" of a multichain
94 c write (iout,*) i,itype(i)
96 if (itype(i).eq.ntyp1) then
97 if (itype(i+1).eq.ntyp1) then
98 C 16/01/2014 by Adasko: Adding to dummy atoms in the chain
99 C first is connected prevous chain (itype(i+1).eq.ntyp1)=true
100 C second dummy atom is conected to next chain itype(i+1).eq.ntyp1=false
101 C if (unres_pdb) then
102 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
103 C call refsys(i-3,i-2,i-1,e1,e2,e3,fail)
110 C c(j,i)=c(j,i-1)-1.9d0*e2(j)
114 dcj=(c(j,i-2)-c(j,i-3))/2.0
119 else !itype(i+1).eq.ntyp1
120 C if (unres_pdb) then
121 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
122 C call refsys(i+1,i+2,i+3,e1,e2,e3,fail)
129 C c(j,i)=c(j,i+1)-1.9d0*e2(j)
133 dcj=(c(j,i+3)-c(j,i+2))/2.0
138 endif !itype(i+1).eq.ntyp1
139 endif !itype.eq.ntyp1
141 C Calculate the CM of the last side chain.
142 call sccenter(ires,iii,sccor)
145 if (itype(nres).ne.10) then
149 dcj=(c(j,nres-2)-c(j,nres-3))/2.0
150 c(j,nres)=c(j,nres-1)+dcj
151 c(j,2*nres)=c(j,nres)
161 c(j,2*nres)=c(j,nres)
163 if (itype(1).eq.ntyp1) then
167 dcj=(c(j,4)-c(j,3))/2.0
172 C Calculate internal coordinates.
174 write (iout,'(2i3,2x,a,3f8.3,5x,3f8.3)')
175 & ires,itype(ires),restyp(itype(ires)),(c(j,ires),j=1,3),
176 & (c(j,nres+ires),j=1,3)
178 call int_from_cart(.true.,.false.)
179 c write (iout,*) "After int_from_cart"
183 dc(j,i)=c(j,i+1)-c(j,i)
184 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
189 dc(j,i+nres)=c(j,i+nres)-c(j,i)
190 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
192 c write (iout,*) i,(dc(j,i+nres),j=1,3),(dc_norm(j,i+nres),j=1,3),
196 C Copy the coordinates to reference coordinates
203 write (iout,110) restyp(itype(i)),i,cref_pdb(1,i),
204 & cref_pdb(2,i),cref_pdb(3,i),cref_pdb(1,nres+i),
205 & cref_pdb(2,nres+i),cref_pdb(3,nres+i)
207 100 format (//' alpha-carbon coordinates ',
208 & ' centroid coordinates'/
209 1 ' ', 6X,'X',11X,'Y',11X,'Z',
210 & 10X,'X',11X,'Y',11X,'Z')
211 110 format (a,'(',i3,')',6f12.5)
215 c---------------------------------------------------------------------------
216 subroutine int_from_cart(lside,lprn)
219 include 'sizesclu.dat'
220 include 'COMMON.LOCAL'
222 include 'COMMON.CHAIN'
223 include 'COMMON.INTERACT'
224 include 'COMMON.IOUNITS'
226 include 'COMMON.NAMES'
227 character*3 seq,atom,res
229 double precision sccor(3,20)
231 double precision dist,alpha,beta,di
236 & 'Internal coordinates calculated from crystal structure.'
238 write (iout,'(8a)') ' Res ',' dvb',' Theta',
239 & ' Phi',' Dsc_id',' Dsc',' Alpha',
242 write (iout,'(4a)') ' Res ',' dvb',' Theta',
248 c write (iout,*) i,i-1,(c(j,i),j=1,3),(c(j,i-1),j=1,3),dist(i,i-1)
249 if (itype(i-1).ne.ntyp1 .and. itype(i).ne.ntyp1 .and.
250 & (dist(i,i-1).lt.1.0D0 .or. dist(i,i-1).gt.6.0D0)) then
251 write (iout,'(a,i4)') 'Bad Cartesians for residue',i
254 theta(i+1)=alpha(i-1,i,i+1)
255 if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
257 if (itype(1).eq.ntyp1) then
259 c(j,1)=c(j,2)+(c(j,3)-c(j,4))
262 if (itype(nres).eq.ntyp1) then
264 c(j,nres)=c(j,nres-1)+(c(j,nres-2)-c(j,nres-3))
270 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
275 alph(i)=alpha(nres+i,i,maxres2)
276 omeg(i)=beta(nres+i,i,maxres2,i+1)
279 & write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
280 & rad2deg*theta(i),rad2deg*phi(i),dsc(iti),di,
281 & rad2deg*alph(i),rad2deg*omeg(i)
286 write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
287 & rad2deg*theta(i),rad2deg*phi(i)
292 c---------------------------------------------------------------------------
293 subroutine sccenter(ires,nscat,sccor)
296 include 'COMMON.CHAIN'
297 integer ires,nscat,i,j
298 double precision sccor(3,20),sccmj
302 sccmj=sccmj+sccor(j,i)
304 dc(j,ires)=sccmj/nscat