2 C Program to cluster united-residue MCM results.
7 include 'COMMON.INTERACT'
10 include 'COMMON.HEADER'
11 include 'COMMON.CONTROL'
12 include 'COMMON.CONTACTS'
13 include 'COMMON.CHAIN'
15 include 'COMMON.CLUSTER'
16 include 'COMMON.IOUNITS'
17 logical printang(max_cut)
18 integer printpdb(max_cut)
19 integer printmol2(max_cut)
21 REAL CRIT(maxconf),MEMBR(maxconf)
22 REAL CRITVAL(maxconf-1)
24 INTEGER IA(maxconf),IB(maxconf)
25 INTEGER ICLASS(maxconf,maxconf-1),HVALS(maxconf-1)
26 INTEGER IORDER(maxconf-1),HEIGHT(maxconf-1)
27 DIMENSION NN(maxconf),DISNN(maxconf)
30 double precision varia(maxvar)
31 double precision hrtime,mintime,sectime
33 double precision eee(n_ene,maxconf)
46 print *,'MAIN: nnt=',nnt,' nct=',nct
52 IF (RCUTOFF(I).LT.0.0) THEN
53 RCUTOFF(I)=ABS(RCUTOFF(I))
59 PRINT *,'Number of cutoffs:',NCUT
60 PRINT *,'Cutoff values:'
62 PRINT '(8HRCUTOFF(,I2,2H)=,F8.1,2i2)',ICUT,RCUTOFF(ICUT),
63 & printpdb(icut),printmol2(icut)
72 read (intin,*,end=13,err=11) energy(icon),totfree(icon),
74 & nss_all(icon),(ihpb_all(ii,icon),jhpb_all(i,icon),
75 & i=1,nss_all(icon)),iscore(icon)
77 read (intin,*,end=13,err=11) energy(icon),rmstab(icon),
78 & nss_all(icon),(ihpb_all(ii,icon),jhpb_all(i,icon),
79 & i=1,nss_all(icon)),iscore(icon)
81 read (intin,'(8f10.5)',end=13,err=10)
82 & ((allcart(j,i,icon),j=1,3),i=1,nres),
83 & ((allcart(j,i+nres,icon),j=1,3),i=nnt,nct)
84 print *,icon,energy(icon),nss_all(icon),rmstab(icon)
86 read(intin,'(a80)',end=13,err=12) lineh
87 read(lineh(:5),*,err=8) ic
89 read(lineh(6:),*,err=8) energy(icon)
91 read(lineh(6:),*,err=8) energy(icon)
95 print *,'error, assuming e=1d10',lineh
99 cold read(lineh(18:),*,end=13,err=11) nss_all(icon)
100 ii = index(lineh(15:)," ")+15
101 read(lineh(ii:),*,end=13,err=11) nss_all(icon)
102 IF (NSS_all(icon).LT.9) THEN
103 read (lineh(20:),*,end=102)
104 & (IHPB_all(I,icon),JHPB_all(I,icon),I=1,NSS_all(icon)),
107 read (lineh(20:),*,end=102)
108 & (IHPB_all(I,icon),JHPB_all(I,icon),I=1,8)
109 read (intin,*) (IHPB_all(I,icon),JHPB_all(I,icon),
110 & I=9,NSS_all(icon)),iscore(icon)
115 PRINT *,'IC:',IC,' ENERGY:',ENERGY(ICON)
116 totfree(icon)=energy(icon)
117 call read_angles(intin,*13)
121 allcart(jj,ii,icon)=c(jj,ii)
125 phiall(i,icon)=phi(i)
126 thetall(i,icon)=theta(i)
127 alphall(i,icon)=alph(i)
128 omall(i,icon)=omeg(i)
134 C CALCULATE DISTANCES
136 10 print *,'something wrong with angles'
138 11 print *,'something wrong with NSS',nss
140 12 print *,'something wrong with header'
146 c read (jstatin,*,err=1111,end=1111) idum,(eee(j,i),j=1,n_ene)
147 read (jstatin,'(a)') lineh
148 if (index(lineh,'#').gt.0) goto 1123
150 read (lineh,*) idum,(eee(j,i),j=1,n_ene)
151 print *,i,idum,(eee(j,i),j=1,n_ene)
157 1111 print *,'Error in the statin file; statout will not be produced.'
159 & 'Error in the statin file; statout will not be produced.'
166 WRITE (iout,'(A80)') TITEL
169 if (mod(i,100).eq.0) print *,'Calculating RMS i=',i
173 c(jj,ii)=allcart(jj,ii,i)
176 call int_from_cart(.true.,.false.)
179 thetall(ii,i)=theta(ii)
180 alphall(ii,i)=alph(ii)
186 theta(ii)=thetall(ii,i)
187 alph(ii)=alphall(ii,i)
198 IND=IOFFSET(NCON,I,J)
199 ATTALUMS(IND)=DIFCONF(I,J)
200 c write (iout,'(2i4,f10.5)') i,j,ATTALUMS(IND)
201 DISS(IND)=ATTALUMS(IND)
205 WRITE (iout,'(/a,1pe14.5,a/)')
206 & 'Time for distance calculation:',T2-T1,' sec.'
208 PRINT '(a)','End of distance computation'
213 IND=IOFFSET(NCON,I,J)
214 write (jrms,'(2i5,2f10.5)') i,j,attalums(IND),
215 & energy(j)-energy(i)
220 C Print out the RMS deviation matrix.
222 if (print_dist) CALL DISTOUT(NCON)
224 C call hierarchical clustering HC from F. Murtagh
228 write(iout,*) "-------------------------------------------"
229 write(iout,*) "HIERARCHICAL CLUSTERING using"
231 write(iout,*) "WARD'S MINIMUM VARIANCE METHOD"
232 elseif (iopt.eq.2) then
233 write(iout,*) "SINGLE LINK METHOD"
234 elseif (iopt.eq.3) then
235 write(iout,*) "COMPLETE LINK METHOD"
236 elseif (iopt.eq.4) then
237 write(iout,*) "AVERAGE LINK (OR GROUP AVERAGE) METHOD"
238 elseif (iopt.eq.5) then
239 write(iout,*) "MCQUITTY'S METHOD"
240 elseif (iopt.eq.6) then
241 write(iout,*) "MEDIAN (GOWER'S) METHOD"
242 elseif (iopt.eq.7) then
243 write(iout,*) "CENTROID METHOD"
245 write(iout,*) "IOPT=",iopt," IS INVALID, use 1-7"
246 write(*,*) "IOPT=",iopt," IS INVALID, use 1-7"
250 write(iout,*) "hc.f by F. Murtagh, ESA/ESO/STECF, Garching"
251 write(iout,*) "February 1986"
252 write(iout,*) "References:"
253 write(iout,*) "1. Multidimensional clustering algorithms"
254 write(iout,*) " Fionn Murtagh"
255 write(iout,*) " Vienna : Physica-Verlag, 1985."
256 write(iout,*) "2. Multivariate data analysis"
257 write(iout,*) " Fionn Murtagh and Andre Heck"
258 write(iout,*) " Kluwer Academic Publishers, 1987"
259 write(iout,*) "-------------------------------------------"
262 CALL HC(N,M,LEN,IOPT,IA,IB,CRIT,MEMBR,NN,DISNN,FLAG,DISS)
264 CALL HCASS(N,IA,IB,CRIT,LEV,ICLASS,HVALS,IORDER,CRITVAL,HEIGHT)
265 CALL HCDEN(LEV,IORDER,HEIGHT,CRITVAL)
271 licz(iclass(j,i))=licz(iclass(j,i))+1
272 nconf(iclass(j,i),licz(iclass(j,i)))=j
278 IF (HEIGHT(L).EQ.IDUM) GOTO 190
281 cd print *,i+1,CRITVAL(IDUM)
282 IF (CRITVAL(IDUM).LT. RCUTOFF(ICUT)) THEN
283 WRITE (iout,'(/a,f10.5)') 'AT CUTOFF:',rcutoff(icut)
284 write (iout,'(a,f8.2)') 'Maximum distance found:',
286 CALL SRTCLUST(ICUT,ncon)
288 CALL WRTCLUST(ncon,ICUT,PRINTANG,PRINTPDB,PRINTMOL2)
290 if (icut.gt.ncut) goto 191
297 licz(iclass(j,i))=licz(iclass(j,i))+1
298 nconf(iclass(j,i),licz(iclass(j,i)))=j
299 cd print *,j,iclass(j,i),
300 cd & licz(iclass(j,i)),nconf(iclass(j,i),licz(iclass(j,i)))
311 WRITE (iout,'(/a,1pe14.5,a/)')
312 & 'Total time for clustering:',T2-T1,' sec.'
314 write (jstatout,'(a5,18a12,10f4.1)')"# ",
315 & "EVDW SC-SC","EVDW2 SC-p","EES p-p",
316 & "EBE bending","ESC SCloc","ETORS ",
317 & "ECORR4 ","ECORR5 ","ECORR6 ",
318 & "EELLO ","ETURN3 ","ETURN4 ","ETURN6 "
319 & ,"ETOT total","RMSD","nat.contact","nnt.contact",
320 & "cont.order",(rcutoff(i),i=1,ncut)
322 write(jstatout,'(i5,18f12.4,10i6)') i,(eee(j,i),j=1,n_ene),
323 & (iass_tot(i,icut),icut=1,ncut)
327 stop '********** Program terminated normally.'
329 c---------------------------------------------------------------------------
330 double precision function difconf(icon,jcon)
332 include 'sizesclu.dat'
333 include 'COMMON.CONTROL'
334 include 'COMMON.CLUSTER'
335 include 'COMMON.CHAIN'
336 include 'COMMON.INTERACT'
339 double precision przes(3),obrot(3,3)
340 double precision xx(3,maxres2),yy(3,maxres2)
342 phi(i)=phiall(i,jcon)
343 theta(i)=thetall(i,jcon)
344 alph(i)=alphall(i,jcon)
345 omeg(i)=omall(i,jcon)
349 c print '(i4,2(3f10.5,5x))',i,(cref(j,i),j=1,3),(c(j,i),j=1,3)
356 xx(j,ii)=allcart(j,i,jcon)
361 c if (itype(i).ne.10) then
364 xx(j,ii)=allcart(j,i+nres,jcon)
365 yy(j,ii)=cref(j,i+nres)
369 call fitsq(rms,xx(1,1),yy(1,1),ii,przes,obrot,non_conv)
373 c(j,i)=allcart(j,i,jcon)
375 c write (2,'(i5,3f10.5,5x,3f10.5)') i,
376 c & (c(j,i),j=1,3),(cref(j,i),j=1,3)
378 call fitsq(rms,c(1,nnt),cref(1,nnt),nct-nnt+1,przes,obrot
382 print *,error,'rms^2 = ',rms,icon,jcon
385 if (non_conv) print *,non_conv,icon,jcon
389 C------------------------------------------------------------------------------
390 double precision function rmsnat(jcon)
392 include 'sizesclu.dat'
393 include 'COMMON.CONTROL'
394 include 'COMMON.CLUSTER'
395 include 'COMMON.CHAIN'
396 include 'COMMON.INTERACT'
399 double precision przes(3),obrot(3,3)
400 double precision xx(3,maxres2),yy(3,maxres2)
406 xx(j,ii)=allcart(j,i,jcon)
407 yy(j,ii)=cref_pdb(j,i)
411 c if (itype(i).ne.10) then
414 xx(j,ii)=allcart(j,i+nres,jcon)
415 yy(j,ii)=cref_pdb(j,i+nres)
419 call fitsq(rms,xx(1,1),yy(1,1),ii,przes,obrot,non_conv)
423 c(j,i)=allcart(j,i,jcon)
426 call fitsq(rms,c(1,nnt),cref_pdb(1,nnt),nct-nnt+1,przes,obrot
430 print *,error,'rms^2 = ',rms,icon,jcon
433 if (non_conv) print *,non_conv,icon,jcon
437 C------------------------------------------------------------------------------
438 subroutine distout(ncon)
440 include 'sizesclu.dat'
442 include 'COMMON.IOUNITS'
443 include 'COMMON.CLUSTER'
445 write (iout,'(a)') 'The distance matrix'
447 nlim=min0(i+ncol-1,ncon)
448 write (iout,1000) (k,k=i,nlim)
449 write (iout,'(8h--------,10a)') ('-------',k=i,nlim)
450 1000 format (/8x,10(i4,3x))
451 1020 format (/1x,80(1h-)/)
462 IND=IOFFSET(NCON,j,k)
464 IND=IOFFSET(NCON,k,j)
466 3 b(k-i+1)=attalums(IND)
467 write (iout,1010) j,(b(k),k=1,jlim-i+1)
470 1010 format (i5,3x,10(f6.2,1x))
473 C-----------------------------------------------------------------------
476 include 'COMMON.LOCAL'
477 data dsc / 1.237, ! CYS (type 1)
478 & 2.142, ! MET (type 2)
479 & 2.299, ! PHE (type 3)
480 & 1.776, ! ILE (type 4)
481 & 1.939, ! LEU (type 5)
482 & 1.410, ! VAL (type 6)
483 & 2.605, ! TRP (type 7)
484 & 2.484, ! TYR (type 8)
485 & 0.743, ! ALA (type 9)
486 & 0.000, ! GLY (type 10)
487 & 1.393, ! THR (type 11)
488 & 1.150, ! SER (type 12)
489 & 2.240, ! GLN (type 13)
490 & 1.684, ! ASN (type 14)
491 & 2.254, ! GLU (type 15)
492 & 1.709, ! ASP (type 16)
493 & 2.113, ! HIS (type 17)
494 & 3.020, ! ARG (type 18)
495 & 2.541, ! LYS (type 19)
496 & 1.345, ! PRO (type 20)
497 & 0.000 /! D (type 21)