1 parameter (maxmodel=50)
2 parameter (maxres=1000)
3 parameter (maxclust=1000)
4 character*32 model(maxmodel)
5 integer imodel(maxmodel),iindex(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
57 read(*,'(a32,32x,1000i2)')model(i),(ifragpair(k,i,j),k=1,nres)
62 write(*,'(2a32,1000i2)')model(i),model(j),
63 & (ifragpair(k,i,j),k=1,nres)
68 DO WHILE (isumcut.ge.lencut)
69 c search the longest fragment (number 1)
75 c write(*,'(2a32,1000i1)')model(i),model(j),(ifragpair(k,i,j)
76 c & -ifragpair(k,j,i),k=1,nres)
80 if (kk.gt.0) isump(kk)=isump(kk)+1
81 if (kk.gt.nfrag) nfrag=kk
85 if (isump(k).gt.isum) then
90 c write(*,'(2a32,i10)')model(i),model(j),isum
91 if (isum.gt.isummax) then
99 write (*,*) "nfrag",nfrag," kfmax",kfmax
100 c icut = max0(isummax*2/3,lencut)
106 write(*,'(2a32,i10)')model(imodel(1)),model(imodel(2)),isummax
110 if (isummax.ge.lencut) then
116 if (ifragpair(k,i1,i2).eq.kfmax) then
117 ifragpair_temp(k)=ifragpair(k,i1,i2)
118 ifragpair_temp1(k)=ifragpair(k,i1,i2)
125 write (*,*) ">>>>>> dowhile"
128 if (iflag(i).gt.0) cycle
133 kk = ifragpair(k,i,jj)
134 if (ifragpair_temp1(k).ne.kfmax .or. kk.eq.0) cycle
135 isumf(kk)=isumf(kk)+1
139 if (isumf(k).gt.isumfmax(j)) then
149 if (isumfmax(j).lt.isumfmaxmin(i)) then
150 isumfmaxmin(i)=isumfmax(j)
161 if (iflag(i).gt.0) cycle
162 if (isumfmaxmin(i).gt.isumfmaxminmax) then
163 isumfmaxminmax=isumfmaxmin(i)
165 kmaxminmax=kmaxmin(i)
166 jmaxminmax=jmaxmin(i)
169 print *,"isumfmaxminmax",isumfmaxminmax," icut",icut
170 if (isumfmaxminmax.lt.icut) then
173 isumcut = isumfmaxminmax
178 iflag(imaxminmax)=imaxminmax
179 imodel(nflag)=imaxminmax
180 write(*,'(2a32,i10)')model(imodel(1)),model(imodel(2)),isummax
181 write(*,'(1000i1)')(ifragpair(k,imodel(1),imodel(2)),k=1,nres)
182 write(*,*) "isumfmaxminmax",isumfmaxminmax
183 print *,"kmaxminmax",kmaxminmax
184 write(*,'(a32)')(model(imodel(i)),i=1,nflag)
186 & (ifragpair(k,imaxminmax,jmaxminmax),k=1,nres)
189 if (ifragpair(k,imaxminmax,jmaxminmax).eq.kmaxminmax
190 & .and. ifragpair_temp1(k).gt.0)
191 & ifragpair_temp(k)=ifragpair(k,imaxminmax,jmaxminmax)
194 ifragpair_temp1(k)=ifragpair_temp(k)
196 print *,"ifragpair_temp,ifragpair_temp1"
197 print '(1000i1)',(ifragpair_temp(k),k=1,nres)
198 print '(1000i1)',(ifragpair_temp1(k),k=1,nres)
201 write(*,'(2a32,1000i1)')model(i),model(j),
202 & (ifragpair(k,i,j),k=1,nres)
207 print *,"iimod",iimod," jjmod",jjmod," kkmod",kkmod,
209 if (isumcut.ge.icut) then
210 print *,"ifragpair_temp1 before zeroing"
211 print '(64x,1000i1)',(ifragpair_temp1(k),k=1,nres)
217 c if (ifragpair_temp(k).eq.kmaxminmax .and.
218 c & ifragpair_temp1(k).eq.kfmax) then
219 if (ifragpair_temp1(k).gt.0) then
226 print *,">>>>>>>>>>>>>>> IFRAGPAIR AFTER ZEROING <<<<<<<<<<<"
229 write(*,'(2a32,1000i1)')model(i),model(j),
230 & (ifragpair(k,i,j),k=1,nres)
234 if (nflag.ge.minclust_size) then
237 print *,"cluster",nclust
238 ninclust(nclust)=nflag
239 nlenclust(nclust)=isumcut
241 icluster(i,nclust)=imodel(i)
245 c if (ifragpair_temp(k).eq.kkmod .and.
246 c & ifragpair_temp1(k).eq.kfmax) then
247 if (ifragpair_temp1(k).gt.0) then
253 if (ii.ne.nlenclust(nclust)) write(*,*) "CHUJ NASTAPIL!!!",
254 & ii,nlenclust(nclust)
258 if (ifragpair_temp1(k).gt.0) then
259 ifragpair_new(k,imodel(i),imodel(j))=nclust
260 ifragpair_new(k,imodel(j),imodel(i))=nclust
272 write(*,'(2a32,1000a1)')model(i),model(j),
273 & (charm(ifragpair_new(k,i,j)),k=1,nres)
276 write (*,*) "nclust",nclust
278 write(*,*) "Cluster",i," ninclust",ninclust(i),
279 & " length",nlenclust(i)
280 write(*,'(a32)') (model(icluster(j,i)),j=1,ninclust(i))
281 write(*,'(i5)') (ifrag(j,i),j=1,nlenclust(i))
286 imodelclust(icluster(j,i))=1
289 print *,"Models in clusters"
292 if (imodelclust(i).eq.1) then
293 print '(a32)',model(i)
294 nmodel_out = nmodel_out + 1
297 print *,"Models excluded"
299 if (imodelclust(i).eq.0) print '(a32)',model(i)
301 c Write model information
302 write(2,'(i5)') nmodel_out,nclust
306 if (imodelclust(i).eq.1) then
308 write(2,'(a32)') model(i)
312 c Write cluster information
314 write(2,'(2i5)') ninclust(i),nlenclust(i)
315 write(2,'(16i5)') (iindex(icluster(k,i)),k=1,ninclust(i))
316 write(2,'(16i5)') (ifrag(k,i),k=1,nlenclust(i))
319 c---------------------------------------------------------------------------------
320 character function charm(i)
325 charm = char(ichar("A")+i-1)