1 subroutine readpdb(lprn,iprot,efree_temp,*)
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'
16 integer i,j,iprot,ibeg,ishift1,ires,iii,ires_old,ishift,ity,
19 double precision e1(3),e2(3),e3(3)
20 double precision dcj,efree_temp
21 character*3 seq,atom,res
23 double precision sccor(3,20)
28 write (2,*) "UNRES_PDB",unres_pdb
31 read (ipdbin,'(a80)',end=10) card
32 if (card(:3).eq.'END' .or. card(:3).eq.'TER') goto 10
34 if (index(card,"FREE ENERGY").gt.0) read(card(35:),*) efree_temp
35 C Fish out the ATOM cards.
36 if (index(card(1:4),'ATOM').gt.0) then
37 read (card(14:16),'(a3)') atom
38 if (atom.eq.'CA' .or. atom.eq.'CH3') then
39 C Calculate the CM of the preceding residue.
40 c if (ibeg.eq.0) call sccenter(ires,iii,sccor)
44 dc(j,ires)=sccor(j,iii)
47 call sccenter(ires,iii,sccor)
51 ires_old=ires+ishift-ishift1
52 read (card(23:26),*) ires
53 c print *,"ires_old",ires_old," ires",ires
54 if (card(27:27).eq."A" .or. card(27:27).eq."B") then
57 read (card(18:20),'(a3)') res
60 if (res.ne.'GLY' .and. res.ne. 'ACE') then
66 ishift=ishift+ires-ires_old-1
68 ires=ires-ishift+ishift1
69 if (res.eq.'ACE' .or. res.eq.'NHE') then
72 itype(ires)=rescode(ires,res,0)
74 c write (2,*) "ires",ires," res ",res," ity",ity
75 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
77 write (iout,'(2i3,2x,a,3f8.3)')
78 & ires,itype(ires),res,(c(j,ires),j=1,3)
82 sccor(j,iii)=c(j,ires)
84 c write (*,*) card(23:27),ires,itype(ires)
85 else if (atom.ne.'O '.and.atom(1:1).ne.'H' .and.
86 & atom.ne.'N ' .and. atom.ne.'C ') then
88 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
92 10 write (iout,'(a,i5)') ' Number of residues found: ',ires
93 if (ires.eq.0) return1
94 C Calculate the CM of the last side chain.
97 dc(j,ires)=sccor(j,iii)
100 call sccenter(ires,iii,sccor)
105 if (itype(nres).ne.10) then
109 dcj=c(j,nres-2)-c(j,nres-3)
110 c(j,nres)=c(j,nres-1)+dcj
111 c(j,2*nres)=c(j,nres)
121 c(j,2*nres)=c(j,nres)
123 if (itype(1).eq.21) then
124 nsup(iprot)=nsup(iprot)-1
127 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
128 call refsys(2,3,4,e1,e2,e3,fail)
135 c(j,1)=c(j,2)-3.8d0*e2(j)
145 C Copy the coordinates to reference coordinates
148 c cref(j,i,iprot)=c(j,i)
151 C Calculate internal coordinates.
154 & "Cartesian coordinates of the reference structure"
155 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
156 & "Residue","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
158 write (iout,'(a3,1x,i3,3f8.3,5x,3f8.3)')
159 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
160 & (c(j,ires+nres),j=1,3)
163 call int_from_cart(.true.,lprn)
165 c phi_ref(i,iprot)=phi(i)
166 c theta_ref(i,iprot)=theta(i)
167 c alph_ref(i,iprot)=alph(i)
168 c omeg_ref(i,iprot)=omeg(i)
173 c---------------------------------------------------------------------------
174 subroutine int_from_cart(lside,lprn)
177 include 'DIMENSIONS.ZSCOPT'
178 include 'COMMON.LOCAL'
180 include 'COMMON.CHAIN'
181 include 'COMMON.INTERACT'
182 include 'COMMON.IOUNITS'
184 include 'COMMON.NAMES'
186 double precision dist,alpha,beta,di
187 character*3 seq,atom,res
189 double precision sccor(3,20)
194 & 'Internal coordinates of the reference structure.'
196 write (iout,'(8a)') 'Residue',' dvb',' Theta',
197 & ' Phi',' Dsc_id',' Dsc',' Alpha',
200 write (iout,'(4a)') 'Residue',' dvb',' Theta',
206 if (iti.ne.21 .and. itype(i+1).ne.21 .and.
207 & (dist(i,i+1).lt.2.0D0 .or. dist(i,i+1).gt.5.0D0)) then
208 write (iout,'(a,i4)') 'Bad Cartesians for residue',i
211 vbld(i+1)=dist(i,i+1)
212 vbld_inv(i+1)=1.0d0/vbld(i+1)
213 if (i.gt.1) theta(i+1)=alpha(i-1,i,i+1)
214 if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
216 dc(j,i)=c(j,i+1)-c(j,i)
217 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
223 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
228 if (itype(i).ne.10) then
229 vbld_inv(i+nres)=1.0d0/di
231 dc(j,i+nres)=c(j,i+nres)-c(j,i)
232 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
235 vbld_inv(i+nres)=0.0d0
238 dc_norm(j,i+nres)=0.0d0
242 alph(i)=alpha(nres+i,i,maxres2)
243 omeg(i)=beta(nres+i,i,maxres2,i+1)
246 & write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
247 & rad2deg*theta(i),rad2deg*phi(i),dsc(iti),di,
248 & rad2deg*alph(i),rad2deg*omeg(i)
255 write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
256 & rad2deg*theta(i),rad2deg*phi(i)
261 c---------------------------------------------------------------------------
262 subroutine sccenter(ires,nscat,sccor)
265 include 'DIMENSIONS.ZSCOPT'
266 include 'COMMON.CHAIN'
267 integer ires,nscat,i,j
268 double precision sccmj
269 double precision sccor(3,20)
273 sccmj=sccmj+sccor(j,i)
275 dc(j,ires)=sccmj/nscat