1 cc---------------------------------
2 subroutine refresh_bank(ntrial)
3 implicit real*8 (a-h,o-z)
8 include 'COMMON.IOUNITS'
11 include 'COMMON.CONTROL'
14 double precision l_diff(mxio),denep
18 nstatnx_tot(i,j)=nstatnx_tot(i,j)+nstatnx(i,j)
23 c loop over all newly obtained conformations
27 nstatnx(movernx(n),1)=nstatnx(movernx(n),1)+1
28 cccccccccccccccccccccccccccccccccccccccccccc
31 if(rmsn(n).gt.rmscut.or.pncn(n).lt.pnccut) goto 100
34 if(etot(n).gt.ebmax) goto 100
35 c Find the conformation closest to the conformation n in the bank
38 call get_diff12(dihang(1,1,1,n),bvar(1,1,1,m),l_diff(m))
39 if(l_diff(m).lt.difmin) then
45 if(difmin.lt.cutdif) then
46 c n is redundant to idmin
47 if(etot(n).lt.bene(idmin)) then
48 if(etot(n).lt.bene(idmin)-0.01d0) then
52 denep=bene(idmin)-etot(n)
53 call replace_bvar(idmin,n)
57 dij(i1,idmin)=l_diff(i1)
58 dij(idmin,i1)=l_diff(i1)
63 nstatnx(movernx(n),2)=nstatnx(movernx(n),2)+1
64 if(idmin.eq.ibmax) call find_max
67 c got new conformation
69 if(ebmax-ebmin.gt.del_ene) then
71 call replace_bvar(ibmax,n)
75 dij(i1,ibmax)=l_diff(i1)
76 dij(ibmax,i1)=l_diff(i1)
81 nstatnx(movernx(n),3)=nstatnx(movernx(n),3)+1
86 if(del_ene.lt.0.0001) then
87 write (iout,*) 'ERROR in refresh_bank: '
88 write (iout,*) 'ebmax: ',ebmax
89 write (iout,*) 'ebmin: ',ebmin
90 write (iout,*) 'del_ene: ',del_ene
91 crc call mpi_abort(mpi_comm_world,ierror,ierrcode)
93 cjp nbmax is never defined so condition below is always false
94 c if(nbank.lt.nbmax) then
96 c call replace_bvar(nbank,n)
100 call replace_bvar(ibmax,n)
107 cccccccccccccccccccccccccccccccccccccccccccc
111 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5)')
112 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
113 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9)
115 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5
116 & ,a5,0pf4.1,a5,f3.0)')
117 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
118 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
119 & ' rms ',rmsn(n),' %NC ',pncn(n)*100
123 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,
124 & 1x,a1,i4,0pf8.1,0pf8.1)')
125 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
126 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
127 & chacc,iaccn,difmin,denep
129 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,a5,
130 & 0pf4.1,a5,f3.0,1x,a1,i4,0pf8.1,0pf8.1)')
131 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',etot(n),' mv ',
132 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
133 & ' rms ',rmsn(n),' %NC ',pncn(n)*100,
134 & chacc,iaccn,difmin,denep
138 c end of loop over all newly obtained conformations
141 crc moved up, saves some get_diff12 calls
145 crc if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
146 crc call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
159 c---------------------------------
160 subroutine replace_bvar(iold,inew)
161 implicit real*8 (a-h,o-z)
164 include 'COMMON.IOUNITS'
166 include 'COMMON.BANK'
167 include 'COMMON.CHAIN'
168 include 'COMMON.CONTROL'
169 include 'COMMON.SBRIDGE'
171 if (iold.gt.mxio .or. iold.lt.1 .or. inew.gt.mxio .or. inew.lt.1)
173 write (iout,*) 'Dimension ERROR in REPLACE_BVAR: IOLD',iold,
175 call mpi_abort(mpi_comm_world,ierror,ierrcode)
180 bvar(i,j,k,iold)=dihang(i,j,k,inew)
184 bene(iold)=etot(inew)
185 brmsn(iold)=rmsn(inew)
186 bpncn(iold)=pncn(inew)
188 if(bene(iold).lt.ebmin) then
194 bvar_nss(iold)=nss_out(inew)
195 cd write(iout,*) 'SS BANK',iold,bvar_nss(iold)
196 do i=1,bvar_nss(iold)
197 bvar_ss(1,i,iold)=iss_out(i,inew)
198 bvar_ss(2,i,iold)=jss_out(i,inew)
199 cd write(iout,*) 'SS',bvar_ss(1,i,iold)-nres,
200 cd & bvar_ss(2,i,iold)-nres
203 bvar_ns(iold)=ns-2*bvar_nss(iold)
204 cd write(iout,*) 'CYS #free ', bvar_ns(iold)
208 do while( iss(i).ne.iss_out(j,inew)-nres .and.
209 & iss(i).ne.jss_out(j,inew)-nres .and.
210 & j.le.nss_out(inew))
213 if (j.gt.nss_out(inew)) then
215 bvar_s(k,iold)=iss(i)
218 cd write(iout,*) 'CYS free',(bvar_s(k,iold),k=1,bvar_ns(iold))
223 c---------------------------------------
224 subroutine write_rbank(jlee,adif,nft)
225 implicit real*8 (a-h,o-z)
227 include 'COMMON.IOUNITS'
229 include 'COMMON.BANK'
230 include 'COMMON.CHAIN'
233 open(icsa_rbank,file=csa_rbank,status="unknown")
234 write (icsa_rbank,900) jlee,nbank,nstep,nft,icycle,adif
236 write (icsa_rbank,952) k,rene(k),rrmsn(k),rpncn(k)
239 write (icsa_rbank,850) (rad2deg*rvar(i,l,j,k),i=1,4)
246 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
248 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
253 c---------------------------------------
254 subroutine read_rbank(jlee,adif)
255 implicit real*8 (a-h,o-z)
258 include 'COMMON.IOUNITS'
260 include 'COMMON.BANK'
261 include 'COMMON.CHAIN'
263 include 'COMMON.SETUP'
266 open(icsa_rbank,file=csa_rbank,status="old")
267 read (icsa_rbank,901) jleer,nbankr,nstepr,nftr,icycler,adif
268 print *,jleer,nbankr,nstepr,nftr,icycler,adif
269 c print *, 'adif from read_rbank ',adif
270 if(nbankr.ne.nbank) then
271 write (iout,*) 'ERROR in READ_BANK: NBANKR',nbankr,
273 call mpi_abort(mpi_comm_world,ierror,ierrcode)
275 if(jleer.ne.jlee) then
276 write (iout,*) 'ERROR in READ_BANK: JLEER',jleer,
278 call mpi_abort(mpi_comm_world,ierror,ierrcode)
283 read (icsa_rbank,'(a80)') karta
284 write(iout,*) "READ_RBANK: kk=",kk
286 c if (index(karta,"*").gt.0) then
287 c write (iout,*) "***** Stars in bankr ***** k=",k,
291 c read (30,850) (rdummy,i=1,4)
296 call reada(karta,"total E",rene(kk),1.0d20)
297 call reada(karta,"rmsd from N",rrmsn(kk),0.0d0)
298 call reada(karta,"%NC",rpncn(kk),0.0d0)
299 write(iout,*)"total E",bene(kk),"rmsd from N",brmsn(kk),
300 & "%NC",bpncn(kk),ibank(kk)
301 c read (icsa_rbank,953) kdummy,rene(kk),rrmsn(kk),rpncn(kk)
304 read (icsa_rbank,850) (rvar(i,l,j,kk),i=1,4)
305 c write (iout,850) (rvar(i,l,j,kk),i=1,4)
307 rvar(i,l,j,kk)=deg2rad*rvar(i,l,j,kk)
313 cd write (*,*) "read_rbank ******************* kk",kk,
315 if (kk.lt.nbankr) nbankr=kk
320 cd write (*,850) (rvar(i,l,j,kk),i=1,4)
327 901 format (1x,6x,i3,3x,7x,i4,3x,7x,i8,i10,i2,f15.5)
328 953 format (1x,1x,i4,9x,f12.3,13x,f8.3,5x,f5.2)
332 c---------------------------------------
333 subroutine write_bank(jlee,nft)
334 implicit real*8 (a-h,o-z)
336 include 'COMMON.IOUNITS'
338 include 'COMMON.BANK'
339 include 'COMMON.CHAIN'
341 include 'COMMON.SBRIDGE'
342 include 'COMMON.CONTROL'
347 open(icsa_bank,file=csa_bank,status="unknown")
348 write (icsa_bank,900) jlee,nbank,nstep,nft,icycle,cutdif
349 write (icsa_bank,902) nglob_csa, eglob_csa
350 open (igeom,file=intname,status='UNKNOWN')
352 write (icsa_bank,952) k,bene(k),brmsn(k),bpncn(k),ibank(k)
353 if (vdisulf) write (icsa_bank,'(101i4)')
354 & bvar_nss(k),((bvar_ss(j,i,k),j=1,2),i=1,bvar_nss(k))
357 write (icsa_bank,850) (rad2deg*bvar(i,l,j,k),i=1,4)
360 if (bvar_nss(k).le.9) then
361 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
362 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,bvar_nss(k))
364 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
365 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,9)
366 write (igeom,'(3X,11(1X,2I3))') (bvar_ss(1,i,k),
367 & bvar_ss(2,i,k),i=10,bvar_nss(k))
369 write (igeom,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
370 write (igeom,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
371 write (igeom,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
372 write (igeom,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
377 if (nstep/200.gt.ilastnstep) then
379 ilastnstep=(ilastnstep+1)*1.5
380 write(chfrm,'(a2,i1,a1)') '(i',int(dlog10(dble(nstep))+1),')'
381 write(chtmp,chfrm) nstep
382 open(icsa_int,file=prefix(:ilen(prefix))
383 & //'_'//chtmp(:ilen(chtmp))//'.int',status='UNKNOWN')
385 if (bvar_nss(k).le.9) then
386 write (icsa_int,'(I5,F10.3,I2,9(1X,2I3))') k,bene(k),
387 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,bvar_nss(k))
389 write (icsa_int,'(I5,F10.3,I2,9(1X,2I3))') k,bene(k),
390 & bvar_nss(k),(bvar_ss(1,i,k),bvar_ss(2,i,k),i=1,9)
391 write (icsa_int,'(3X,11(1X,2I3))') (bvar_ss(1,i,k),
392 & bvar_ss(2,i,k),i=10,bvar_nss(k))
394 write (icsa_int,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
395 write (icsa_int,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
396 write (icsa_int,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
397 write (icsa_int,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
405 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
407 902 format (1x,'nglob_csa =',i4,' eglob_csa =',1pe14.5)
408 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3,
413 c---------------------------------------
414 subroutine write_bank_reminimized(jlee,nft)
415 implicit real*8 (a-h,o-z)
417 include 'COMMON.IOUNITS'
419 include 'COMMON.BANK'
420 include 'COMMON.CHAIN'
422 include 'COMMON.SBRIDGE'
424 open(icsa_bank_reminimized,file=csa_bank_reminimized,
426 write (icsa_bank_reminimized,900)
427 & jlee,nbank,nstep,nft,icycle,cutdif
428 open (igeom,file=intname,status='UNKNOWN')
430 write (icsa_bank_reminimized,952) k,bene(k),brmsn(k),
434 write (icsa_bank_reminimized,850) (rad2deg*bvar(i,l,j,k),i=1,4)
438 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
439 & nss,(ihpb(i),jhpb(i),i=1,nss)
441 write (igeom,'(I5,F10.2,I2,9(1X,2I3))') k,bene(k),
442 & nss,(ihpb(i),jhpb(i),i=1,9)
443 write (igeom,'(3X,11(1X,2I3))') (ihpb(i),jhpb(i),i=10,nss)
445 write (igeom,200) (rad2deg*bvar(1,i,1,k),i=2,nres-1)
446 write (igeom,200) (rad2deg*bvar(2,i,1,k),i=2,nres-2)
447 write (igeom,200) (rad2deg*bvar(3,i,1,k),i=2,nres-1)
448 write (igeom,200) (rad2deg*bvar(4,i,1,k),i=2,nres-1)
450 close(icsa_bank_reminimized)
455 900 format (1x,"jlee =",i3,3x,"nbank =",i4,3x,"nstep =",
457 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
458 & ,' %NC ',0pf5.2,i5)
462 c---------------------------------
463 subroutine read_bank(jlee,nft,cutdifr)
464 implicit real*8 (a-h,o-z)
466 include 'COMMON.IOUNITS'
468 include 'COMMON.BANK'
469 include 'COMMON.CHAIN'
471 include 'COMMON.CONTROL'
472 include 'COMMON.SBRIDGE'
477 open(icsa_bank,file=csa_bank,status="old")
478 read (icsa_bank,901) jlee,nbank,nstep,nft,icycle,cutdifr
479 read (icsa_bank,902) nglob_csa, eglob_csa
480 c if(jleer.ne.jlee) then
481 c write (iout,*) 'ERROR in READ_BANK: JLEER',jleer,
483 c call mpi_abort(mpi_comm_world,ierror,ierrcode)
488 read (icsa_bank,'(a80)') karta
489 write(iout,*) "READ_BANK: kk=",kk
491 c if (index(karta,"*").gt.0) then
492 c write (iout,*) "***** Stars in bank ***** k=",k,
496 c read (33,850) (rdummy,i=1,4)
501 call reada(karta,"total E",bene(kk),1.0d20)
502 call reada(karta,"rmsd from N",brmsn(kk),0.0d0)
503 call reada(karta,"%NC",bpncn(kk),0.0d0)
504 read (karta(ilen(karta)-1:),*,end=111,err=111) ibank(kk)
508 write(iout,*)"total E",bene(kk),"rmsd from N",brmsn(kk),
509 & "%NC",bpncn(kk),ibank(kk)
510 c read (icsa_bank,953) kdummy,bene(k),brmsn(k),bpncn(k),ibank(k)
512 read (icsa_bank,'(101i4)')
513 & bvar_nss(kk),((bvar_ss(j,i,kk),j=1,2),i=1,bvar_nss(kk))
514 bvar_ns(kk)=ns-2*bvar_nss(kk)
515 write(iout,*) 'read SSBOND',bvar_nss(kk),
516 & ((bvar_ss(j,i,kk),j=1,2),i=1,bvar_nss(kk))
517 cd write(iout,*) 'read CYS #free ', bvar_ns(kk)
521 do while( iss(i).ne.bvar_ss(1,j,kk)-nres .and.
522 & iss(i).ne.bvar_ss(2,j,kk)-nres .and.
526 if (j.gt.bvar_nss(kk)) then
531 cd write(iout,*)'read CYS free',(bvar_s(l,kk),l=1,bvar_ns(kk))
535 read (icsa_bank,850) (bvar(i,l,j,kk),i=1,4)
536 c write (iout,850) (bvar(i,l,j,kk),i=1,4)
538 bvar(i,l,j,kk)=deg2rad*bvar(i,l,j,kk)
545 if (kk.lt.nbank) nbank=kk
546 cd write (*,*) "read_bank ******************* kk",kk,
552 cd write (*,850) (bvar(i,l,j,kk),i=1,4)
558 c read (33,953) kdummy,bene(k),brmsn(k),bpncn(k),ibank(k)
561 c read (33,850) (bvar(i,l,j,k),i=1,4)
563 c bvar(i,l,j,k)=deg2rad*bvar(i,l,j,k)
571 952 format (1x,'#',i4,' total E ',f12.3,' rmsd from N ',f8.3,i5)
572 901 format (1x,6x,i3,3x,7x,i4,3x,7x,i8,i10,i2,f15.5)
573 902 format (1x,11x,i4,12x,1pe14.5)
574 953 format (1x,1x,i4,9x,f12.3,13x,f8.3,5x,f5.2,i5)
578 c---------------------------------------
579 subroutine write_bank1(jlee)
580 implicit real*8 (a-h,o-z)
582 include 'COMMON.IOUNITS'
584 include 'COMMON.BANK'
585 include 'COMMON.CHAIN'
588 #if defined(AIX) || defined(PGI)
589 open(icsa_bank1,file=csa_bank1,position="append")
591 open(icsa_bank1,file=csa_bank1,access="append")
593 write (icsa_bank1,900) jlee,nbank,nstep,cutdif
595 write (icsa_bank1,952) k,bene(k),brmsn(k),bpncn(k),ibank(k)
598 write (icsa_bank1,850) (rad2deg*bvar(i,l,j,k),i=1,4)
604 900 format (4x,"jlee =",i5,3x,"nbank =",i5,3x,"nstep =",i10,f15.5)
605 952 format (1x,'#',i4,' total E ',1pe14.5,' rmsd from N ',0pf8.3
606 & ,' %NC ',0pf5.2,i5)
610 c---------------------------------
611 subroutine save_is(ind)
612 implicit real*8 (a-h,o-z)
615 include 'COMMON.IOUNITS'
617 include 'COMMON.BANK'
618 include 'COMMON.CHAIN'
621 c print *, "nbank,ind,index,is(ind) ",nbank,ind,index,is(ind)
622 if (index.gt.mxio .or. index.lt.1 .or.
623 & is(ind).gt.mxio .or. is(ind).lt.1) then
624 write (iout,*) 'Dimension ERROR in SAVE_IS: INDEX',index,
625 & ' IND',ind,' IS',is(ind)
626 call mpi_abort(mpi_comm_world,ierror,ierrcode)
631 bvar(i,j,k,index)=bvar(i,j,k,is(ind))
635 bene(index)=bene(is(ind))
640 c---------------------------------
641 subroutine select_is(n,ifar,idum)
642 implicit real*8 (a-h,o-z)
645 include 'COMMON.BANK'
646 dimension itag(mxio),adiff(mxio)
650 if(ibank(i).eq.0) then
660 if(ibank(i).eq.2) then
667 call get_is(idum,ifar,n,imade,0)
668 ctest3 call get_is_max(idum,ifar,n,imade,0)
669 else if(iuse.eq.n) then
674 else if(iuse.lt.n) then
675 c if(icycle.eq.0) then
677 c ind=mod(i-1,iuse)+1
688 c call get_is_ran(idum,n,imade,1)
689 call get_is(idum,ifar,n,imade,1)
690 ctest3 call get_is_max(idum,ifar,n,imade,1)
691 c if(iusesv.le.n/10) then
695 c if(ibank(i).eq.2) then
697 if(ibank(i).ge.2) then
706 call get_is(idum,ifar,n,imade,0)
707 ctest3 call get_is_max(idum,ifar,n,imade,0)
711 if (iuse.le.iucut) then
721 c---------------------------------
722 subroutine get_is_ran(idum,n,imade,k)
723 implicit real*8 (a-h,o-z)
726 include 'COMMON.BANK'
728 dimension itag(mxio),adiff(mxio)
733 if(ibank(i).eq.k) then
738 iran=iuse* ran1(idum)+1
745 c---------------------------------
746 subroutine get_is(idum,ifar,n,imade,k)
747 implicit real*8 (a-h,o-z)
750 include 'COMMON.BANK'
752 dimension itag(mxio),adiff(mxio)
756 if(ibank(i).eq.k) then
761 iran=iuse* ran1(idum)+1
767 if(icycle.eq.-1) then
768 call select_iseed_max(i,k)
770 call select_iseed_min(i,k)
771 ctest4 call select_iseed_max(i,k)
777 call select_iseed_far(i,k)
783 c---------------------------------
784 subroutine select_iseed_max(imade1,ik)
785 implicit real*8 (a-h,o-z)
788 include 'COMMON.BANK'
789 dimension itag(mxio),adiff(mxio)
795 if(ibank(n).eq.ik) then
800 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
803 if(diff.lt.diffmn) diffmn=diff
805 if(diffmn.gt.difmax) difmax=diffmn
813 c avedif=(avedif+difmax)/2
816 if(adiff(i).ge.avedif) then
819 if(benei.gt.emax) then
826 if(ik.eq.0) iuse=iuse-1
830 c---------------------------------
831 subroutine select_iseed_min(imade1,ik)
832 implicit real*8 (a-h,o-z)
835 include 'COMMON.BANK'
836 dimension itag(mxio),adiff(mxio)
842 if(ibank(n).eq.ik) then
847 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
850 if(diff.lt.diffmn) diffmn=diff
852 if(diffmn.gt.difmax) difmax=diffmn
860 c avedif=(avedif+difmax)/2
863 c print *,"i, adiff(i),avedif : ",i,adiff(i),avedif
864 if(adiff(i).ge.avedif) then
867 c print *,"i, benei,emin : ",i,benei,emin
868 if(benei.lt.emin) then
875 if(ik.eq.0) iuse=iuse-1
877 c print *, "exiting select_iseed_min",is(imade1)
881 c---------------------------------
882 subroutine select_iseed_far(imade1,ik)
883 implicit real*8 (a-h,o-z)
886 include 'COMMON.BANK'
890 if(ibank(n).eq.ik) then
894 c call get_diff12(bvar(1,1,1,n),bvar(1,1,1,m),diff,idiff)
897 if(diff.lt.diffmn) diffmn=diff
900 if(diffmn.gt.dmax) then
908 c---------------------------------
910 implicit real*8 (a-h,o-z)
913 include 'COMMON.BANK'
919 if(benei.lt.ebmin) then
927 c---------------------------------
928 subroutine write_csa_pdb(var,ene,nft,ik,iw_pdb)
929 implicit real*8 (a-h,o-z)
932 include 'COMMON.BANK'
934 include 'COMMON.IOUNITS'
935 include 'COMMON.MINIM'
936 include 'COMMON.SETUP'
938 include 'COMMON.CHAIN'
939 include 'COMMON.LOCAL'
940 include 'COMMON.INTERACT'
941 include 'COMMON.NAMES'
942 include 'COMMON.SBRIDGE'
943 integer lenpre,lenpot,ilen
945 dimension var(maxvar)
946 character*50 titelloc
950 if(ene.lt.eglob_csa) then
952 nglob_csa=nglob_csa+1
953 call numstr(nglob_csa,zahl)
955 call var_to_geom(nvar,var)
957 call secondary2(.false.)
960 open(icsa_pdb,file=prefix(:lenpre)//'@'//zahl//'.pdb')
962 if (iw_pdb.eq.1) then
963 write(titelloc,'(a2,i3,a3,i9,a3,i6)')
964 & 'GM',nglob_csa,' e ',nft,' m ',nmin_csa
966 write(titelloc,'(a2,i3,a3,i9,a3,i6,a5,f5.2,a5,f5.1)')
967 & 'GM',nglob_csa,' e ',nft,' m ',nmin_csa,' rms '
968 & ,rmsn(ik),' %NC ',pncn(ik)*100
970 call pdbout(eglob_csa,titelloc,icsa_pdb)
976 c---------------------------------
978 implicit real*8 (a-h,o-z)
981 include 'COMMON.BANK'
987 if(benei.gt.ebmax) then
995 c---------------------------------
997 implicit real*8 (a-h,o-z)
1000 include 'COMMON.BANK'
1006 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1007 call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1014 if(diff.lt.difmin) difmin=diff
1023 avedif=tdiff/nbank/(nbank-1)*2
1027 c---------------------------------
1028 subroutine get_diff_p
1029 implicit real*8 (a-h,o-z)
1030 include 'DIMENSIONS'
1031 include 'COMMON.CSA'
1032 include 'COMMON.BANK'
1033 include 'COMMON.SETUP'
1034 include 'COMMON.IOUNITS'
1036 integer ij(mxio*mxio/2,2)
1037 double precision dij_local(mxio,mxio)
1039 c write (iout,*) 'Processor ',me,' broadcasting'
1040 call mpi_bcast(nbank,1,mpi_integer,0,CG_COMM,ierr)
1041 call mpi_bcast(numch,1,mpi_integer,0,CG_COMM,ierr)
1042 call mpi_bcast(bvar,mxang*maxres*mxch*nbank,
1043 & mpi_double_precision,0,CG_COMM,ierr)
1044 call mpi_bcast(jbank,nbank,mpi_integer,0,CG_COMM,ierr)
1045 c write (iout,*) 'Processor ',me,' after broadcasting'
1054 dij_local(i1,i2)=0.0
1055 dij_local(i2,i1)=0.0
1056 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1061 dij_local(i1,i2)=dij(i1,i2)
1062 dij_local(i2,i1)=dij(i2,i1)
1067 dij_local(i1,i1)=0.0
1070 do i12=me+1,nbank*(nbank-1)/2,nodes
1073 if(jbank(i1).eq.0.or.jbank(i2).eq.0) then
1074 call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1075 dij_local(i1,i2)=diff
1076 dij_local(i2,i1)=diff
1080 call mpi_reduce(dij_local,dij,mxio*nbank,
1081 & mpi_double_precision,mpi_sum,0,CG_COMM,ierr)
1084 if (me.eq.king) then
1090 cd write (iout,*) "!!!ppp",i1,i2,dij(i1,i2)
1091 cd call get_diff12(bvar(1,1,1,i1),bvar(1,1,1,i2),diff)
1092 cd write (iout,*) "!!!",i1,i2,diff
1093 tdiff=tdiff+dij(i1,i2)
1094 if(diff.lt.difmin) difmin=diff
1102 avedif=tdiff/nbank/(nbank-1)*2
1109 c---------------------------------
1110 subroutine estimate_cutdif(adif,xct,cutdifr)
1111 implicit real*8 (a-h,o-z)
1112 include 'DIMENSIONS'
1113 include 'COMMON.CSA'
1114 include 'COMMON.BANK'
1118 exponent = cutdifr*cut1/adif
1119 exponent = dlog(exponent)/dlog(xct)
1122 cutdif= adif/cut1*xct**nexp
1123 if(cutdif.lt.ctdif1) cutdif=ctdif1
1127 c---------------------------------
1128 subroutine get_is_max(idum,ifar,n,imade,k)
1129 implicit real*8 (a-h,o-z)
1130 include 'DIMENSIONS'
1131 include 'COMMON.CSA'
1132 include 'COMMON.BANK'
1133 double precision emax
1138 if(ibank(j).eq.k .and. bene(j).gt.emax) then
1148 c-----------------------------------------
1149 subroutine refresh_bank_master_tmscore(ifrom,econf,n)
1150 implicit real*8 (a-h,o-z)
1151 include 'DIMENSIONS'
1152 include 'COMMON.CSA'
1153 include 'COMMON.BANK'
1154 include 'COMMON.IOUNITS'
1155 include 'COMMON.CHAIN'
1156 include 'COMMON.VAR'
1157 include 'COMMON.CONTROL'
1158 include 'COMMON.SETUP'
1162 double precision l_diff(mxio),denep
1163 integer info(12),idmin
1165 cd write(iout,*) 'refresh_bank_master_tmscore',ifrom
1170 call mpi_send(info,12,mpi_integer,ifrom,idint,CG_COMM,
1172 call mpi_send(bvar,mxang*maxres*mxch*nbank,mpi_double_precision,
1173 * ifrom,idreal,CG_COMM,ierr)
1174 call mpi_recv(idmin,1,mpi_integer,
1175 * ifrom,idint,CG_COMM,muster,ierr)
1176 call mpi_recv(l_diff,nbank,mpi_double_precision,
1177 * ifrom,idreal,CG_COMM,muster,ierr)
1181 nstatnx(movernx(n),1)=nstatnx(movernx(n),1)+1
1183 difmin=l_diff(idmin)
1184 if(difmin.lt.cutdif) then
1185 c n is redundant to idmin
1186 if(econf.lt.bene(idmin)) then
1187 if(econf.lt.bene(idmin)-0.01d0) then
1191 denep=bene(idmin)-econf
1192 call replace_bvar(idmin,n)
1195 if (i1.ne.idmin) then
1196 dij(i1,idmin)=l_diff(i1)
1197 dij(idmin,i1)=l_diff(i1)
1202 nstatnx(movernx(n),2)=nstatnx(movernx(n),2)+1
1203 if(idmin.eq.ibmax) call find_max
1206 c got new conformation
1208 if(ebmax-ebmin.gt.del_ene) then
1210 call replace_bvar(ibmax,n)
1213 if (i1.ne.ibmax) then
1214 dij(i1,ibmax)=l_diff(i1)
1215 dij(ibmax,i1)=l_diff(i1)
1220 nstatnx(movernx(n),3)=nstatnx(movernx(n),3)+1
1225 call replace_bvar(ibmax,n)
1231 cccccccccccccccccccccccccccccccccccccccccccc
1232 if (iaccn.eq.0) then
1234 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5)')
1235 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1236 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9)
1238 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5
1239 & ,a5,0pf4.1,a5,f3.0)')
1240 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1241 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1242 & ' rms ',rmsn(n),' %NC ',pncn(n)*100
1246 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,
1247 & 1x,a1,i4,0pf8.2,0pf9.1)')
1248 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1249 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1250 & chacc,iaccn,difmin,denep
1252 write(iout,'(i3,a3,i4,i5,a6,1pe12.4,a4,i3,i4,3i5,a5,
1253 & 0pf4.1,a5,f3.0,1x,a1,i4,0pf8.2,0pf9.1)')
1254 & indb(n,2),' e ',indb(n,3),indb(n,1),' etot ',econf,' mv ',
1255 & indb(n,5),indb(n,4),indb(n,7),indb(n,8),indb(n,9),
1256 & ' rms ',rmsn(n),' %NC ',pncn(n)*100,
1257 & chacc,iaccn,difmin,denep
1267 c-----------------------------------------
1268 subroutine refresh_bank_worker_tmscore(var)
1269 implicit real*8 (a-h,o-z)
1270 include 'DIMENSIONS'
1271 include 'COMMON.BANK'
1272 include 'COMMON.VAR'
1273 include 'COMMON.CHAIN'
1274 include 'COMMON.SETUP'
1275 include 'COMMON.IOUNITS'
1276 include 'COMMON.CSA'
1278 integer muster(mpi_status_size)
1279 double precision var(maxvar)
1280 double precision dihang_l(mxang,maxres,mxch)
1281 double precision l_diff(mxio)
1283 call mpi_recv(bvar,mxang*maxres*mxch*nbank,mpi_double_precision,
1284 * 0,idreal,CG_COMM,muster,ierr)
1286 call var_to_geom(nvar,var)
1288 dihang_l(1,j,1)=theta(j+1)
1289 dihang_l(2,j,1)=phi(j+2)
1290 dihang_l(3,j,1)=alph(j)
1291 dihang_l(4,j,1)=omeg(j)
1296 call get_diff12(dihang_l,bvar(1,1,1,m),l_diff(m))
1297 if(l_diff(m).lt.difmin) then
1304 call get_diff12(dihang_l,bvar(1,1,1,idmin),a_diff)
1307 cd write(iout,*) idmin,l_diff(idmin),a_diff
1308 call mpi_send(idmin,1,mpi_integer,0,idint,CG_COMM,
1310 call mpi_send(l_diff,nbank,mpi_double_precision,
1311 * 0,idreal,CG_COMM,ierr)
1315 c------------------------------------------------
1316 subroutine print_mv_stat
1317 implicit real*8 (a-h,o-z)
1318 include 'DIMENSIONS'
1319 include 'COMMON.BANK'
1320 include 'COMMON.IOUNITS'
1323 if(nstatnx(i,1).ne.0) then
1325 write(iout,'(a4,i1,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1326 & '## N',i,' total=',nstatnx(i,1),
1327 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1328 & ' %acc',(nstatnx(i,2)+nstatnx(i,3))*100.0/nstatnx(i,1)
1330 write(iout,'(a3,i2,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1331 & '##N',i,' total=',nstatnx(i,1),
1332 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1333 & ' %acc',(nstatnx(i,2)+nstatnx(i,3))*100.0/nstatnx(i,1)
1337 write(iout,'(a4,i1,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1338 & '## N',i,' total=',nstatnx(i,1),
1339 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),
1342 write(iout,'(a3,i2,a7,i4,a7,i4,a5,i4,a5,f5.1)')
1343 & '##N',i,' total=',nstatnx(i,1),
1344 & ' close=',nstatnx(i,2),' far=',nstatnx(i,3),