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,iires,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)
29 c write (iout,*) "READPDB: UNRES_PDB",unres_pdb
34 read (ipdbin,'(a80)',end=10) card
35 do while (card(:3).eq.'END' .or. card(:3).eq.'TER')
36 read (ipdbin,'(a80)',end=10) card
39 c write (iout,'(a)') card
41 c if (card(:3).eq.'END') goto 10
42 if (card(:3).eq.'END' .or. card(:3).eq.'TER') goto 10
44 if (index(card,"FREE ENERGY").gt.0) read(card(35:),*) efree_temp
45 C Fish out the ATOM cards.
46 if (index(card(1:4),'ATOM').gt.0) then
47 read (card(14:16),'(a3)') atom
48 c if (atom.eq.'CA' .or. atom.eq.'CH3') then
49 read (card(23:26),*) ires
50 read (card(18:20),'(a3)') res
51 c write (iout,*) "ires",ires,ires-ishift+ishift1,
52 c & " ires_old",ires_old
53 c write (iout,*) "ishift",ishift," ishift1",ishift1
54 c write (iout,*) "IRES",ires-ishift+ishift1,ires_old
56 iires=ires-ishift+ishift1
57 if (iires.ne.ires_old) then
58 C Calculate the CM of the preceding residue.
60 c write (iout,*) "Calculating sidechain center iii",iii
64 dc(j,ires)=sccor(j,iii)
67 call sccenter(iires-1,iii,sccor)
69 c write (iout,*) "sidechain center position calculated"
74 if (res.eq.'Cl-' .or. res.eq.'Na+') then
76 read (ipdbin,'(a80)',end=10) card
78 else if (ibeg.eq.1) then
79 c write (iout,*) "BEG ires",ires," iires",iires
82 if (res.ne.'GLY' .and. res.ne. 'ACE') then
86 ires=ires-ishift+ishift1
88 c write (iout,*) "ishift",ishift," ires",ires,
89 c & " iires",iires," ires_old",ires_old
93 ishift=ishift-(ires-ishift+ishift1-ires_old-1)
94 ires=ires-ishift+ishift1
96 c write (iout,*) "RESSHIFT",ires,iires,ishift,ishift1
99 c write (iout,*) "ires",ires," iires",iires
101 if (res.eq.'ACE' .or. res.eq.'NHE') then
104 itype(ires)=rescode(ires,res,0)
107 ires=ires-ishift+ishift1
109 c write (iout,*) "ires_old",ires_old," ires",ires," iires",iires
111 if (card(27:27).eq."A" .or. card(27:27).eq."B") then
114 c write (2,*) "iires",iires," res ",res," ity",ity
115 if (atom.eq.'CA' .or. atom.eq.'CH3' .or.
116 & res.eq.'NHE'.and.atom(:2).eq.'HN') then
117 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
119 write (iout,'(2i3,2x,a,3f8.3)')
120 & iires,itype(iires),res,(c(j,ires),j=1,3)
124 sccor(j,iii)=c(j,ires)
126 c write (*,*) card(23:27),ires,itype(ires)
127 else if (atom.ne.'O '.and.atom(1:1).ne.'H' .and.
128 & atom.ne.'N ' .and. atom.ne.'C ' .and.
129 & atom.ne.'OXT') then
131 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
134 read (ipdbin,'(a80)',end=10) card
136 10 if (lprn) write (iout,'(a,i5)') ' Number of residues found: ',ires
137 if (ires.eq.0) return1
138 C Calculate the CM of the last side chain.
142 dc(j,ires)=sccor(j,iii)
145 call sccenter(iires,iii,sccor)
151 if (itype(nres).ne.10) then
155 dcj=c(j,nres-2)-c(j,nres-3)
156 c(j,nres)=c(j,nres-1)+dcj
157 c(j,2*nres)=c(j,nres)
167 c(j,2*nres)=c(j,nres)
169 if (itype(1).eq.ntyp1) then
170 nsup(iprot)=nsup(iprot)-1
173 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
174 call refsys(2,3,4,e1,e2,e3,fail)
181 c(j,1)=c(j,2)-3.8d0*e2(j)
191 C Copy the coordinates to reference coordinates
194 c cref(j,i,iprot)=c(j,i)
197 C Calculate internal coordinates.
200 & "Cartesian coordinates of the reference structure"
201 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
202 & "Residue","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
204 write (iout,'(a3,1x,i3,3f8.3,5x,3f8.3)')
205 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
206 & (c(j,ires+nres),j=1,3)
209 call int_from_cart(.true.,lprn)
211 c phi_ref(i,iprot)=phi(i)
212 c theta_ref(i,iprot)=theta(i)
213 c alph_ref(i,iprot)=alph(i)
214 c omeg_ref(i,iprot)=omeg(i)
219 c---------------------------------------------------------------------------
220 subroutine int_from_cart(lside,lprn)
223 include 'DIMENSIONS.ZSCOPT'
224 include 'COMMON.LOCAL'
226 include 'COMMON.CHAIN'
227 include 'COMMON.INTERACT'
228 include 'COMMON.IOUNITS'
230 include 'COMMON.NAMES'
232 double precision dist,alpha,beta,di
233 character*3 seq,atom,res
235 double precision sccor(3,20)
240 & 'Internal coordinates of the reference structure.'
242 write (iout,'(8a)') 'Residue',' dvb',' Theta',
243 & ' Phi',' Dsc_id',' Dsc',' Alpha',
246 write (iout,'(4a)') 'Residue',' dvb',' Theta',
252 if (iti.ne.ntyp1 .and. itype(i+1).ne.ntyp1 .and.
253 & (dist(i,i+1).lt.2.0D0 .or. dist(i,i+1).gt.5.0D0)) then
254 write (iout,'(a,i4)') 'Bad Cartesians for residue',i
257 vbld(i+1)=dist(i,i+1)
258 vbld_inv(i+1)=1.0d0/vbld(i+1)
259 if (i.gt.1) theta(i+1)=alpha(i-1,i,i+1)
260 if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
262 dc(j,i)=c(j,i+1)-c(j,i)
263 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
269 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
274 if (itype(i).ne.10) then
275 vbld_inv(i+nres)=1.0d0/di
277 dc(j,i+nres)=c(j,i+nres)-c(j,i)
278 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
281 vbld_inv(i+nres)=0.0d0
284 dc_norm(j,i+nres)=0.0d0
288 alph(i)=alpha(nres+i,i,maxres2)
289 omeg(i)=beta(nres+i,i,maxres2,i+1)
292 & write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
293 & rad2deg*theta(i),rad2deg*phi(i),dsc(iti),di,
294 & rad2deg*alph(i),rad2deg*omeg(i)
301 write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
302 & rad2deg*theta(i),rad2deg*phi(i)
307 c---------------------------------------------------------------------------
308 subroutine sccenter(ires,nscat,sccor)
311 include 'DIMENSIONS.ZSCOPT'
312 include 'COMMON.CHAIN'
313 integer ires,nscat,i,j
314 double precision sccmj
315 double precision sccor(3,20)
319 sccmj=sccmj+sccor(j,i)
321 dc(j,ires)=sccmj/nscat