1 parameter (maxmodel=20)
2 parameter (maxres=1000)
3 parameter (maxclust=1000)
4 character*32 model(maxmodel)
5 integer imodel(maxmodel)
6 integer ifragpair(maxres,maxmodel,maxmodel),
7 & ifragpair_new(maxres,maxmodel,maxmodel),
8 & iflag(maxres),isumfmax(maxmodel),kmax(maxmodel),
9 & isumf(maxmodel),isumfmaxmin(maxmodel),kmaxmin(maxmodel),
10 & jmaxmin(maxmodel),isump(maxmodel),ifragpair_temp(maxres),
11 & ifragpair_temp1(maxres),ninclust(maxclust),nlenclust(maxclust),
12 & icluster(maxclust,maxclust),ifrag(maxres,maxclust),
13 & imodelclust(maxclust)
21 print '(2a)', "Usage: klapaucjusz nres nmodel",
22 & " [lencut] [minclust_size] [outfile] < infile > logfile"
37 read(ctemp,*) minclust_size
42 call getarg(5,outfile)
44 outfile = "klapaucjusz.out"
46 open(2,file=outfile,status="unknown")
47 print *,"nres",nres," nmodel",nmodel
48 print *,"lencut",lencut," minclust_size",minclust_size
49 print *," outfile ",outfile
56 read(*,'(a32,33x,1000i1)')model(i),(ifragpair(k,i,j),k=1,nres)
61 write(*,'(2a32,1000i1)')model(i),model(j),
62 & (ifragpair(k,i,j),k=1,nres)
67 DO WHILE (isumcut.ge.lencut)
68 c search the longest fragment (number 1)
74 c write(*,'(2a32,1000i1)')model(i),model(j),(ifragpair(k,i,j)
75 c & -ifragpair(k,j,i),k=1,nres)
79 if (kk.gt.0) isump(kk)=isump(kk)+1
80 if (kk.gt.nfrag) nfrag=kk
84 if (isump(k).gt.isum) then
89 c write(*,'(2a32,i10)')model(i),model(j),isum
90 if (isum.gt.isummax) then
98 write (*,*) "nfrag",nfrag," kfmax",kfmax
99 c icut = max0(isummax*2/3,lencut)
105 write(*,'(2a32,i10)')model(imodel(1)),model(imodel(2)),isummax
109 if (isummax.ge.lencut) then
115 if (ifragpair(k,i1,i2).eq.kfmax) then
116 ifragpair_temp(k)=ifragpair(k,i1,i2)
117 ifragpair_temp1(k)=ifragpair(k,i1,i2)
124 write (*,*) ">>>>>> dowhile"
127 if (iflag(i).gt.0) cycle
132 kk = ifragpair(k,i,jj)
133 if (ifragpair_temp1(k).ne.kfmax .or. kk.eq.0) cycle
134 isumf(kk)=isumf(kk)+1
138 if (isumf(k).gt.isumfmax(j)) then
148 if (isumfmax(j).lt.isumfmaxmin(i)) then
149 isumfmaxmin(i)=isumfmax(j)
160 if (iflag(i).gt.0) cycle
161 if (isumfmaxmin(i).gt.isumfmaxminmax) then
162 isumfmaxminmax=isumfmaxmin(i)
164 kmaxminmax=kmaxmin(i)
165 jmaxminmax=jmaxmin(i)
168 print *,"isumfmaxminmax",isumfmaxminmax," icut",icut
169 if (isumfmaxminmax.lt.icut) then
172 isumcut = isumfmaxminmax
177 iflag(imaxminmax)=imaxminmax
178 imodel(nflag)=imaxminmax
179 write(*,'(2a32,i10)')model(imodel(1)),model(imodel(2)),isummax
180 write(*,'(1000i1)')(ifragpair(k,imodel(1),imodel(2)),k=1,nres)
181 write(*,*) "isumfmaxminmax",isumfmaxminmax
182 print *,"kmaxminmax",kmaxminmax
183 write(*,'(a32)')(model(imodel(i)),i=1,nflag)
185 & (ifragpair(k,imaxminmax,jmaxminmax),k=1,nres)
188 if (ifragpair(k,imaxminmax,jmaxminmax).eq.kmaxminmax
189 & .and. ifragpair_temp1(k).gt.0)
190 & ifragpair_temp(k)=ifragpair(k,imaxminmax,jmaxminmax)
193 ifragpair_temp1(k)=ifragpair_temp(k)
195 print *,"ifragpair_temp,ifragpair_temp1"
196 print '(1000i1)',(ifragpair_temp(k),k=1,nres)
197 print '(1000i1)',(ifragpair_temp1(k),k=1,nres)
200 write(*,'(2a32,1000i1)')model(i),model(j),
201 & (ifragpair(k,i,j),k=1,nres)
206 print *,"iimod",iimod," jjmod",jjmod," kkmod",kkmod,
208 if (isumcut.ge.icut) then
209 print *,"ifragpair_temp1 before zeroing"
210 print '(64x,1000i1)',(ifragpair_temp1(k),k=1,nres)
216 c if (ifragpair_temp(k).eq.kmaxminmax .and.
217 c & ifragpair_temp1(k).eq.kfmax) then
218 if (ifragpair_temp1(k).gt.0) then
225 print *,">>>>>>>>>>>>>>> IFRAGPAIR AFTER ZEROING <<<<<<<<<<<"
228 write(*,'(2a32,1000i1)')model(i),model(j),
229 & (ifragpair(k,i,j),k=1,nres)
233 if (nflag.ge.minclust_size) then
236 print *,"cluster",nclust
237 ninclust(nclust)=nflag
238 nlenclust(nclust)=isumcut
240 icluster(i,nclust)=imodel(i)
244 c if (ifragpair_temp(k).eq.kkmod .and.
245 c & ifragpair_temp1(k).eq.kfmax) then
246 if (ifragpair_temp1(k).gt.0) then
252 if (ii.ne.nlenclust(nclust)) write(*,*) "CHUJ NASTAPIL!!!",
253 & ii,nlenclust(nclust)
257 if (ifragpair_temp1(k).gt.0) then
258 ifragpair_new(k,imodel(i),imodel(j))=nclust
259 ifragpair_new(k,imodel(j),imodel(i))=nclust
271 write(*,'(2a32,1000a1)')model(i),model(j),
272 & (charm(ifragpair_new(k,i,j)),k=1,nres)
275 write (*,*) "nclust",nclust
277 write(*,*) "Cluster",i," ninclust",ninclust(i),
278 & " length",nlenclust(i)
279 write(*,'(a32)') (model(icluster(j,i)),j=1,ninclust(i))
280 write(*,'(i5)') (ifrag(j,i),j=1,nlenclust(i))
285 imodelclust(icluster(j,i))=1
288 print *,"Models in clusters"
291 if (imodelclust(i).eq.1) then
292 print '(a32)',model(i)
293 nmodel_out = nmodel_out + 1
296 print *,"Models excluded"
298 if (imodelclust(i).eq.0) print '(a32)',model(i)
300 c Write model information
301 write(2,'(i5)') nmodel_out,nclust
303 if (imodelclust(i).eq.1) write(2,'(a32)') model(i)
305 c Write cluster information
307 write(2,'(2i5)') ninclust(i),nlenclust(i)
308 write(2,'(16i5)') (icluster(k,i),k=1,ninclust(i))
309 write(2,'(16i5)') (ifrag(k,i),k=1,nlenclust(i))
312 c---------------------------------------------------------------------------------
313 character function charm(i)
318 charm = char(ichar("A")+i-1)