1 SUBROUTINE WRTCLUST(NCON,ICUT,PRINTANG,PRINTPDB,printmol2,ib)
2 implicit real*8 (a-h,o-z)
5 parameter (num_in_line=5)
6 LOGICAL PRINTANG(max_cut)
7 integer PRINTPDB(max_cut),printmol2(max_cut)
8 include 'COMMON.CONTROL'
9 include 'COMMON.HEADER'
10 include 'COMMON.CHAIN'
12 include 'COMMON.CLUSTER'
13 include 'COMMON.IOUNITS'
16 include 'COMMON.TEMPFAC'
17 double precision rmsave(maxgr)
18 CHARACTER*64 prefixp,NUMM,MUMM,EXTEN,extmol
21 DATA EXTEN /'.pdb'/,extmol /'.mol2'/,NUMM /'000'/,MUMM /'000'/
28 c print *,"calling WRTCLUST",ncon
29 c write (iout,*) "ICUT",icut," PRINTPDB ",PRINTPDB(icut)
32 temper=1.0d0/(beta_h(ib)*1.987d-3)
33 if (temper.lt.100.0d0) then
34 write(ctemper,'(f3.0)') temper
36 else if (temper.lt.1000.0) then
37 write (ctemper,'(f4.0)') temper
40 write (ctemper,'(f5.0)') temper
44 do i=1,ncon*(ncon-1)/2
47 close(80,status='delete')
49 C PRINT OUT THE RESULTS OF CLUSTER ANALYSIS
51 ii1= index(intinname,'/')
56 ii2=index(intinname(ii1:),'/')
58 ii = ii1+index(intinname(ii1:),'.')-1
64 prefixp=intinname(ii1:ii)
65 cd print *,icut,printang(icut),printpdb(icut),printmol2(icut)
66 cd print *,'ecut=',ecut
69 WRITE (iout,200) IGR,totfree_gr(igr)/beta_h(ib),LICZ(IGR)
70 NRECORD=LICZ(IGR)/num_in_line
72 DO 63 IRECORD=1,NRECORD
73 IND2=IND1+num_in_line-1
74 WRITE (iout,300) (list_conf(NCONF(IGR,ICO)),
75 & totfree(NCONF(IGR,ICO))/beta_h(ib),ICO=IND1,IND2)
78 WRITE (iout,300) (list_conf(NCONF(IGR,ICO)),
79 & totfree(NCONF(IGR,ICO))/beta_h(ib),ICO=IND1,LICZ(IGR))
81 ICON=list_conf(NCONF(IGR,1))
82 c WRITE (iout,'(16F5.0)') (rad2deg*phiall(IND,icon),IND=4,nphi+3)
83 C 12/8/93 Estimation of "diameters" of the subsequent families.
86 c write (iout,*) "ecut",ecut
89 if (totfree(ii)-emin .gt. ecut) goto 10
94 ind=ioffset(ncon,ii,jj)
96 ind=ioffset(ncon,jj,ii)
98 c write (iout,*) " ncon",ncon,"i",i," j",j," ii",ii," jj",jj,
101 curr_dist=dabs(diss(ind)+0.0d0)
102 c write(iout,'(i10,4i4,f12.4)') ind,ii,jj,list_conf(ii),
103 c & list_conf(jj),curr_dist
104 if (curr_dist .gt. amax_dim) amax_dim=curr_dist
105 ave_dim=ave_dim+curr_dist**2
108 10 if (licz(igr) .gt. 1)
109 & ave_dim=sqrt(ave_dim/(licz(igr)*(licz(igr)-1)/2))
110 write (iout,'(/A,F8.1,A,F8.1)')
111 & 'Max. distance in the family:',amax_dim,
112 & '; average distance in the family:',ave_dim
117 boltz=dexp(-totfree(icon))
118 rmsave(igr)=rmsave(igr)+boltz*rmstb(icon)
121 rmsave(igr)=rmsave(igr)/qpart
122 write (iout,'(a,f5.2,a)') "Average RMSD",rmsave(igr)," A"
125 WRITE (iout,500) (list_conf(I),IASS(I),I=1,NCON)
126 c print *,icut,printang(icut)
127 IF (PRINTANG(ICUT) .and. (lprint_cart .or. lprint_int)) then
129 c print *,'emin',emin,' ngr',ngr
130 if (lprint_cart) then
131 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
134 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
139 if (totfree_gr(igr)-emin.le.ecut) then
140 if (lprint_cart) then
141 call cartout(igr,icon,totfree(icon)/beta_h(ib),
142 & totfree_gr(igr)/beta_h(ib),
143 & rmstb(icon),cfname)
145 c print '(a)','calling briefout'
148 c(j,i)=allcart(j,i,icon)
151 call int_from_cart1(.false.)
152 call briefout(igr,iscore(icon),totfree(icon)/beta_h(ib),
153 & totfree_gr(igr),nss_all(icon),ihpb_all(1,icon),
154 & jhpb_all(1,icon),cfname)
155 c print '(a)','exit briefout'
161 IF (PRINTPDB(ICUT).gt.0) THEN
162 c Write out a number of conformations from each family in PDB format and
163 c create InsightII command file for their displaying in different colors
164 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
165 & //"K_"//'ave'//exten
166 write (iout,*) "cfname",cfname
167 OPEN(ipdb,FILE=CFNAME,STATUS='UNKNOWN',FORM='FORMATTED')
168 write (ipdb,'(a,f8.2)')
169 & "REMAR AVERAGE CONFORMATIONS AT TEMPERATURE",temper
175 DO WHILE(I.LE.NGR .AND. totfree_gr(i)-EMIN.LE.ECUT)
176 c write (iout,*) "i",i," ngr",ngr,totfree_gr(I),EMIN,ecut
177 write (NUMM,'(bz,i4.4)') i
178 ncon_lim=min0(licz(i),printpdb(icut))
179 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
180 & //"K_"//numm(:ilen(numm))//exten
181 OPEN(ipdb,FILE=CFNAME,STATUS='UNKNOWN',FORM='FORMATTED')
182 write (ipdb,'("REMARK CLUSTER",i5," FREE ENERGY",1pe14.5,
183 & " AVE RMSD",0pf5.2)')
184 & i,totfree_gr(i)/beta_h(ib),rmsave(i)
185 c Write conformations of the family i to PDB files
187 do while (ncon_out.lt.printpdb(icut) .and.
188 & ncon_out.lt.licz(i).and.
189 & totfree(nconf(i,ncon_out+1))-EMIN1.LE.ECUT)
191 c write (iout,*) i,ncon_out,nconf(i,ncon_out),
192 c & totfree(nconf(i,ncon_out)),emin1,ecut
194 write (iout,*) "ncon_out",ncon_out
204 c(k,ii)=allcart(k,ii,icon)
207 call pdbout(totfree(icon)/beta_h(ib),rmstb(icon),titel)
208 write (ipdb,'("TER")')
211 c Average structures and structures closest to average
212 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
213 & //"K_"//'ave'//exten
214 OPEN(ipdb,FILE=CFNAME,STATUS='UNKNOWN',FORM='FORMATTED',
217 write (ipdb,'(a,i5)') "REMARK CLUSTER",i
218 call pdbout(totfree_gr(i)/beta_h(ib),rmsave(i),titel)
219 write (ipdb,'("TER")')
220 call closest_coord(i)
221 call pdbout(totfree_gr(i)/beta_h(ib),rmsave(i),titel)
222 write (ipdb,'("TER")')
229 IF (printmol2(icut).gt.0) THEN
230 c Write out a number of conformations from each family in PDB format and
231 c create InsightII command file for their displaying in different colors
236 DO WHILE(I.LE.NGR .AND. totfree_gr(i)-EMIN.LE.ECUT)
237 write (NUMM,'(bz,i4.4)') i
238 cfname=prefixp(:ilen(prefixp))//"_T"//ctemper(:ilen(ctemper))
239 & //"K_"//numm(:ilen(numm))//extmol
240 OPEN(imol2,FILE=CFNAME,STATUS='UNKNOWN',FORM='FORMATTED')
242 do while (ncon_out.lt.printmol2(icut) .and.
243 & ncon_out.lt.licz(i).and.
244 & totfree(nconf(i,ncon_out+1))-EMIN1.LE.ECUT)
251 c(k,ii)=allcart(k,ii,icon)
254 CALL MOL2OUT(totfree(icon)/beta_h(ib),'STRUCTURE'//numm)
262 100 FORMAT (//'THERE ARE ',I4,' FAMILIES OF CONFORMATIONS')
263 200 FORMAT (/'FAMILY ',I4,' WITH TOTAL FREE ENERGY',1pE15.5,
264 & ' CONTAINS ',I4,' CONFORMATION(S): ')
265 c 300 FORMAT ( 8(I4,F6.1))
266 300 FORMAT (5(I4,1pe12.3))
267 400 FORMAT (//'ASSIGNMENT OF CONSECUTIVE CONFORMATIONS TO FAMILIES:')
268 500 FORMAT (8(2I4,2X))
269 600 FORMAT ('REMARK FAMILY',I4,' CONFORMATION',I4,' ENERGY ',E15.6)
272 c------------------------------------------------------------------------------
273 subroutine ave_coord(igr)
276 include 'sizesclu.dat'
277 include 'COMMON.CONTROL'
278 include 'COMMON.CLUSTER'
279 include 'COMMON.CHAIN'
280 include 'COMMON.INTERACT'
282 include 'COMMON.TEMPFAC'
283 include 'COMMON.IOUNITS'
285 double precision przes(3),obrot(3,3)
286 double precision xx(3,maxres2),yy(3,maxres2),csq(3,maxres2)
287 double precision eref
288 integer i,ii,j,k,icon,jcon,igr
289 double precision rms,boltz,qpart,cwork(3,maxres2),cref1(3,maxres2)
290 c write (iout,*) "AVE_COORD: igr",igr
293 boltz = dexp(-totfree(jcon)+eref)
297 c(j,i)=allcart(j,i,jcon)*boltz
298 cref1(j,i)=allcart(j,i,jcon)
299 csq(j,i)=allcart(j,i,jcon)**2*boltz
309 xx(j,ii)=allcart(j,i,jcon)
314 c if (itype(i).ne.10) then
317 xx(j,ii)=allcart(j,i+nres,jcon)
318 yy(j,ii)=cref1(j,i+nres)
322 call fitsq(rms,xx(1,1),yy(1,1),ii,przes,obrot,non_conv)
326 cwork(j,i)=allcart(j,i,jcon)
329 call fitsq(rms,cwork(1,nnt),cref1(1,nnt),nct-nnt+1,przes,obrot
332 c write (iout,*) "rms",rms
334 c write (iout,'(i3,f10.5,5x,3f10.5)')i,przes(i),(obrot(i,j),j=1,3)
337 print *,'error, rms^2 = ',rms,icon,jcon
340 if (non_conv) print *,non_conv,icon,jcon
341 boltz=dexp(-totfree(jcon)+eref)
342 qpart = qpart + boltz
345 xx(j,i)=allcart(j,i,jcon)
348 call matvec(cwork,obrot,xx,2*nres)
350 c write (iout,'(i5,2(3f10.5,5x))') i,(cwork(j,i),j=1,3),
351 c & (allcart(j,i,jcon),j=1,3)
353 cwork(j,i)=cwork(j,i)+przes(j)
354 c(j,i)=c(j,i)+cwork(j,i)*boltz
355 csq(j,i)=csq(j,i)+cwork(j,i)**2*boltz
362 csq(j,i)=csq(j,i)/qpart-c(j,i)**2
364 c write (iout,'(i5,3f10.5)') i,(csq(j,i),j=1,3)
370 tempfac(1,i)=tempfac(1,i)+csq(j,i)
371 tempfac(2,i)=tempfac(2,i)+csq(j,i+nres)
373 tempfac(1,i)=dsqrt(tempfac(1,i))
374 tempfac(2,i)=dsqrt(tempfac(2,i))
378 c------------------------------------------------------------------------------
379 subroutine closest_coord(igr)
382 include 'sizesclu.dat'
383 include 'COMMON.IOUNITS'
384 include 'COMMON.CONTROL'
385 include 'COMMON.CLUSTER'
386 include 'COMMON.CHAIN'
387 include 'COMMON.INTERACT'
390 double precision przes(3),obrot(3,3)
391 double precision xx(3,maxres2),yy(3,maxres2)
392 integer i,ii,j,k,icon,jcon,jconmin,igr
393 double precision rms,rmsmin,cwork(3,maxres2)
403 xx(j,ii)=allcart(j,i,jcon)
408 c if (itype(i).ne.10) then
411 xx(j,ii)=allcart(j,i+nres,jcon)
416 call fitsq(rms,xx(1,1),yy(1,1),ii,przes,obrot,non_conv)
420 cwork(j,i)=allcart(j,i,jcon)
423 call fitsq(rms,cwork(1,nnt),c(1,nnt),nct-nnt+1,przes,obrot
427 print *,'error, rms^2 = ',rms,icon,jcon
430 c write (iout,*) "jcon",jcon," rms",rms," rmsmin",rmsmin
431 if (non_conv) print *,non_conv,icon,jcon
432 if (rms.lt.rmsmin) then
437 c write (iout,*) "rmsmin",rmsmin," rms",rms
441 c(j,i)=allcart(j,i,jconmin)