2 cc---------------------------------
3 subroutine refresh_bank(ntrial)
4 implicit real*8 (a-h,o-z)
9 include 'COMMON.IOUNITS'
10 include 'COMMON.CHAIN'
12 include 'COMMON.CONTROL'
15 double precision l_diff(mxio),denep
19 nstatnx_tot(i,j)=nstatnx_tot(i,j)+nstatnx(i,j)
24 c loop over all newly obtained conformations
28 nstatnx(movernx(n),1)=nstatnx(movernx(n),1)+1
29 cccccccccccccccccccccccccccccccccccccccccccc
32 if(rmsn(n).gt.rmscut.or.pncn(n).lt.pnccut) goto 100
35 if(etot(n).gt.ebmax) goto 100
36 c Find the conformation closest to the conformation n in the bank
39 call get_diff12(dihang(1,1,1,n),bvar(1,1,1,m),l_diff(m))
40 if(l_diff(m).lt.difmin) then
46 if(difmin.lt.cutdif) then
47 c n is redundant to idmin
48 if(etot(n).lt.bene(idmin)) then
49 if(etot(n).lt.bene(idmin)-0.01d0) then
53 denep=bene(idmin)-etot(n)
54 call replace_bvar(idmin,n)
58 dij(i1,idmin)=l_diff(i1)
59 dij(idmin,i1)=l_diff(i1)
64 nstatnx(movernx(n),2)=nstatnx(movernx(n),2)+1
65 if(idmin.eq.ibmax) call find_max
68 c got new conformation
70 if(ebmax-ebmin.gt.del_ene) then
72 call replace_bvar(ibmax,n)
76 dij(i1,ibmax)=l_diff(i1)
77 dij(ibmax,i1)=l_diff(i1)
82 nstatnx(movernx(n),3)=nstatnx(movernx(n),3)+1
87 if(del_ene.lt.0.0001) then
88 write (iout,*) 'ERROR in refresh_bank: '
89 write (iout,*) 'ebmax: ',ebmax
90 write (iout,*) 'ebmin: ',ebmin
91 write (iout,*) 'del_ene: ',del_ene
92 crc call mpi_abort(mpi_comm_world,ierror,ierrcode)
94 cjp nbmax is never defined so condition below is always false
95 c if(nbank.lt.nbmax) then
97 c call replace_bvar(nbank,n)
101 call replace_bvar(ibmax,n)
108 cccccccccccccccccccccccccccccccccccccccccccc
112 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5)')
113 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
114 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9)
116 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5
117 & ,a5,0pf4.1,a5,f3.0)')
118 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
119 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
120 & ' rms ',rmsn(n),' %NC ',pncn(n)*100
124 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,
125 & 1x,a1,i4,0pf8.1,0pf8.1)')
126 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
127 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
128 & chacc,iaccn,difmin,denep
130 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,a5,
131 & 0pf4.1,a5,f3.0,1x,a1,i4,0pf8.1,0pf8.1)')
132 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
133 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
134 & ' rms ',rmsn(n),' %NC ',pncn(n)*100,
135 & chacc,iaccn,difmin,denep
139 c end of loop over all newly obtained conformations
142 crc moved up, saves some get_diff12 calls
146 crc if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
147 crc call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
160 c---------------------------------
161 subroutine replace_bvar(iold,inew)
162 implicit real*8 (a-h,o-z)
165 include 'COMMON.IOUNITS'
167 include 'COMMON.BANK'
168 include 'COMMON.CHAIN'
169 include 'COMMON.CONTROL'
170 include 'COMMON.SBRIDGE'
172 if (iold.gt.mxio .or. iold.lt.1 .or. inew.gt.mxio .or. inew.lt.1)
174 write (iout,*) 'Dimension ERROR in REPLACE_BVAR: IOLD',iold,
176 call mpi_abort(mpi_comm_world,ierror,ierrcode)
181 bvar(i,j,k,iold)=dihang(i,j,k,inew)
185 bene(iold)=etot(inew)
186 brmsn(iold)=rmsn(inew)
187 bpncn(iold)=pncn(inew)
189 if(bene(iold).lt.ebmin) then
195 bvar_nss(iold)=nss_out(inew)
196 cd write(iout,*) 'SS BANK',iold,bvar_nss(iold)
197 do i=1,bvar_nss(iold)
198 bvar_ss(1,i,iold)=iss_out(i,inew)
199 bvar_ss(2,i,iold)=jss_out(i,inew)
200 cd write(iout,*) 'SS',bvar_ss(1,i,iold)-nres,
201 cd & bvar_ss(2,i,iold)-nres
204 bvar_ns(iold)=ns-2*bvar_nss(iold)
205 cd write(iout,*) 'CYS #free ', bvar_ns(iold)
209 do while( iss(i).ne.iss_out(j,inew)-nres .and.
210 & iss(i).ne.jss_out(j,inew)-nres .and.
211 & j.le.nss_out(inew))
214 if (j.gt.nss_out(inew)) then
216 bvar_s(k,iold)=iss(i)
219 cd write(iout,*) 'CYS free',(bvar_s(k,iold),k=1,bvar_ns(iold))
224 c---------------------------------------
225 subroutine write_rbank(jlee,adif,nft)
226 implicit real*8 (a-h,o-z)
228 include 'COMMON.IOUNITS'
230 include 'COMMON.BANK'
231 include 'COMMON.CHAIN'
234 open(icsa_rbank,file=csa_rbank,status="unknown")
235 write (icsa_rbank,900) jlee,nbank,nstep,nft,icycle,adif
237 write (icsa_rbank,952) k,rene(k),rrmsn(k),rpncn(k)
240 write (icsa_rbank,850) (rad2deg*rvar(i,l,j,k),i=1,4)
247 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
249 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
254 c---------------------------------------
255 subroutine read_rbank(jlee,adif)
256 implicit real*8 (a-h,o-z)
259 include 'COMMON.IOUNITS'
261 include 'COMMON.BANK'
262 include 'COMMON.CHAIN'
264 include 'COMMON.SETUP'
267 open(icsa_rbank,file=csa_rbank,status="old")
268 read (icsa_rbank,901) jleer,nbankr,nstepr,nftr,icycler,adif
269 print *,jleer,nbankr,nstepr,nftr,icycler,adif
270 c print *, 'adif from read_rbank ',adif
271 if(nbankr.ne.nbank) then
272 write (iout,*) 'ERROR in READ_BANK: NBANKR',nbankr,
274 call mpi_abort(mpi_comm_world,ierror,ierrcode)
276 if(jleer.ne.jlee) then
277 write (iout,*) 'ERROR in READ_BANK: JLEER',jleer,
279 call mpi_abort(mpi_comm_world,ierror,ierrcode)
284 read (icsa_rbank,'(a80)') karta
285 write(iout,*) "READ_RBANK: kk=",kk
287 c if (index(karta,"*").gt.0) then
288 c write (iout,*) "***** Stars in bankr ***** k=",k,
292 c read (30,850) (rdummy,i=1,4)
297 call reada(karta,"total E",rene(kk),1.0d20)
298 call reada(karta,"rmsd from N",rrmsn(kk),0.0d0)
299 call reada(karta,"%NC",rpncn(kk),0.0d0)
300 write(iout,*)"total E",bene(kk),"rmsd from N",brmsn(kk),
301 & "%NC",bpncn(kk),ibank(kk)
302 c read (icsa_rbank,953) kdummy,rene(kk),rrmsn(kk),rpncn(kk)
305 read (icsa_rbank,850) (rvar(i,l,j,kk),i=1,4)
306 c write (iout,850) (rvar(i,l,j,kk),i=1,4)
308 rvar(i,l,j,kk)=deg2rad*rvar(i,l,j,kk)
314 cd write (*,*) "read_rbank ******************* kk",kk,
316 if (kk.lt.nbankr) nbankr=kk
321 cd write (*,850) (rvar(i,l,j,kk),i=1,4)
328 901 format (1x,6x,i3,3x,7x,i4,3x,7x,i8,i10,i2,f15.5)
329 953 format (1x,1x,i4,9x,f12.3,13x,f8.3,5x,f5.2)
333 c---------------------------------------
334 subroutine write_bank(jlee,nft)
335 implicit real*8 (a-h,o-z)
337 include 'COMMON.IOUNITS'
339 include 'COMMON.BANK'
340 include 'COMMON.CHAIN'
342 include 'COMMON.SBRIDGE'
343 include 'COMMON.CONTROL'
348 open(icsa_bank,file=csa_bank,status="unknown")
349 write (icsa_bank,900) jlee,nbank,nstep,nft,icycle,cutdif
350 write (icsa_bank,902) nglob_csa, eglob_csa
351 open (igeom,file=intname,status='UNKNOWN')
353 write (icsa_bank,952) k,bene(k),brmsn(k),bpncn(k),ibank(k)
354 if (vdisulf) write (icsa_bank,'(101i4)')
355 & bvar_nss(k),((bvar_ss(j,i,k),j=1,2),i=1,bvar_nss(k))
358 write (icsa_bank,850) (rad2deg*bvar(i,l,j,k),i=1,4)
361 if (bvar_nss(k).le.9) then
362 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
363 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,bvar_nss(k))
365 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
366 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,9)
367 write (igeom,'(3X,11(1X,2I3))') (bvar_ss(1,i,k),
368 & bvar_ss(2,i,k),i=10,bvar_nss(k))
370 write (igeom,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
371 write (igeom,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
372 write (igeom,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
373 write (igeom,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
378 if (nstep/200.gt.ilastnstep) then
380 ilastnstep=(ilastnstep+1)*1.5
381 write(chfrm,'(a2,i1,a1)') '(i',int(dlog10(dble(nstep))+1),')'
382 write(chtmp,chfrm) nstep
383 open(icsa_int,file=prefix(:ilen(prefix))
384 & //'_'//chtmp(:ilen(chtmp))//'.int',status='UNKNOWN')
386 if (bvar_nss(k).le.9) then
387 write (icsa_int,'(I5,F10.3,I2,9(1X,2I3))') k,bene(k),
388 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,bvar_nss(k))
390 write (icsa_int,'(I5,F10.3,I2,9(1X,2I3))') k,bene(k),
391 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,9)
392 write (icsa_int,'(3X,11(1X,2I3))') (bvar_ss(1,i,k),
393 & bvar_ss(2,i,k),i=10,bvar_nss(k))
395 write (icsa_int,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
396 write (icsa_int,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
397 write (icsa_int,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
398 write (icsa_int,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
406 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
408 902 format (1x,'nglob_csa =',i4,' eglob_csa =',1pe14.5)
409 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3,
414 c---------------------------------------
415 subroutine write_bank_reminimized(jlee,nft)
416 implicit real*8 (a-h,o-z)
418 include 'COMMON.IOUNITS'
420 include 'COMMON.BANK'
421 include 'COMMON.CHAIN'
423 include 'COMMON.SBRIDGE'
425 open(icsa_bank_reminimized,file=csa_bank_reminimized,
427 write (icsa_bank_reminimized,900)
428 & jlee,nbank,nstep,nft,icycle,cutdif
429 open (igeom,file=intname,status='UNKNOWN')
431 write (icsa_bank_reminimized,952) k,bene(k),brmsn(k),
435 write (icsa_bank_reminimized,850) (rad2deg*bvar(i,l,j,k),i=1,4)
439 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
440 & nss,(ihpb(i),jhpb(i),i=1,nss)
442 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
443 & nss,(ihpb(i),jhpb(i),i=1,9)
444 write (igeom,'(3X,11(1X,2I3))') (ihpb(i),jhpb(i),i=10,nss)
446 write (igeom,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
447 write (igeom,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
448 write (igeom,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
449 write (igeom,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
451 close(icsa_bank_reminimized)
456 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
458 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
459 & ,' %NC ',0pf5.2,i5)
463 c---------------------------------
464 subroutine read_bank(jlee,nft,cutdifr)
465 implicit real*8 (a-h,o-z)
467 include 'COMMON.IOUNITS'
469 include 'COMMON.BANK'
470 include 'COMMON.CHAIN'
472 include 'COMMON.CONTROL'
473 include 'COMMON.SBRIDGE'
478 open(icsa_bank,file=csa_bank,status="old")
479 read (icsa_bank,901) jlee,nbank,nstep,nft,icycle,cutdifr
480 read (icsa_bank,902) nglob_csa, eglob_csa
481 c if(jleer.ne.jlee) then
482 c write (iout,*) 'ERROR in READ_BANK: JLEER',jleer,
484 c call mpi_abort(mpi_comm_world,ierror,ierrcode)
489 read (icsa_bank,'(a80)') karta
490 write(iout,*) "READ_BANK: kk=",kk
492 c if (index(karta,"*").gt.0) then
493 c write (iout,*) "***** Stars in bank ***** k=",k,
497 c read (33,850) (rdummy,i=1,4)
502 call reada(karta,"total E",bene(kk),1.0d20)
503 call reada(karta,"rmsd from N",brmsn(kk),0.0d0)
504 call reada(karta,"%NC",bpncn(kk),0.0d0)
505 read (karta(ilen(karta)-1:),*,end=111,err=111) ibank(kk)
509 write(iout,*)"total E",bene(kk),"rmsd from N",brmsn(kk),
510 & "%NC",bpncn(kk),ibank(kk)
511 c read (icsa_bank,953) kdummy,bene(k),brmsn(k),bpncn(k),ibank(k)
513 read (icsa_bank,'(101i4)')
514 & bvar_nss(kk),((bvar_ss(j,i,kk),j=1,2),i=1,bvar_nss(kk))
515 bvar_ns(kk)=ns-2*bvar_nss(kk)
516 write(iout,*) 'read SSBOND',bvar_nss(kk),
517 & ((bvar_ss(j,i,kk),j=1,2),i=1,bvar_nss(kk))
518 cd write(iout,*) 'read CYS #free ', bvar_ns(kk)
522 do while( iss(i).ne.bvar_ss(1,j,kk)-nres .and.
523 & iss(i).ne.bvar_ss(2,j,kk)-nres .and.
527 if (j.gt.bvar_nss(kk)) then
532 cd write(iout,*)'read CYS free',(bvar_s(l,kk),l=1,bvar_ns(kk))
536 read (icsa_bank,850) (bvar(i,l,j,kk),i=1,4)
537 c write (iout,850) (bvar(i,l,j,kk),i=1,4)
539 bvar(i,l,j,kk)=deg2rad*bvar(i,l,j,kk)
546 if (kk.lt.nbank) nbank=kk
547 cd write (*,*) "read_bank ******************* kk",kk,
553 cd write (*,850) (bvar(i,l,j,kk),i=1,4)
559 c read (33,953) kdummy,bene(k),brmsn(k),bpncn(k),ibank(k)
562 c read (33,850) (bvar(i,l,j,k),i=1,4)
564 c bvar(i,l,j,k)=deg2rad*bvar(i,l,j,k)
572 952 format (1x,'#',i4,' total E ',f12.3,' rmsd from N ',f8.3,i5)
573 901 format (1x,6x,i3,3x,7x,i4,3x,7x,i8,i10,i2,f15.5)
574 902 format (1x,11x,i4,12x,1pe14.5)
575 953 format (1x,1x,i4,9x,f12.3,13x,f8.3,5x,f5.2,i5)
579 c---------------------------------------
580 subroutine write_bank1(jlee)
581 implicit real*8 (a-h,o-z)
583 include 'COMMON.IOUNITS'
585 include 'COMMON.BANK'
586 include 'COMMON.CHAIN'
589 #if defined(AIX) || defined(PGI)
590 open(icsa_bank1,file=csa_bank1,position="append")
592 open(icsa_bank1,file=csa_bank1,access="append")
594 write (icsa_bank1,900) jlee,nbank,nstep,cutdif
596 write (icsa_bank1,952) k,bene(k),brmsn(k),bpncn(k),ibank(k)
599 write (icsa_bank1,850) (rad2deg*bvar(i,l,j,k),i=1,4)
605 900 format (4x,"jlee =",i5,3x,"nbank =",i5,3x,"nstep =",i10,f15.5)
606 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
607 & ,' %NC ',0pf5.2,i5)
611 c---------------------------------
612 subroutine save_is(ind)
613 implicit real*8 (a-h,o-z)
616 include 'COMMON.IOUNITS'
618 include 'COMMON.BANK'
619 include 'COMMON.CHAIN'
622 c print *, "nbank,ind,index,is(ind) ",nbank,ind,index,is(ind)
623 if (index.gt.mxio .or. index.lt.1 .or.
624 & is(ind).gt.mxio .or. is(ind).lt.1) then
625 write (iout,*) 'Dimension ERROR in SAVE_IS: INDEX',index,
626 & ' IND',ind,' IS',is(ind)
627 call mpi_abort(mpi_comm_world,ierror,ierrcode)
632 bvar(i,j,k,index)=bvar(i,j,k,is(ind))
636 bene(index)=bene(is(ind))
641 c---------------------------------
642 subroutine select_is(n,ifar,idum)
643 implicit real*8 (a-h,o-z)
646 include 'COMMON.BANK'
647 dimension itag(mxio),adiff(mxio)
651 if(ibank(i).eq.0) then
661 if(ibank(i).eq.2) then
668 call get_is(idum,ifar,n,imade,0)
669 ctest3 call get_is_max(idum,ifar,n,imade,0)
670 else if(iuse.eq.n) then
675 else if(iuse.lt.n) then
676 c if(icycle.eq.0) then
678 c ind=mod(i-1,iuse)+1
689 c call get_is_ran(idum,n,imade,1)
690 call get_is(idum,ifar,n,imade,1)
691 ctest3 call get_is_max(idum,ifar,n,imade,1)
692 c if(iusesv.le.n/10) then
696 c if(ibank(i).eq.2) then
698 if(ibank(i).ge.2) then
707 call get_is(idum,ifar,n,imade,0)
708 ctest3 call get_is_max(idum,ifar,n,imade,0)
712 if (iuse.le.iucut) then
722 c---------------------------------
723 subroutine get_is_ran(idum,n,imade,k)
724 implicit real*8 (a-h,o-z)
727 include 'COMMON.BANK'
729 dimension itag(mxio),adiff(mxio)
734 if(ibank(i).eq.k) then
739 iran=iuse* ran1(idum)+1
746 c---------------------------------
747 subroutine get_is(idum,ifar,n,imade,k)
748 implicit real*8 (a-h,o-z)
751 include 'COMMON.BANK'
753 dimension itag(mxio),adiff(mxio)
757 if(ibank(i).eq.k) then
762 iran=iuse* ran1(idum)+1
768 if(icycle.eq.-1) then
769 call select_iseed_max(i,k)
771 call select_iseed_min(i,k)
772 ctest4 call select_iseed_max(i,k)
778 call select_iseed_far(i,k)
784 c---------------------------------
785 subroutine select_iseed_max(imade1,ik)
786 implicit real*8 (a-h,o-z)
789 include 'COMMON.BANK'
790 dimension itag(mxio),adiff(mxio)
796 if(ibank(n).eq.ik) then
801 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
804 if(diff.lt.diffmn) diffmn=diff
806 if(diffmn.gt.difmax) difmax=diffmn
814 c avedif=(avedif+difmax)/2
817 if(adiff(i).ge.avedif) then
820 if(benei.gt.emax) then
827 if(ik.eq.0) iuse=iuse-1
831 c---------------------------------
832 subroutine select_iseed_min(imade1,ik)
833 implicit real*8 (a-h,o-z)
836 include 'COMMON.BANK'
837 dimension itag(mxio),adiff(mxio)
843 if(ibank(n).eq.ik) then
848 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
851 if(diff.lt.diffmn) diffmn=diff
853 if(diffmn.gt.difmax) difmax=diffmn
861 c avedif=(avedif+difmax)/2
864 c print *,"i, adiff(i),avedif : ",i,adiff(i),avedif
865 if(adiff(i).ge.avedif) then
868 c print *,"i, benei,emin : ",i,benei,emin
869 if(benei.lt.emin) then
876 if(ik.eq.0) iuse=iuse-1
878 c print *, "exiting select_iseed_min",is(imade1)
882 c---------------------------------
883 subroutine select_iseed_far(imade1,ik)
884 implicit real*8 (a-h,o-z)
887 include 'COMMON.BANK'
891 if(ibank(n).eq.ik) then
895 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
898 if(diff.lt.diffmn) diffmn=diff
901 if(diffmn.gt.dmax) then
909 c---------------------------------
911 implicit real*8 (a-h,o-z)
914 include 'COMMON.BANK'
920 if(benei.lt.ebmin) then
928 c---------------------------------
929 subroutine write_csa_pdb(var,ene,nft,ik,iw_pdb)
930 implicit real*8 (a-h,o-z)
933 include 'COMMON.BANK'
935 include 'COMMON.IOUNITS'
936 include 'COMMON.MINIM'
937 include 'COMMON.SETUP'
939 include 'COMMON.CHAIN'
940 include 'COMMON.LOCAL'
941 include 'COMMON.INTERACT'
942 include 'COMMON.NAMES'
943 include 'COMMON.SBRIDGE'
944 integer lenpre,lenpot,ilen
946 dimension var(maxvar)
947 character*50 titelloc
951 if(ene.lt.eglob_csa) then
953 nglob_csa=nglob_csa+1
954 call numstr(nglob_csa,zahl)
956 call var_to_geom(nvar,var)
958 call secondary2(.false.)
961 open(icsa_pdb,file=prefix(:lenpre)//'@'//zahl//'.pdb')
963 if (iw_pdb.eq.1) then
964 write(titelloc,'(a2,i3,a3,i9,a3,i6)')
965 & 'GM',nglob_csa,' e ',nft,' m ',nmin_csa
967 write(titelloc,'(a2,i3,a3,i9,a3,i6,a5,f5.2,a5,f5.1)')
968 & 'GM',nglob_csa,' e ',nft,' m ',nmin_csa,' rms '
969 & ,rmsn(ik),' %NC ',pncn(ik)*100
971 call pdbout(eglob_csa,titelloc,icsa_pdb)
977 c---------------------------------
979 implicit real*8 (a-h,o-z)
982 include 'COMMON.BANK'
988 if(benei.gt.ebmax) then
996 c---------------------------------
998 implicit real*8 (a-h,o-z)
1000 include 'COMMON.CSA'
1001 include 'COMMON.BANK'
1007 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1008 call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1015 if(diff.lt.difmin) difmin=diff
1024 avedif=tdiff/nbank/(nbank-1)*2
1028 c---------------------------------
1029 subroutine get_diff_p
1030 implicit real*8 (a-h,o-z)
1031 include 'DIMENSIONS'
1032 include 'COMMON.CSA'
1033 include 'COMMON.BANK'
1034 include 'COMMON.SETUP'
1035 include 'COMMON.IOUNITS'
1037 integer ij(mxio*mxio/2,2)
1038 double precision dij_local(mxio,mxio)
1040 c write (iout,*) 'Processor ',me,' broadcasting'
1041 call mpi_bcast(nbank,1,mpi_integer,0,CG_COMM,ierr)
1042 call mpi_bcast(numch,1,mpi_integer,0,CG_COMM,ierr)
1043 call mpi_bcast(bvar,mxang*maxres*mxch*nbank,
1044 & mpi_double_precision,0,CG_COMM,ierr)
1045 call mpi_bcast(jbank,nbank,mpi_integer,0,CG_COMM,ierr)
1046 c write (iout,*) 'Processor ',me,' after broadcasting'
1055 dij_local(i1,i2)=0.0
1056 dij_local(i2,i1)=0.0
1057 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1062 dij_local(i1,i2)=dij(i1,i2)
1063 dij_local(i2,i1)=dij(i2,i1)
1068 dij_local(i1,i1)=0.0
1071 do i12=me+1,nbank*(nbank-1)/2,nodes
1074 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1075 call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1076 dij_local(i1,i2)=diff
1077 dij_local(i2,i1)=diff
1081 call mpi_reduce(dij_local,dij,mxio*nbank,
1082 & mpi_double_precision,mpi_sum,0,CG_COMM,ierr)
1085 if (me.eq.king) then
1091 cd write (iout,*) "!!!ppp",i1,i2,dij(i1,i2)
1092 cd call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1093 cd write (iout,*) "!!!",i1,i2,diff
1094 tdiff=tdiff+dij(i1,i2)
1095 if(diff.lt.difmin) difmin=diff
1103 avedif=tdiff/nbank/(nbank-1)*2
1110 c---------------------------------
1111 subroutine estimate_cutdif(adif,xct,cutdifr)
1112 implicit real*8 (a-h,o-z)
1113 include 'DIMENSIONS'
1114 include 'COMMON.CSA'
1115 include 'COMMON.BANK'
1119 exponent = cutdifr*cut1/adif
1120 exponent = dlog(exponent)/dlog(xct)
1123 cutdif= adif/cut1*xct**nexp
1124 if(cutdif.lt.ctdif1) cutdif=ctdif1
1128 c---------------------------------
1129 subroutine get_is_max(idum,ifar,n,imade,k)
1130 implicit real*8 (a-h,o-z)
1131 include 'DIMENSIONS'
1132 include 'COMMON.CSA'
1133 include 'COMMON.BANK'
1134 double precision emax
1139 if(ibank(j).eq.k .and. bene(j).gt.emax) then
1149 c-----------------------------------------
1150 subroutine refresh_bank_master_tmscore(ifrom,econf,n)
1151 implicit real*8 (a-h,o-z)
1152 include 'DIMENSIONS'
1153 include 'COMMON.CSA'
1154 include 'COMMON.BANK'
1155 include 'COMMON.IOUNITS'
1156 include 'COMMON.CHAIN'
1157 include 'COMMON.VAR'
1158 include 'COMMON.CONTROL'
1159 include 'COMMON.SETUP'
1163 double precision l_diff(mxio),denep
1164 integer info(12),idmin
1166 cd write(iout,*) 'refresh_bank_master_tmscore',ifrom
1171 call mpi_send(info,12,mpi_integer,ifrom,idint,CG_COMM,
1173 call mpi_send(bvar,mxang*maxres*mxch*nbank,mpi_double_precision,
1174 * ifrom,idreal,CG_COMM,ierr)
1175 call mpi_recv(idmin,1,mpi_integer,
1176 * ifrom,idint,CG_COMM,muster,ierr)
1177 call mpi_recv(l_diff,nbank,mpi_double_precision,
1178 * ifrom,idreal,CG_COMM,muster,ierr)
1182 nstatnx(movernx(n),1)=nstatnx(movernx(n),1)+1
1184 difmin=l_diff(idmin)
1185 if(difmin.lt.cutdif) then
1186 c n is redundant to idmin
1187 if(econf.lt.bene(idmin)) then
1188 if(econf.lt.bene(idmin)-0.01d0) then
1192 denep=bene(idmin)-econf
1193 call replace_bvar(idmin,n)
1196 if (i1.ne.idmin) then
1197 dij(i1,idmin)=l_diff(i1)
1198 dij(idmin,i1)=l_diff(i1)
1203 nstatnx(movernx(n),2)=nstatnx(movernx(n),2)+1
1204 if(idmin.eq.ibmax) call find_max
1207 c got new conformation
1209 if(ebmax-ebmin.gt.del_ene) then
1211 call replace_bvar(ibmax,n)
1214 if (i1.ne.ibmax) then
1215 dij(i1,ibmax)=l_diff(i1)
1216 dij(ibmax,i1)=l_diff(i1)
1221 nstatnx(movernx(n),3)=nstatnx(movernx(n),3)+1
1226 call replace_bvar(ibmax,n)
1232 cccccccccccccccccccccccccccccccccccccccccccc
1233 if (iaccn.eq.0) then
1235 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5)')
1236 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1237 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9)
1239 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5
1240 & ,a5,0pf4.1,a5,f3.0)')
1241 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1242 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1243 & ' rms ',rmsn(n),' %NC ',pncn(n)*100
1247 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,
1248 & 1x,a1,i4,0pf8.2,0pf9.1)')
1249 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1250 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1251 & chacc,iaccn,difmin,denep
1253 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,a5,
1254 & 0pf4.1,a5,f3.0,1x,a1,i4,0pf8.2,0pf9.1)')
1255 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1256 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1257 & ' rms ',rmsn(n),' %NC ',pncn(n)*100,
1258 & chacc,iaccn,difmin,denep
1268 c-----------------------------------------
1269 subroutine refresh_bank_worker_tmscore(var)
1270 implicit real*8 (a-h,o-z)
1271 include 'DIMENSIONS'
1272 include 'COMMON.BANK'
1273 include 'COMMON.VAR'
1274 include 'COMMON.CHAIN'
1275 include 'COMMON.SETUP'
1276 include 'COMMON.IOUNITS'
1277 include 'COMMON.CSA'
1279 integer muster(mpi_status_size)
1280 double precision var(maxvar)
1281 double precision dihang_l(mxang,maxres,mxch)
1282 double precision l_diff(mxio)
1284 call mpi_recv(bvar,mxang*maxres*mxch*nbank,mpi_double_precision,
1285 * 0,idreal,CG_COMM,muster,ierr)
1287 call var_to_geom(nvar,var)
1289 dihang_l(1,j,1)=theta(j+1)
1290 dihang_l(2,j,1)=phi(j+2)
1291 dihang_l(3,j,1)=alph(j)
1292 dihang_l(4,j,1)=omeg(j)
1297 call get_diff12(dihang_l,bvar(1,1,1,m),l_diff(m))
1298 if(l_diff(m).lt.difmin) then
1305 call get_diff12(dihang_l,bvar(1,1,1,idmin),a_diff)
1308 cd write(iout,*) idmin,l_diff(idmin),a_diff
1309 call mpi_send(idmin,1,mpi_integer,0,idint,CG_COMM,
1311 call mpi_send(l_diff,nbank,mpi_double_precision,
1312 * 0,idreal,CG_COMM,ierr)
1316 c------------------------------------------------
1317 subroutine print_mv_stat
1318 implicit real*8 (a-h,o-z)
1319 include 'DIMENSIONS'
1320 include 'COMMON.BANK'
1321 include 'COMMON.IOUNITS'
1324 if(nstatnx(i,1).ne.0) then
1326 write(iout,'(a4,i1,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1327 & '## N',i,' total=',nstatnx(i,1),
1328 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1329 & ' %acc',(nstatnx(i,2)+nstatnx(i,3))*100.0/nstatnx(i,1)
1331 write(iout,'(a3,i2,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1332 & '##N',i,' total=',nstatnx(i,1),
1333 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1334 & ' %acc',(nstatnx(i,2)+nstatnx(i,3))*100.0/nstatnx(i,1)
1338 write(iout,'(a4,i1,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1339 & '## N',i,' total=',nstatnx(i,1),
1340 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1343 write(iout,'(a3,i2,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1344 & '##N',i,' total=',nstatnx(i,1),
1345 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),