1 subroutine conf_compar(jcon,lprn,print_class)
2 implicit real*8 (a-h,o-z)
7 include 'DIMENSIONS.ZSCOPT'
8 include 'DIMENSIONS.COMPAR'
9 include 'DIMENSIONS.FREE'
10 include 'COMMON.CONTROL'
11 include 'COMMON.IOUNITS'
12 include 'COMMON.COMPAR'
13 include 'COMMON.CHAIN'
14 include 'COMMON.INTERACT'
16 include 'COMMON.PEPTCONT'
17 include 'COMMON.CONTACTS1'
18 include 'COMMON.HEADER'
20 include 'COMMON.ENERGIES'
26 logical lprn,print_class
27 integer ncont_frag(mmaxfrag),
28 & icont_frag(2,maxcont,mmaxfrag),ncontsc,
29 & icontsc(1,maxcont),nsccont_frag(mmaxfrag),
30 & isccont_frag(2,maxcont,mmaxfrag)
31 integer isecstr(maxres)
32 integer itemp(maxfrag)
35 c print *,"Enter conf_compar",jcon
36 call angnorm12(rmsang)
37 c Level 1: check secondary and supersecondary structure
38 call elecont(lprn,ncont,icont,nnt,nct)
40 write (iout,*) "elecont finished"
43 call secondary2(lprn,.false.,ncont,icont,isecstr)
45 write (iout,*) "secondary2 finished"
48 call contact(lprn,ncontsc,icontsc,nnt,nct)
50 write(iout,*) "Assigning electrostatic contacts"
53 call contacts_between_fragments(lprn,3,ncont,icont,ncont_frag,
56 write(iout,*) "Assigning sidechain contacts"
59 call contacts_between_fragments(lprn,3,ncontsc,icontsc,
60 & nsccont_frag,isccont_frag)
62 write(iout,*) "--> After contacts_between_fragments"
66 do j=1,isnfrag(nlevel+1)
73 write (iout,'(80(1h=))')
74 write (iout,*) "Level",1," fragment",j
75 write (iout,'(80(1h=))')
78 rmsfrag(j,1)=rmscalc(0,1,j,jcon,lprn)
79 c Compare electrostatic contacts in the current conf with that in the native
81 if (lprn) write (iout,*)
82 & "Comparing electrostatic contact map and local structure"
84 ncnat=ncont_frag_ref(ind)
85 c write (iout,*) "before match_contact:",nc_fragm(j,1),
88 call match_secondary(j,isecstr,nsec_match,lprn)
89 if (lprn) write (iout,*) "Fragment",j," nsec_match",
90 & nsec_match," length",len_frag(j,1)," min_len",
91 & frac_sec*len_frag(j,1)
92 if (nsec_match.lt.frac_sec*len_frag(j,1)) then
94 if (lprn) write (iout,*) "Fragment",j,
95 & " has incorrect secondary structure"
98 if (lprn) write (iout,*) "Fragment",j,
99 & " has correct secondary structure"
101 if (ielecont(j,1).gt.0) then
102 call match_contact(ishif1,ishif2,nc_match,ncon_match,
103 & ncont_frag_ref(ind),icont_frag_ref(1,1,ind),
104 & ncont_frag(ind),icont_frag(1,1,ind),
105 & j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),
106 & nc_req_setf(j,1),istruct(j),.true.,lprn)
107 else if (isccont(j,1).gt.0) then
108 call match_contact(ishif1,ishif2,nc_match,ncon_match,
109 & nsccont_frag_ref(ind),isccont_frag_ref(1,1,ind),
110 & nsccont_frag(ind),isccont_frag(1,1,ind),
111 & j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),
112 & nc_req_setf(j,1),istruct(j),.true.,lprn)
113 else if (iloc(j).gt.0) then
114 c write (iout,*) "n_shif",n_shift(1,j,1),n_shift(2,j,1)
115 call match_contact(ishif1,ishif2,nc_match,ncon_match,
116 & 0,icont_frag_ref(1,1,ind),
117 & ncont_frag(ind),icont_frag(1,1,ind),
118 & j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),
119 & 0,istruct(j),.true.,lprn)
120 c write (iout,*) "n_shif",n_shift(1,j,1),n_shift(2,j,1)
125 if (lprn) write (iout,*) "ishif1",ishif1," ishif2",ishif2
127 qfrag(j,1)=qwolynes(1,j)
128 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
129 if (lprn) write (iout,*) "ishift",ishif," nc_match",nc_match
130 c write (iout,*) "j",j," ishif",ishif," rms",rmsfrag(j,1)
131 if (irms(j,1).gt.0) then
132 if (rmsfrag(j,1).le.rmscutfrag(1,j,1)) then
139 do while (rms.gt.rmscutfrag(1,j,1) .and.
140 & ishiff.lt.n_shift(1,j,1))
142 rms=rmscalc(-ishiff,1,j,jcon,lprn)
143 c write(iout,*)"jcon,i,j,ishiff",jcon,i,j,-ishiff,
144 c & " rms",rms," rmscut",rmscutfrag(1,j,1)
145 if (lprn) write (iout,*) "rms",rmsfrag(j,1)
146 if (rms.gt.rmscutfrag(1,j,1)) then
147 rms=rmscalc(ishiff,1,j,jcon,lprn)
148 c write (iout,*) "jcon,1,j,ishiff",jcon,1,j,ishiff,
151 if (lprn) write (iout,*) "rms",rmsfrag(j,1)
153 c write (iout,*) "After loop: rms",rms,
154 c & " rmscut",rmscutfrag(1,j,1)
155 c write (iout,*) "iclass_rms",iclass_rms
156 if (rms.le.rmscutfrag(1,j,1)) then
161 c write (iout,*) "iclass_rms",iclass_rms
163 c write (iout,*) "ishif",ishif
164 if (iabs(ishifft_rms).gt.iabs(ishif)) ishif=ishifft_rms
168 c write (iout,*) "ishif",ishif," iclass",iclass(j,1),
169 c & " iclass_rms",iclass_rms
170 if (nc_match.gt.0 .and. iclass_rms.gt.0) then
172 iclass(j,1)=iclass(j,1)+6
174 iclass(j,1)=iclass(j,1)+2
177 ncont_nat(1,j,1)=nc_match
178 ncont_nat(2,j,1)=ncon_match
180 c write (iout,*) "iclass",iclass(j,1)
182 c Next levels: Check arrangements of elementary fragments.
185 if (i .eq. 2) ind = icant(ipiece(1,j,i),ipiece(2,j,i))
187 write (iout,'(80(1h=))')
188 write (iout,*) "Level",i," fragment",j
189 write (iout,'(80(1h=))')
191 c If an elementary fragment doesn't exist, don't check higher hierarchy levels.
194 if (iclass(ik,1).eq.0) then
199 if (i.eq.2 .and. ielecont(j,i).gt.0) then
202 if (lprn) write (iout,*)
203 & "Comparing electrostatic contact map: fragments",
204 & ipiece(1,j,i),ipiece(2,j,i)," ind",ind
205 call match_contact(ishif1,ishif2,nc_match,ncon_match,
206 & ncont_frag_ref(ind),icont_frag_ref(1,1,ind),
207 & ncont_frag(ind),icont_frag(1,1,ind),
208 & j,n_shift(1,j,i),n_shift(2,j,i),nc_fragm(j,i),
209 & nc_req_setf(j,i),2,.false.,lprn)
211 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
212 if (nc_match.gt.0) then
219 ncont_nat(1,j,i)=nc_match
220 ncont_nat(2,j,i)=ncon_match
222 else if (i.eq.2 .and. isccont(j,i).gt.0) then
225 if (lprn) write (iout,*)
226 & "Comparing sidechain contact map: fragments",
227 & ipiece(1,j,i),ipiece(2,j,i)," ind",ind
228 call match_contact(ishif1,ishif2,nc_match,ncon_match,
229 & nsccont_frag_ref(ind),isccont_frag_ref(1,1,ind),
230 & nsccont_frag(ind),isccont_frag(1,1,ind),
231 & j,n_shift(1,j,i),n_shift(2,j,i),nc_fragm(j,i),
232 & nc_req_setf(j,i),2,.false.,lprn)
234 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
235 if (nc_match.gt.0) then
242 ncont_nat(1,j,i)=nc_match
243 ncont_nat(2,j,i)=ncon_match
245 else if (i.eq.2) then
249 if (i.eq.2) qfrag(j,2)=qwolynes(2,j)
250 if (lprn) write (iout,*)
251 & "Comparing rms: fragments",
252 & (ipiece(k,j,i),k=1,npiece(j,i))
253 rmsfrag(j,i)=rmscalc(0,i,j,jcon,lprn)
254 if (irms(j,i).gt.0) then
257 if (lprn) write (iout,*) "rms",rmsfrag(j,i)
258 c write (iout,*) "i",i," j",j," rmsfrag",rmsfrag(j,i),
259 c & " rmscutfrag",rmscutfrag(1,j,i)
260 if (rmsfrag(j,i).le.rmscutfrag(1,j,i)) then
266 do while (rms.gt.rmscutfrag(1,j,i) .and.
267 & ishif.lt.n_shift(1,j,i))
269 rms=rmscalc(-ishif,i,j,jcon,lprn)
270 c print *,"jcon,i,j,ishif",jcon,i,j,-ishif," rms",rms
271 if (lprn) write (iout,*) "rms",rmsfrag(j,i)
272 if (rms.gt.rmscutfrag(1,j,i)) then
273 rms=rmscalc(ishif,i,j,jcon,lprn)
274 c print *,"jcon,i,j,ishif",jcon,i,j,ishif," rms",rms
276 if (lprn) write (iout,*) "rms",rms
278 if (rms.le.rmscutfrag(1,j,i)) then
285 if (irms(j,i).eq.0 .and. ielecont(j,i).eq.0 .and.
286 & isccont(j,i).eq.0 ) then
287 write (iout,*) "Error: no measure of comparison specified:",
288 & " level",i," part",j
292 & write (iout,*) "iclass_con",iclass_con," iclass_rms",iclass_rms
294 iclass(j,i) = min0(iclass_con,iclass_rms)
295 if (iabs(ishifft_rms).gt.iabs(ishifft_con)) then
296 ishifft(j,i)=ishifft_rms
298 ishifft(j,i)=ishifft_con
300 else if (i.gt.2) then
301 iclass(j,i) = iclass_rms
302 ishifft(j,i)= ishifft_rms
309 C Compute the structural class
311 IF (.NOT. BINARY) THEN
319 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-kk*nfrag(i)-j
323 c write (iout,*) "i",i," j",j," idig",idig," iex",iex,
324 c & " iclass",iclass(j,i)," im",im
330 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-j
332 if (iclass(j,i).gt.0) then
337 c write (iout,*) "i",i," j",j," idig",idig," iex",iex,
338 c & " iclass",iclass(j,i)," im",im
342 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-nfrag(i)-j
344 if (iclass(j,i).gt.1) then
349 c write (iout,*) "i",i," j",j," idig",idig," iex",iex,
350 c & " iclass",iclass(j,i)," im",im
357 if (print_class) then
359 write(istat,'(i6,$)') jcon+indstart(me)-1
360 write (istat,'(f10.2,$)') (potE(jcon,k),k=1,nParmSet),
363 write(istat,'(i6,$)') jcon
364 write (istat,'(f10.2,$)') (potE(jcon,k),k=1,nParmSet),
367 write (istat,'(f8.3,2f6.3,$)')
368 & rms_nat,qnat,rmsang/(nres-3)
370 write(istat,'(1x,$,20(i3,$))')
371 & (ncont_nat(1,k,j),k=1,nfrag(j))
373 write(istat,'(1x,$,20(f5.1,f5.2$))')
374 & (rmsfrag(k,j),qfrag(k,j),k=1,nfrag(j))
376 write(istat,'(1x,$,20(f5.1$))')
377 & (rmsfrag(k,j),k=1,nfrag(j))
379 write(istat,'(1x,$,20(i1,$))')
380 & (iclass(k,j),k=1,nfrag(j))
383 write (istat,'(" ",$)')
385 write (istat,'(100(i1,$))')(iclass(k,j),
387 if (j.lt.nlevel) write(iout,'(".",$)')
391 write (istat,'(i10)') iscore