2 implicit real*8 (a-h,o-z)
9 include 'COMMON.INTERACT'
10 include 'COMMON.IOUNITS'
11 include 'COMMON.DISTFIT'
12 include 'COMMON.SBRIDGE'
13 include 'COMMON.CONTROL'
14 include 'COMMON.FFIELD'
15 include 'COMMON.MINIM'
16 include 'COMMON.CHAIN'
17 double precision time0,time1
18 double precision energy(0:n_ene),ee
19 double precision var(maxvar),var1(maxvar)
21 logical debug,accepted
25 call geom_to_var(nvar,var1)
27 call etotal(energy(0))
30 write(iout,*) 'etot=',0,etot,rms
31 call secondary2(.false.)
33 call write_pdb(0,'first structure',etot)
42 betbol=1.0D0/(1.9858D-3*temp)
45 c phi(jr)=pinorm(phi(jr)+d)
47 call etotal(energy(0))
50 write(iout,*) 'etot=',1,etot0,rms
51 call write_pdb(1,'perturb structure',etot0)
57 phi(jr)=pinorm(phi(jr)+d)
59 call etotal(energy(0))
62 if (etot.lt.etot0) then
66 xxr=ran_number(0.0D0,1.0D0)
67 xxh=betbol*(etot-etot0)
68 if (xxh.lt.50.0D0) then
70 if (xxh.gt.xxr) accepted=.true.
74 c print *,etot0,etot,accepted
78 write(iout,*) 'etot=',i,etot,rms
79 call write_pdb(i,'MC structure',etot)
81 c call geom_to_var(nvar,var1)
82 call sc_move(2,nres-1,1,10d0,nft_sc,etot)
83 call geom_to_var(nvar,var)
84 call minimize(etot,var,iretcode,nfun)
85 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun
86 call var_to_geom(nvar,var)
89 write(iout,*) 'etot mcm=',i,etot,rms
90 call write_pdb(i+1,'MCM structure',etot)
91 call var_to_geom(nvar,var1)
99 c call sc_move(2,nres-1,1,10d0,nft_sc,etot)
100 c call geom_to_var(nvar,var)
103 c call write_pdb(998 ,'sc min',etot)
105 c call minimize(etot,var,iretcode,nfun)
106 c write(iout,*)'------------------------------------------------'
107 c write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun
109 c call var_to_geom(nvar,var)
111 c call write_pdb(999,'full min',etot)
119 implicit real*8 (a-h,o-z)
126 include 'COMMON.INTERACT'
127 include 'COMMON.IOUNITS'
128 include 'COMMON.DISTFIT'
129 include 'COMMON.SBRIDGE'
130 include 'COMMON.CONTROL'
131 include 'COMMON.FFIELD'
132 include 'COMMON.MINIM'
133 include 'COMMON.CHAIN'
134 double precision time0,time1
135 double precision energy(0:n_ene),ee
136 double precision var(maxvar),var1(maxvar)
142 call geom_to_var(nvar,var1)
144 call etotal(energy(0))
146 write(iout,*) nnt,nct,etot
147 call write_pdb(1,'first structure',etot)
148 call secondary2(.true.)
157 call var_to_geom(nvar,var1)
158 write(iout,*) 'N16 test',(jdata(i),i=1,5)
159 call beta_slide(jdata(1),jdata(2),jdata(3),jdata(4),jdata(5)
161 call geom_to_var(nvar,var)
169 call minimize(etot,var,iretcode,nfun)
170 write(iout,*)'------------------------------------------------'
171 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
172 & '+ DIST eval',ieval
179 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
180 & nfun/(time1-time0),' eval/s'
182 call var_to_geom(nvar,var)
184 call write_pdb(ij*100+99,'full min',etot)
194 subroutine test_local
195 implicit real*8 (a-h,o-z)
199 include 'COMMON.INTERACT'
200 include 'COMMON.IOUNITS'
201 double precision time0,time1
202 double precision energy(0:n_ene),ee
203 double precision varia(maxvar)
206 c call geom_to_var(nvar,varia)
207 call write_pdb(1,'first structure',0d0)
209 call etotal(energy(0))
211 write(iout,*) nnt,nct,etot
213 write(iout,*) 'calling sc_move'
214 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
215 write(iout,*) nft_sc,etot
216 call write_pdb(2,'second structure',etot)
218 write(iout,*) 'calling local_move'
219 call local_move_init(.false.)
220 call local_move(24,29,20d0,50d0)
222 call write_pdb(3,'third structure',etot)
224 write(iout,*) 'calling sc_move'
225 call sc_move(24,29,5,10d0,nft_sc,etot)
226 write(iout,*) nft_sc,etot
227 call write_pdb(2,'last structure',etot)
234 implicit real*8 (a-h,o-z)
238 include 'COMMON.INTERACT'
239 include 'COMMON.IOUNITS'
240 double precision time0,time1
241 double precision energy(0:n_ene),ee
242 double precision varia(maxvar)
245 c call geom_to_var(nvar,varia)
246 call write_pdb(1,'first structure',0d0)
248 call etotal(energy(0))
250 write(iout,*) nnt,nct,etot
252 write(iout,*) 'calling sc_move'
254 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
255 write(iout,*) nft_sc,etot
256 call write_pdb(2,'second structure',etot)
258 write(iout,*) 'calling sc_move 2nd time'
260 call sc_move(nnt,nct,5,1d0,nft_sc,etot)
261 write(iout,*) nft_sc,etot
262 call write_pdb(3,'last structure',etot)
265 c--------------------------------------------------------
266 subroutine bgrow(bstrand,nbstrand,in,ind,new)
267 implicit real*8 (a-h,o-z)
269 include 'COMMON.CHAIN'
270 integer bstrand(maxres/3,6)
272 ishift=iabs(bstrand(in,ind+4)-new)
274 print *,'bgrow',bstrand(in,ind+4),new,ishift
279 bstrand(nbstrand,5)=bstrand(nbstrand,1)
281 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
282 if (bstrand(i,5).lt.bstrand(i,6)) then
283 bstrand(i,5)=bstrand(i,5)-ishift
285 bstrand(i,5)=bstrand(i,5)+ishift
290 bstrand(nbstrand,6)=bstrand(nbstrand,2)
292 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
293 if (bstrand(i,6).lt.bstrand(i,5)) then
294 bstrand(i,6)=bstrand(i,6)-ishift
296 bstrand(i,6)=bstrand(i,6)+ishift
307 c------------------------------------------
309 implicit real*8 (a-h,o-z)
315 include 'COMMON.CHAIN'
316 include 'COMMON.IOUNITS'
318 include 'COMMON.CONTROL'
319 include 'COMMON.SBRIDGE'
320 include 'COMMON.FFIELD'
321 include 'COMMON.MINIM'
323 include 'COMMON.DISTFIT'
324 integer if(20,maxres),nif,ifa(20)
325 integer ibc(0:maxres,0:maxres),istrand(20)
326 integer ibd(maxres),ifb(10,2),nifb,lifb(10),lifb0
327 integer itmp(20,maxres)
328 double precision time0,time1
329 double precision energy(0:n_ene),ee
330 double precision varia(maxvar),vorg(maxvar)
332 logical debug,ltest,usedbfrag(maxres/3)
335 integer betasheet(maxres),ibetasheet(maxres),nbetasheet
336 integer bstrand(maxres/3,6),nbstrand
338 c------------------------
341 c------------------------
348 call geom_to_var(nvar,vorg)
349 call secondary2(debug)
351 if (nbfrag.le.1) return
358 nbetasheet=nbetasheet+1
360 bstrand(1,1)=bfrag(1,1)
361 bstrand(1,2)=bfrag(2,1)
362 bstrand(1,3)=nbetasheet
364 bstrand(1,5)=bfrag(1,1)
365 bstrand(1,6)=bfrag(2,1)
366 do i=bfrag(1,1),bfrag(2,1)
367 betasheet(i)=nbetasheet
371 bstrand(2,1)=bfrag(3,1)
372 bstrand(2,2)=bfrag(4,1)
373 bstrand(2,3)=nbetasheet
374 bstrand(2,5)=bfrag(3,1)
375 bstrand(2,6)=bfrag(4,1)
377 if (bfrag(3,1).le.bfrag(4,1)) then
379 do i=bfrag(3,1),bfrag(4,1)
380 betasheet(i)=nbetasheet
385 do i=bfrag(4,1),bfrag(3,1)
386 betasheet(i)=nbetasheet
393 do while (iused_nbfrag.ne.nbfrag)
397 IF (.not.usedbfrag(j)) THEN
399 write (*,*) j,(bfrag(i,j),i=1,4)
401 write (*,'(i4,a3,10i4)') jk,'B',(bstrand(i,jk),i=1,nbstrand)
403 write (*,*) '------------------'
406 if (bfrag(3,j).le.bfrag(4,j)) then
407 do i=bfrag(3,j),bfrag(4,j)
408 if(betasheet(i).eq.nbetasheet) then
410 do k=bfrag(3,j),bfrag(4,j)
411 betasheet(k)=nbetasheet
416 iused_nbfrag=iused_nbfrag+1
417 do k=bfrag(1,j),bfrag(2,j)
418 betasheet(k)=nbetasheet
419 ibetasheet(k)=nbstrand
421 if (bstrand(in,4).lt.0) then
422 bstrand(nbstrand,1)=bfrag(2,j)
423 bstrand(nbstrand,2)=bfrag(1,j)
424 bstrand(nbstrand,3)=nbetasheet
425 bstrand(nbstrand,4)=-nbstrand
426 bstrand(nbstrand,5)=bstrand(nbstrand,1)
427 bstrand(nbstrand,6)=bstrand(nbstrand,2)
428 if(bstrand(in,1).lt.bfrag(4,j)) then
429 call bgrow(bstrand,nbstrand,in,1,bfrag(4,j))
431 bstrand(nbstrand,5)=bstrand(nbstrand,5)+
432 & (bstrand(in,5)-bfrag(4,j))
434 if(bstrand(in,2).gt.bfrag(3,j)) then
435 call bgrow(bstrand,nbstrand,in,2,bfrag(3,j))
437 bstrand(nbstrand,6)=bstrand(nbstrand,6)-
438 & (-bstrand(in,6)+bfrag(3,j))
441 bstrand(nbstrand,1)=bfrag(1,j)
442 bstrand(nbstrand,2)=bfrag(2,j)
443 bstrand(nbstrand,3)=nbetasheet
444 bstrand(nbstrand,4)=nbstrand
445 bstrand(nbstrand,5)=bstrand(nbstrand,1)
446 bstrand(nbstrand,6)=bstrand(nbstrand,2)
447 if(bstrand(in,1).gt.bfrag(3,j)) then
448 call bgrow(bstrand,nbstrand,in,1,bfrag(3,j))
450 bstrand(nbstrand,5)=bstrand(nbstrand,5)-
451 & (-bstrand(in,5)+bfrag(3,j))
453 if(bstrand(in,2).lt.bfrag(4,j)) then
454 call bgrow(bstrand,nbstrand,in,2,bfrag(4,j))
456 bstrand(nbstrand,6)=bstrand(nbstrand,6)+
457 & (bstrand(in,6)-bfrag(4,j))
462 if(betasheet(bfrag(1,j)+i-bfrag(3,j)).eq.nbetasheet) then
463 in=ibetasheet(bfrag(1,j)+i-bfrag(3,j))
464 do k=bfrag(1,j),bfrag(2,j)
465 betasheet(k)=nbetasheet
470 iused_nbfrag=iused_nbfrag+1
471 do k=bfrag(3,1),bfrag(4,1)
472 betasheet(k)=nbetasheet
473 ibetasheet(k)=nbstrand
475 if (bstrand(in,4).lt.0) then
476 bstrand(nbstrand,1)=bfrag(4,j)
477 bstrand(nbstrand,2)=bfrag(3,j)
478 bstrand(nbstrand,3)=nbetasheet
479 bstrand(nbstrand,4)=-nbstrand
480 bstrand(nbstrand,5)=bstrand(nbstrand,1)
481 bstrand(nbstrand,6)=bstrand(nbstrand,2)
482 if(bstrand(in,1).lt.bfrag(2,j)) then
483 call bgrow(bstrand,nbstrand,in,1,bfrag(2,j))
485 bstrand(nbstrand,5)=bstrand(nbstrand,5)+
486 & (bstrand(in,5)-bfrag(2,j))
488 if(bstrand(in,2).gt.bfrag(1,j)) then
489 call bgrow(bstrand,nbstrand,in,2,bfrag(1,j))
491 bstrand(nbstrand,6)=bstrand(nbstrand,6)-
492 & (-bstrand(in,6)+bfrag(1,j))
495 bstrand(nbstrand,1)=bfrag(3,j)
496 bstrand(nbstrand,2)=bfrag(4,j)
497 bstrand(nbstrand,3)=nbetasheet
498 bstrand(nbstrand,4)=nbstrand
499 bstrand(nbstrand,5)=bstrand(nbstrand,1)
500 bstrand(nbstrand,6)=bstrand(nbstrand,2)
501 if(bstrand(in,1).gt.bfrag(1,j)) then
502 call bgrow(bstrand,nbstrand,in,1,bfrag(1,j))
504 bstrand(nbstrand,5)=bstrand(nbstrand,5)-
505 & (-bstrand(in,5)+bfrag(1,j))
507 if(bstrand(in,2).lt.bfrag(2,j)) then
508 call bgrow(bstrand,nbstrand,in,2,bfrag(2,j))
510 bstrand(nbstrand,6)=bstrand(nbstrand,6)+
511 & (bstrand(in,6)-bfrag(2,j))
518 do i=bfrag(4,j),bfrag(3,j)
519 if(betasheet(i).eq.nbetasheet) then
521 do k=bfrag(4,j),bfrag(3,j)
522 betasheet(k)=nbetasheet
527 iused_nbfrag=iused_nbfrag+1
528 do k=bfrag(1,j),bfrag(2,j)
529 betasheet(k)=nbetasheet
530 ibetasheet(k)=nbstrand
532 if (bstrand(in,4).lt.0) then
533 bstrand(nbstrand,1)=bfrag(1,j)
534 bstrand(nbstrand,2)=bfrag(2,j)
535 bstrand(nbstrand,3)=nbetasheet
536 bstrand(nbstrand,4)=nbstrand
537 bstrand(nbstrand,5)=bstrand(nbstrand,1)
538 bstrand(nbstrand,6)=bstrand(nbstrand,2)
539 if(bstrand(in,1).lt.bfrag(3,j)) then
540 call bgrow(bstrand,nbstrand,in,1,bfrag(3,j))
542 bstrand(nbstrand,5)=bstrand(nbstrand,5)-
543 & (bstrand(in,5)-bfrag(3,j))
545 if(bstrand(in,2).gt.bfrag(4,j)) then
546 call bgrow(bstrand,nbstrand,in,2,bfrag(4,j))
548 bstrand(nbstrand,6)=bstrand(nbstrand,6)+
549 & (-bstrand(in,6)+bfrag(4,j))
552 bstrand(nbstrand,1)=bfrag(2,j)
553 bstrand(nbstrand,2)=bfrag(1,j)
554 bstrand(nbstrand,3)=nbetasheet
555 bstrand(nbstrand,4)=-nbstrand
556 bstrand(nbstrand,5)=bstrand(nbstrand,1)
557 bstrand(nbstrand,6)=bstrand(nbstrand,2)
558 if(bstrand(in,1).gt.bfrag(4,j)) then
559 call bgrow(bstrand,nbstrand,in,1,bfrag(4,j))
561 bstrand(nbstrand,5)=bstrand(nbstrand,5)+
562 & (-bstrand(in,5)+bfrag(4,j))
564 if(bstrand(in,2).lt.bfrag(3,j)) then
565 call bgrow(bstrand,nbstrand,in,2,bfrag(3,j))
567 bstrand(nbstrand,6)=bstrand(nbstrand,6)-
568 & (bstrand(in,6)-bfrag(3,j))
573 if(betasheet(bfrag(2,j)-i+bfrag(4,j)).eq.nbetasheet) then
574 in=ibetasheet(bfrag(2,j)-i+bfrag(4,j))
575 do k=bfrag(1,j),bfrag(2,j)
576 betasheet(k)=nbetasheet
581 iused_nbfrag=iused_nbfrag+1
582 do k=bfrag(4,j),bfrag(3,j)
583 betasheet(k)=nbetasheet
584 ibetasheet(k)=nbstrand
586 if (bstrand(in,4).lt.0) then
587 bstrand(nbstrand,1)=bfrag(4,j)
588 bstrand(nbstrand,2)=bfrag(3,j)
589 bstrand(nbstrand,3)=nbetasheet
590 bstrand(nbstrand,4)=nbstrand
591 bstrand(nbstrand,5)=bstrand(nbstrand,1)
592 bstrand(nbstrand,6)=bstrand(nbstrand,2)
593 if(bstrand(in,1).lt.bfrag(2,j)) then
594 call bgrow(bstrand,nbstrand,in,1,bfrag(2,j))
596 bstrand(nbstrand,5)=bstrand(nbstrand,5)-
597 & (bstrand(in,5)-bfrag(2,j))
599 if(bstrand(in,2).gt.bfrag(1,j)) then
600 call bgrow(bstrand,nbstrand,in,2,bfrag(1,j))
602 bstrand(nbstrand,6)=bstrand(nbstrand,6)+
603 & (-bstrand(in,6)+bfrag(1,j))
606 bstrand(nbstrand,1)=bfrag(3,j)
607 bstrand(nbstrand,2)=bfrag(4,j)
608 bstrand(nbstrand,3)=nbetasheet
609 bstrand(nbstrand,4)=-nbstrand
610 bstrand(nbstrand,5)=bstrand(nbstrand,1)
611 bstrand(nbstrand,6)=bstrand(nbstrand,2)
612 if(bstrand(in,1).gt.bfrag(1,j)) then
613 call bgrow(bstrand,nbstrand,in,1,bfrag(1,j))
615 bstrand(nbstrand,5)=bstrand(nbstrand,5)+
616 & (-bstrand(in,5)+bfrag(1,j))
618 if(bstrand(in,2).lt.bfrag(2,j)) then
619 call bgrow(bstrand,nbstrand,in,2,bfrag(2,j))
621 bstrand(nbstrand,6)=bstrand(nbstrand,6)-
622 & (bstrand(in,6)-bfrag(2,j))
636 do while (usedbfrag(j))
641 nbetasheet=nbetasheet+1
642 bstrand(nbstrand,1)=bfrag(1,j)
643 bstrand(nbstrand,2)=bfrag(2,j)
644 bstrand(nbstrand,3)=nbetasheet
645 bstrand(nbstrand,5)=bfrag(1,j)
646 bstrand(nbstrand,6)=bfrag(2,j)
648 bstrand(nbstrand,4)=nbstrand
649 do i=bfrag(1,j),bfrag(2,j)
650 betasheet(i)=nbetasheet
651 ibetasheet(i)=nbstrand
655 bstrand(nbstrand,1)=bfrag(3,j)
656 bstrand(nbstrand,2)=bfrag(4,j)
657 bstrand(nbstrand,3)=nbetasheet
658 bstrand(nbstrand,5)=bfrag(3,j)
659 bstrand(nbstrand,6)=bfrag(4,j)
661 if (bfrag(3,j).le.bfrag(4,j)) then
662 bstrand(nbstrand,4)=nbstrand
663 do i=bfrag(3,j),bfrag(4,j)
664 betasheet(i)=nbetasheet
665 ibetasheet(i)=nbstrand
668 bstrand(nbstrand,4)=-nbstrand
669 do i=bfrag(4,j),bfrag(3,j)
670 betasheet(i)=nbetasheet
671 ibetasheet(i)=nbstrand
675 iused_nbfrag=iused_nbfrag+1
681 write (*,'(i4,a3,10i4)') jk,'A',(bstrand(i,jk),i=1,nbstrand)
688 if (betasheet(i).ne.0) write(*,*) i,betasheet(i),ibetasheet(i)
692 write (*,'(i4,a3,10i4)') j,':',(bstrand(i,j),i=1,nbstrand)
695 c------------------------
699 if(iabs(bstrand(i,5)-bstrand(j,5)).le.5 .or.
700 & iabs(bstrand(i,6)-bstrand(j,6)).le.5 ) then
702 ifb(nifb,1)=bstrand(i,4)
703 ifb(nifb,2)=bstrand(j,4)
710 write (*,'(a3,20i4)') "ifb",i,ifb(i,1),ifb(i,2)
716 write (*,'(a3,20i4)') "ifa",(ifa(i),i=1,nbstrand)
718 nif=iabs(bstrand(1,6)-bstrand(1,5))+1
720 if (iabs(bstrand(j,6)-bstrand(j,5))+1.gt.nif)
721 & nif=iabs(bstrand(j,6)-bstrand(j,5))+1
727 if(j,i)=bstrand(j,6)+(i-1)*sign(1,bstrand(j,5)-bstrand(j,6))
728 if (if(j,i).gt.0) then
729 if(betasheet(if(j,i)).eq.0 .or.
730 & ibetasheet(if(j,i)).ne.iabs(bstrand(j,4))) if(j,i)=0
735 write(*,'(a3,10i4)') 'if ',(if(j,i),j=1,nbstrand)
738 c read (inp,*) (ifa(i),i=1,4)
740 c read (inp,*,err=20,end=20) (if(j,i),j=1,4)
744 c------------------------
749 cccccccccccccccccccccccccccccccccc
751 cccccccccccccccccccccccccccccccccc
755 istrand(is-j+1)=int(ii/is**(is-j))
756 ii=ii-istrand(is-j+1)*is**(is-j)
760 istrand(k)=istrand(k)+1
761 if(istrand(k).gt.isa) istrand(k)=istrand(k)-2*isa-1
765 if(istrand(k).eq.istrand(l).and.k.ne.l.or.
766 & istrand(k).eq.-istrand(l).and.k.ne.l) ltest=.false.
775 & ifb(m,1).eq.istrand(k).and.ifb(m,2).eq.istrand(k+1).or.
776 & ifb(m,2).eq.istrand(k).and.ifb(m,1).eq.istrand(k+1).or.
777 & -ifb(m,1).eq.istrand(k).and.-ifb(m,2).eq.istrand(k+1).or.
778 & -ifb(m,2).eq.istrand(k).and.-ifb(m,1).eq.istrand(k+1))
784 if (mod(isa,2).eq.0) then
786 if (istrand(k).eq.1) ltest=.false.
790 if (istrand(k).eq.1) ltest=.false.
794 IF (ltest.and.lifb0.eq.1) THEN
797 call var_to_geom(nvar,vorg)
799 write (*,'(i5,i10,10i3)') iconf,ig,(istrand(k),k=1,isa)
800 write (iout,'(i5,i10,10i3)') iconf,ig,(istrand(k),k=1,isa)
801 write (linia,'(10i3)') (istrand(k),k=1,isa)
811 if ( sign(1,istrand(i)).eq.sign(1,ifa(iabs(istrand(i)))) ) then
813 itmp(iabs(istrand(i)),j)=if(iabs(ifa(iabs(istrand(i)))),j)
817 itmp(iabs(istrand(i)),j)=if(iabs(ifa(iabs(istrand(i)))),nif-j+1)
823 write(*,*) (itmp(j,i),j=1,4)
827 c ifa(1),ifa(2),ifa(3),ifa(4)
828 c if(1,i),if(2,i),if(3,i),if(4,i)
833 & ifb(m,1).eq.istrand(k).and.ifb(m,2).eq.istrand(k+1).or.
834 & ifb(m,2).eq.istrand(k).and.ifb(m,1).eq.istrand(k+1).or.
835 & -ifb(m,1).eq.istrand(k).and.-ifb(m,2).eq.istrand(k+1).or.
836 & -ifb(m,2).eq.istrand(k).and.-ifb(m,1).eq.istrand(k+1))
844 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+1)),i))=-1
846 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+1)),i))=-2
850 & ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+2)),i))=-3
852 & ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+3)),i))=-4
855 c------------------------
858 c freeze sec.elements
868 do i=bfrag(1,j),bfrag(2,j)
873 if (bfrag(3,j).le.bfrag(4,j)) then
874 do i=bfrag(3,j),bfrag(4,j)
880 do i=bfrag(4,j),bfrag(3,j)
888 do i=hfrag(1,j),hfrag(2,j)
896 c------------------------
897 c generate constrains
905 if ( ibc(i,j).eq.-1 .or. ibc(j,i).eq.-1) then
913 else if ( ibc(i,j).eq.-2 .or. ibc(j,i).eq.-2) then
921 else if ( ibc(i,j).eq.-3 .or. ibc(j,i).eq.-3) then
929 else if ( ibc(i,j).eq.-4 .or. ibc(j,i).eq.-4) then
937 else if ( ibc(i,j).gt.0 ) then
938 d0(ind)=DIST(i,ibc(i,j))
945 else if ( ibc(j,i).gt.0 ) then
946 d0(ind)=DIST(ibc(j,i),j)
960 cd--------------------------
962 write(iout,'(i3,2i4,a3,2i4,f7.2)') (i,ibc(ihpb(i),jhpb(i)),
963 & ibc(jhpb(i),ihpb(i)),' --',
964 & ihpb(i),jhpb(i),dhpb(i),i=1,nhpb)
970 call contact_cp_min(varia,ifun,iconf,linia,debug)
977 call minimize(etot,varia,iretcode,nfun)
978 write(iout,*)'------------------------------------------------'
979 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
987 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
988 & nfun/(time1-time0),' eval/s'
990 write (linia,'(a10,10i3)') 'full_min',(istrand(k),k=1,isa)
991 call var_to_geom(nvar,varia)
993 call write_pdb(900+iconf,linia,etot)
996 call etotal(energy(0))
998 call enerprint(energy(0))
1000 cd call briefout(0,etot)
1001 cd call secondary2(.true.)
1005 cccccccccccccccccccccccccccccccccccc
1008 cccccccccccccccccccccccccccccccccccc
1011 10 write (iout,'(a)') 'Error reading test structure.'
1014 c--------------------------------------------------------
1017 implicit real*8 (a-h,o-z)
1018 include 'DIMENSIONS'
1022 include 'COMMON.GEO'
1023 include 'COMMON.CHAIN'
1024 include 'COMMON.IOUNITS'
1025 include 'COMMON.VAR'
1026 include 'COMMON.CONTROL'
1027 include 'COMMON.SBRIDGE'
1028 include 'COMMON.FFIELD'
1029 include 'COMMON.MINIM'
1031 include 'COMMON.DISTFIT'
1032 integer if(3,maxres),nif
1033 integer ibc(maxres,maxres),istrand(20)
1034 integer ibd(maxres),ifb(10,2),nifb,lifb(10),lifb0
1035 double precision time0,time1
1036 double precision energy(0:n_ene),ee
1037 double precision varia(maxvar)
1043 read (inp,*,err=20,end=20) if(1,i),if(2,i),if(3,i)
1046 write (*,'(a4,3i5)') ('if =',if(1,i),if(2,i),if(3,i),
1050 c------------------------
1051 call secondary2(debug)
1052 c------------------------
1060 c freeze sec.elements and store indexes for beta constrains
1070 do i=bfrag(1,j),bfrag(2,j)
1075 if (bfrag(3,j).le.bfrag(4,j)) then
1076 do i=bfrag(3,j),bfrag(4,j)
1080 ibc(bfrag(1,j)+i-bfrag(3,j),i)=-1
1083 do i=bfrag(4,j),bfrag(3,j)
1087 ibc(bfrag(2,j)-i+bfrag(4,j),i)=-1
1092 do i=hfrag(1,j),hfrag(2,j)
1101 c ---------------- test --------------
1103 if (ibc(if(1,i),if(2,i)).eq.-1) then
1104 ibc(if(1,i),if(2,i))=if(3,i)
1105 ibc(if(1,i),if(3,i))=if(2,i)
1106 else if (ibc(if(2,i),if(1,i)).eq.-1) then
1107 ibc(if(2,i),if(1,i))=0
1108 ibc(if(1,i),if(2,i))=if(3,i)
1109 ibc(if(1,i),if(3,i))=if(2,i)
1111 ibc(if(1,i),if(2,i))=if(3,i)
1112 ibc(if(1,i),if(3,i))=if(2,i)
1118 if (ibc(i,j).ne.0) write(*,'(3i5)') i,j,ibc(i,j)
1121 c------------------------
1127 if ( ibc(i,j).eq.-1 ) then
1135 else if ( ibc(i,j).gt.0 ) then
1136 d0(ind)=DIST(i,ibc(i,j))
1143 else if ( ibc(j,i).gt.0 ) then
1144 d0(ind)=DIST(ibc(j,i),j)
1158 cd--------------------------
1159 write(*,'(i3,2i4,a3,2i4,f7.2)') (i,ibc(ihpb(i),jhpb(i)),
1160 & ibc(jhpb(i),ihpb(i)),' --',
1161 & ihpb(i),jhpb(i),dhpb(i),i=1,nhpb)
1168 call contact_cp_min(varia,ieval,in_pdb,linia,debug)
1175 call minimize(etot,varia,iretcode,nfun)
1176 write(iout,*)'------------------------------------------------'
1177 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
1178 & '+ DIST eval',ieval
1185 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
1186 & nfun/(time1-time0),' eval/s'
1189 call var_to_geom(nvar,varia)
1191 call write_pdb(999,'full min',etot)
1194 call etotal(energy(0))
1196 call enerprint(energy(0))
1198 call briefout(0,etot)
1199 call secondary2(.true.)
1202 10 write (iout,'(a)') 'Error reading test structure.'
1210 implicit real*8 (a-h,o-z)
1211 include 'DIMENSIONS'
1215 include 'COMMON.GEO'
1216 include 'COMMON.CHAIN'
1217 include 'COMMON.IOUNITS'
1218 include 'COMMON.VAR'
1219 include 'COMMON.CONTROL'
1220 include 'COMMON.SBRIDGE'
1221 include 'COMMON.FFIELD'
1222 include 'COMMON.MINIM'
1224 include 'COMMON.DISTFIT'
1227 double precision time0,time1
1228 double precision energy(0:n_ene),ee
1229 double precision theta2(maxres),phi2(maxres),alph2(maxres),
1231 & theta1(maxres),phi1(maxres),alph1(maxres),
1233 double precision varia(maxvar),varia2(maxvar)
1237 read (inp,*,err=10,end=10) if(1,1),if(1,2),if(2,1),if(2,2)
1238 write (iout,'(a4,4i5)') 'if =',if(1,1),if(1,2),if(2,1),if(2,2)
1239 read (inp,*,err=10,end=10) (theta2(i),i=3,nres)
1240 read (inp,*,err=10,end=10) (phi2(i),i=4,nres)
1241 read (inp,*,err=10,end=10) (alph2(i),i=2,nres-1)
1242 read (inp,*,err=10,end=10) (omeg2(i),i=2,nres-1)
1244 theta2(i)=deg2rad*theta2(i)
1245 phi2(i)=deg2rad*phi2(i)
1246 alph2(i)=deg2rad*alph2(i)
1247 omeg2(i)=deg2rad*omeg2(i)
1261 c------------------------
1266 do i=if(j,1),if(j,2)
1272 call geom_to_var(nvar,varia)
1273 call write_pdb(1,'first structure',0d0)
1275 call secondary(.true.)
1277 call secondary2(.true.)
1280 if ( (bfrag(3,j).lt.bfrag(4,j) .or.
1281 & bfrag(4,j)-bfrag(2,j).gt.4) .and.
1282 & bfrag(2,j)-bfrag(1,j).gt.3 ) then
1285 if (bfrag(3,j).lt.bfrag(4,j)) then
1286 write(iout,'(a6,i3,a1,i3,a1,i3,a1,i3)')
1287 & "select",bfrag(1,j)-1,"-",bfrag(2,j)-1
1288 & ,",",bfrag(3,j)-1,"-",bfrag(4,j)-1
1290 write(iout,'(a6,i3,a1,i3,a1,i3,a1,i3)')
1291 & "select",bfrag(1,j)-1,"-",bfrag(2,j)-1
1292 & ,",",bfrag(4,j)-1,"-",bfrag(3,j)-1
1305 call geom_to_var(nvar,varia2)
1306 call write_pdb(2,'second structure',0d0)
1310 c-------------------------------------------------------
1313 call contact_cp(varia,varia2,iff,ifun,7)
1320 call minimize(etot,varia,iretcode,nfun)
1321 write(iout,*)'------------------------------------------------'
1322 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
1323 & '+ DIST eval',ifun
1330 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
1331 & nfun/(time1-time0),' eval/s'
1334 call var_to_geom(nvar,varia)
1336 call write_pdb(999,'full min',etot)
1339 call etotal(energy(0))
1341 call enerprint(energy(0))
1343 call briefout(0,etot)
1346 10 write (iout,'(a)') 'Error reading test structure.'
1350 c-------------------------------------------------
1351 c-------------------------------------------------
1353 subroutine secondary(lprint)
1354 implicit real*8 (a-h,o-z)
1355 include 'DIMENSIONS'
1356 include 'COMMON.CHAIN'
1357 include 'COMMON.IOUNITS'
1358 include 'COMMON.DISTFIT'
1360 integer ncont,icont(2,maxres*maxres/2),isec(maxres,3)
1361 logical lprint,not_done
1362 real dcont(maxres*maxres/2),d
1367 double precision xpi(3),xpj(3)
1372 cd call write_pdb(99,'sec structure',0d0)
1384 xpi(k)=0.5d0*(c(k,i-1)+c(k,i))
1388 xpj(k)=0.5d0*(c(k,j-1)+c(k,j))
1390 cd d = (c(1,i)-c(1,j))*(c(1,i)-c(1,j)) +
1391 cd & (c(2,i)-c(2,j))*(c(2,i)-c(2,j)) +
1392 cd & (c(3,i)-c(3,j))*(c(3,i)-c(3,j))
1393 cd print *,'CA',i,j,d
1394 d = (xpi(1)-xpj(1))*(xpi(1)-xpj(1)) +
1395 & (xpi(2)-xpj(2))*(xpi(2)-xpj(2)) +
1396 & (xpi(3)-xpj(3))*(xpi(3)-xpj(3))
1397 if ( d.lt.rcomp*rcomp) then
1401 dcont(ncont)=sqrt(d)
1407 write (iout,'(a)') '#PP contact map distances:'
1409 write (iout,'(3i4,f10.5)')
1410 & i,icont(1,i),icont(2,i),dcont(i)
1414 c finding parallel beta
1415 cd write (iout,*) '------- looking for parallel beta -----------'
1421 if(dcont(i).le.rbeta .and. j1-i1.gt.4 .and.
1422 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
1423 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
1424 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
1425 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
1426 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
1430 cd write (iout,*) i1,j1,dcont(i)
1436 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)
1437 & .and. dcont(j).le.rbeta .and.
1438 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
1439 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
1440 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
1441 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
1442 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
1447 cd write (iout,*) i1,j1,dcont(j),not_done
1451 if (i1-ii1.gt.1) then
1455 if(lprint)write(iout,*)'parallel beta',nbeta,ii1,i1,jj1,j1
1464 isec(ij,1)=isec(ij,1)+1
1465 isec(ij,1+isec(ij,1))=nbeta
1468 isec(ij,1)=isec(ij,1)+1
1469 isec(ij,1+isec(ij,1))=nbeta
1474 if (nbeta.le.9) then
1475 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
1476 & "DefPropRes 'strand",nstrand,
1477 & "' 'num = ",ii1-1,"..",i1-1,"'"
1479 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
1480 & "DefPropRes 'strand",nstrand,
1481 & "' 'num = ",ii1-1,"..",i1-1,"'"
1484 if (nbeta.le.9) then
1485 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
1486 & "DefPropRes 'strand",nstrand,
1487 & "' 'num = ",jj1-1,"..",j1-1,"'"
1489 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
1490 & "DefPropRes 'strand",nstrand,
1491 & "' 'num = ",jj1-1,"..",j1-1,"'"
1493 write(12,'(a8,4i4)')
1494 & "SetNeigh",ii1-1,i1-1,jj1-1,j1-1
1500 c finding antiparallel beta
1501 cd write (iout,*) '--------- looking for antiparallel beta ---------'
1506 if (dcont(i).le.rbeta.and.
1507 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
1508 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
1509 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
1510 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
1511 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
1515 cd write (iout,*) i1,j1,dcont(i)
1522 if (i1.eq.icont(1,j).and.j1.eq.icont(2,j) .and.
1523 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
1524 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
1525 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
1526 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
1527 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
1528 & .and. dcont(j).le.rbeta ) goto 6
1532 cd write (iout,*) i1,j1,dcont(j),not_done
1536 if (i1-ii1.gt.1) then
1537 if(lprint)write (iout,*)'antiparallel beta',
1538 & nbeta,ii1-1,i1,jj1,j1-1
1541 bfrag(1,nbfrag)=max0(ii1-1,1)
1544 bfrag(4,nbfrag)=max0(j1-1,1)
1549 isec(ij,1)=isec(ij,1)+1
1550 isec(ij,1+isec(ij,1))=nbeta
1554 isec(ij,1)=isec(ij,1)+1
1555 isec(ij,1+isec(ij,1))=nbeta
1561 if (nstrand.le.9) then
1562 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
1563 & "DefPropRes 'strand",nstrand,
1564 & "' 'num = ",ii1-2,"..",i1-1,"'"
1566 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
1567 & "DefPropRes 'strand",nstrand,
1568 & "' 'num = ",ii1-2,"..",i1-1,"'"
1571 if (nstrand.le.9) then
1572 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
1573 & "DefPropRes 'strand",nstrand,
1574 & "' 'num = ",j1-2,"..",jj1-1,"'"
1576 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
1577 & "DefPropRes 'strand",nstrand,
1578 & "' 'num = ",j1-2,"..",jj1-1,"'"
1580 write(12,'(a8,4i4)')
1581 & "SetNeigh",ii1-2,i1-1,jj1-1,j1-2
1587 if (nstrand.gt.0.and.lprint) then
1588 write(12,'(a27,$)') "DefPropRes 'sheet' 'strand1"
1591 write(12,'(a9,i1,$)') " | strand",i
1593 write(12,'(a9,i2,$)') " | strand",i
1596 write(12,'(a1)') "'"
1600 c finding alpha or 310 helix
1606 if (j1.eq.i1+3.and.dcont(i).le.r310
1607 & .or.j1.eq.i1+4.and.dcont(i).le.ralfa ) then
1608 cd if (j1.eq.i1+3) write (iout,*) "found 1-4 ",i1,j1,dcont(i)
1609 cd if (j1.eq.i1+4) write (iout,*) "found 1-5 ",i1,j1,dcont(i)
1612 if (isec(ii1,1).eq.0) then
1621 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
1625 cd write (iout,*) i1,j1,not_done
1628 if (j1-ii1.gt.4) then
1630 cd write (iout,*)'helix',nhelix,ii1,j1
1634 hfrag(2,nhfrag)=max0(j1-1,1)
1640 write (iout,'(a6,i3,2i4)') "Helix",nhelix,ii1-1,j1-2
1641 if (nhelix.le.9) then
1642 write(12,'(a17,i1,a9,i3,a2,i3,a1)')
1643 & "DefPropRes 'helix",nhelix,
1644 & "' 'num = ",ii1-1,"..",j1-2,"'"
1646 write(12,'(a17,i2,a9,i3,a2,i3,a1)')
1647 & "DefPropRes 'helix",nhelix,
1648 & "' 'num = ",ii1-1,"..",j1-2,"'"
1655 if (nhelix.gt.0.and.lprint) then
1656 write(12,'(a26,$)') "DefPropRes 'helix' 'helix1"
1658 if (nhelix.le.9) then
1659 write(12,'(a8,i1,$)') " | helix",i
1661 write(12,'(a8,i2,$)') " | helix",i
1664 write(12,'(a1)') "'"
1668 write(12,'(a37)') "DefPropRes 'coil' '! (helix | sheet)'"
1669 write(12,'(a20)') "XMacStand ribbon.mac"
1675 c----------------------------------------------------------------------------
1677 subroutine write_pdb(npdb,titelloc,ee)
1678 implicit real*8 (a-h,o-z)
1679 include 'DIMENSIONS'
1680 include 'COMMON.IOUNITS'
1681 character*50 titelloc1
1682 character*(*) titelloc
1691 if (npdb.lt.1000) then
1692 call numstr(npdb,zahl)
1693 open(ipdb,file=prefix(:lenpre)//'@@'//zahl//'.pdb')
1695 if (npdb.lt.10000) then
1696 write(liczba5,'(i1,i4)') 0,npdb
1698 write(liczba5,'(i5)') npdb
1700 open(ipdb,file=prefix(:lenpre)//'@@'//liczba5//'.pdb')
1702 call pdbout(ee,titelloc1,ipdb)
1707 c-----------------------------------------------------------
1708 subroutine contact_cp2(var,var2,iff,ieval,in_pdb)
1709 implicit real*8 (a-h,o-z)
1710 include 'DIMENSIONS'
1714 include 'COMMON.SBRIDGE'
1715 include 'COMMON.FFIELD'
1716 include 'COMMON.IOUNITS'
1717 include 'COMMON.DISTFIT'
1718 include 'COMMON.VAR'
1719 include 'COMMON.CHAIN'
1720 include 'COMMON.MINIM'
1724 double precision var(maxvar),var2(maxvar)
1725 double precision time0,time1
1726 integer iff(maxres),ieval
1727 double precision theta1(maxres),phi1(maxres),alph1(maxres),
1731 call var_to_geom(nvar,var)
1738 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
1760 call var_to_geom(nvar,var2)
1763 if ( iff(i).eq.1 ) then
1774 NY=((NRES-4)*(NRES-5))/2
1775 call distfit(.true.,200)
1786 call geom_to_var(nvar,var)
1787 call minimize(etot,var,iretcode,nfun)
1788 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
1790 call var_to_geom(nvar,var)
1796 if (iff(1).eq.1) then
1802 if ( iwsk.eq.0.and.iff(i-1).eq.0.and.iff(i).eq.1 ) then
1807 if ( iwsk.eq.1.and.iff(i-1).eq.1.and.iff(i).eq.0 ) then
1813 if (iff(nres).eq.1) then
1819 cd write(linia,'(a6,i3,a1,i3,a1,i3,a1,i3)')
1820 cd & "select",ij(1),"-",ij(2),
1821 cd & ",",ij(3),"-",ij(4)
1822 cd call write_pdb(in_pdb,linia,etot)
1828 call minimize(etot,var,iretcode,nfun)
1838 c-----------------------------------------------------------
1839 subroutine contact_cp(var,var2,iff,ieval,in_pdb)
1840 implicit real*8 (a-h,o-z)
1841 include 'DIMENSIONS'
1842 include 'COMMON.SBRIDGE'
1843 include 'COMMON.FFIELD'
1844 include 'COMMON.IOUNITS'
1845 include 'COMMON.DISTFIT'
1846 include 'COMMON.VAR'
1847 include 'COMMON.CHAIN'
1848 include 'COMMON.MINIM'
1852 double precision energy(0:n_ene)
1853 double precision var(maxvar),var2(maxvar)
1854 double precision time0,time1
1855 integer iff(maxres),ieval
1856 double precision theta1(maxres),phi1(maxres),alph1(maxres),
1862 if (ieval.eq.-1) debug=.true.
1866 c store selected dist. constrains from 1st structure
1869 c Intercept NaNs in the coordinates
1870 c write(iout,*) (var(i),i=1,nvar)
1875 if (x_sum.ne.x_sum) then
1876 write(iout,*)" *** contact_cp : Found NaN in coordinates"
1878 print *," *** contact_cp : Found NaN in coordinates"
1884 call var_to_geom(nvar,var)
1891 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
1914 c freeze sec.elements from 2nd structure
1922 call var_to_geom(nvar,var2)
1923 call secondary2(debug)
1925 do i=bfrag(1,j),bfrag(2,j)
1930 if (bfrag(3,j).le.bfrag(4,j)) then
1931 do i=bfrag(3,j),bfrag(4,j)
1937 do i=bfrag(4,j),bfrag(3,j)
1945 do i=hfrag(1,j),hfrag(2,j)
1954 c copy selected res from 1st to 2nd structure
1958 if ( iff(i).eq.1 ) then
1968 c prepare description in linia variable
1972 if (iff(1).eq.1) then
1978 if ( iwsk.eq.0.and.iff(i-1).eq.0.and.iff(i).eq.1 ) then
1983 if ( iwsk.eq.1.and.iff(i-1).eq.1.and.iff(i).eq.0 ) then
1989 if (iff(nres).eq.1) then
1994 write(linia,'(a6,i3,a1,i3,a1,i3,a1,i3)')
1995 & "SELECT",ij(1)-1,"-",ij(2)-1,
1996 & ",",ij(3)-1,"-",ij(4)-1
2002 call contact_cp_min(var,ieval,in_pdb,linia,debug)
2007 subroutine contact_cp_min(var,ieval,in_pdb,linia,debug)
2009 c input : theta,phi,alph,omeg,in_pdb,linia,debug
2010 c output : var,ieval
2012 implicit real*8 (a-h,o-z)
2013 include 'DIMENSIONS'
2017 include 'COMMON.SBRIDGE'
2018 include 'COMMON.FFIELD'
2019 include 'COMMON.IOUNITS'
2020 include 'COMMON.DISTFIT'
2021 include 'COMMON.VAR'
2022 include 'COMMON.CHAIN'
2023 include 'COMMON.MINIM'
2027 double precision energy(0:n_ene)
2028 double precision var(maxvar)
2029 double precision time0,time1
2030 integer ieval,info(3)
2031 logical debug,fail,check_var,reduce,change
2033 write(iout,'(a20,i6,a20)')
2034 & '------------------',in_pdb,'-------------------'
2038 call write_pdb(1000+in_pdb,'combined structure',0d0)
2047 c run optimization of distances
2049 c uses d0(),w() and mask() for frozen 2D
2051 ctest---------------------------------------------
2053 ctest NY=((NRES-4)*(NRES-5))/2
2054 ctest call distfit(debug,5000)
2086 call geom_to_var(nvar,var)
2087 cde change=reduce(var)
2088 if (check_var(var,info)) then
2089 write(iout,*) 'cp_min error in input'
2090 print *,'cp_min error in input'
2094 cd call etotal(energy(0))
2095 cd call enerprint(energy(0))
2103 cdtest call minimize(etot,var,iretcode,nfun)
2104 cdtest write(iout,*)'SUMSL return code is',iretcode,' eval SDIST',nfun
2111 cd call etotal(energy(0))
2112 cd call enerprint(energy(0))
2131 ctest--------------------------------------------------
2139 write (iout,'(a,f6.2,a)')' Time for distfit ',time1-time0,' sec'
2140 call write_pdb(2000+in_pdb,'distfit structure',0d0)
2149 c run soft pot. optimization
2151 c nhpb,ihpb(),jhpb(),forcon(),dhpb() and hpb_partition
2153 c mask_phi(),mask_theta(),mask_side(),mask_r
2159 cde change=reduce(var)
2160 cde if (check_var(var,info)) write(iout,*) 'error before soft'
2166 call minimize(etot,var,iretcode,nfun)
2168 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
2174 write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,
2175 & nfun/(time1-time0),' SOFT eval/s'
2177 call var_to_geom(nvar,var)
2179 call write_pdb(3000+in_pdb,'soft structure',etot)
2182 c run full UNRES optimization with constrains and frozen 2D
2183 c the same variables as soft pot. optimizatio
2189 c check overlaps before calling full UNRES minim
2191 call var_to_geom(nvar,var)
2193 call etotal(energy(0))
2195 write(iout,*) 'N7 ',energy(0)
2196 if (energy(0).ne.energy(0)) then
2197 write(iout,*) 'N7 error - gives NaN',energy(0)
2201 if (energy(1).eq.1.0d20) then
2202 write (iout,'(a,1pe14.5)')'#N7_OVERLAP evdw=1d20',energy(1)
2203 call overlap_sc(fail)
2205 call etotal(energy(0))
2207 write (iout,'(a,1pe14.5)')'#N7_OVERLAP evdw after',energy(1)
2219 cdte time0=MPI_WTIME()
2220 cde change=reduce(var)
2221 cde if (check_var(var,info)) then
2222 cde write(iout,*) 'error before mask dist'
2223 cde call var_to_geom(nvar,var)
2225 cde call write_pdb(10000+in_pdb,'before mask dist',etot)
2227 cdte call minimize(etot,var,iretcode,nfun)
2228 cdte write(iout,*)'SUMSL MASK DIST return code is',iretcode,
2229 cdte & ' eval ',nfun
2230 cdte ieval=ieval+nfun
2232 cdte time1=MPI_WTIME()
2233 cdte write (iout,'(a,f6.2,f8.2,a)')
2234 cdte & ' Time for mask dist min.',time1-time0,
2235 cdte & nfun/(time1-time0),' eval/s'
2236 cdte call flush(iout)
2238 call var_to_geom(nvar,var)
2240 call write_pdb(4000+in_pdb,'mask dist',etot)
2243 c switch off freezing of 2D and
2244 c run full UNRES optimization with constrains
2252 cde change=reduce(var)
2253 cde if (check_var(var,info)) then
2254 cde write(iout,*) 'error before dist'
2255 cde call var_to_geom(nvar,var)
2257 cde call write_pdb(11000+in_pdb,'before dist',etot)
2260 call minimize(etot,var,iretcode,nfun)
2262 cde change=reduce(var)
2263 cde if (check_var(var,info)) then
2264 cde write(iout,*) 'error after dist',ico
2265 cde call var_to_geom(nvar,var)
2267 cde call write_pdb(12000+in_pdb+ico*1000,'after dist',etot)
2269 write(iout,*)'SUMSL DIST return code is',iretcode,' eval ',nfun
2277 write (iout,'(a,f6.2,f8.2,a)')' Time for dist min.',time1-time0,
2278 & nfun/(time1-time0),' eval/s'
2279 cde call etotal(energy(0))
2280 cde write(iout,*) 'N7 after dist',energy(0)
2284 call var_to_geom(nvar,var)
2286 call write_pdb(in_pdb,linia,etot)
2298 c--------------------------------------------------------
2300 implicit real*8 (a-h,o-z)
2301 include 'DIMENSIONS'
2305 include 'COMMON.GEO'
2306 include 'COMMON.CHAIN'
2307 include 'COMMON.IOUNITS'
2308 include 'COMMON.VAR'
2309 include 'COMMON.CONTROL'
2310 include 'COMMON.SBRIDGE'
2311 include 'COMMON.FFIELD'
2312 include 'COMMON.MINIM'
2313 include 'COMMON.INTERACT'
2315 include 'COMMON.DISTFIT'
2317 double precision time0,time1
2318 double precision energy(0:n_ene),ee
2319 double precision var(maxvar)
2322 logical debug,ltest,fail
2331 c------------------------
2333 c freeze sec.elements
2343 do i=bfrag(1,j),bfrag(2,j)
2348 if (bfrag(3,j).le.bfrag(4,j)) then
2349 do i=bfrag(3,j),bfrag(4,j)
2355 do i=bfrag(4,j),bfrag(3,j)
2363 do i=hfrag(1,j),hfrag(2,j)
2375 c store dist. constrains
2379 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
2384 dhpb(nhpb)=DIST(i,j)
2392 call write_pdb(100+in_pdb,'input reg. structure',0d0)
2402 c run soft pot. optimization
2408 call geom_to_var(nvar,var)
2414 call minimize(etot,var,iretcode,nfun)
2416 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
2422 write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,
2423 & nfun/(time1-time0),' SOFT eval/s'
2425 call var_to_geom(nvar,var)
2427 call write_pdb(300+in_pdb,'soft structure',etot)
2430 c run full UNRES optimization with constrains and frozen 2D
2431 c the same variables as soft pot. optimizatio
2442 call minimize(etot,var,iretcode,nfun)
2443 write(iout,*)'SUMSL MASK DIST return code is',iretcode,
2452 write (iout,'(a,f6.2,f8.2,a)')
2453 & ' Time for mask dist min.',time1-time0,
2454 & nfun/(time1-time0),' eval/s'
2456 call var_to_geom(nvar,var)
2458 call write_pdb(400+in_pdb,'mask & dist',etot)
2461 c switch off constrains and
2462 c run full UNRES optimization with frozen 2D
2480 call minimize(etot,var,iretcode,nfun)
2481 write(iout,*)'SUMSL MASK return code is',iretcode,' eval ',nfun
2489 write (iout,'(a,f6.2,f8.2,a)')' Time for mask min.',time1-time0,
2490 & nfun/(time1-time0),' eval/s'
2494 call var_to_geom(nvar,var)
2496 call write_pdb(500+in_pdb,'mask 2d frozen',etot)
2503 c run full UNRES optimization with constrains and NO frozen 2D
2513 wstrain=wstrain0/ico
2520 call minimize(etot,var,iretcode,nfun)
2521 write(iout,'(a10,f6.3,a14,i3,a6,i5)')
2522 & ' SUMSL DIST',wstrain,' return code is',iretcode,
2531 write (iout,'(a,f6.2,f8.2,a)')
2532 & ' Time for dist min.',time1-time0,
2533 & nfun/(time1-time0),' eval/s'
2535 call var_to_geom(nvar,var)
2537 call write_pdb(600+in_pdb+ico,'dist cons',etot)
2556 call minimize(etot,var,iretcode,nfun)
2557 write(iout,*)'------------------------------------------------'
2558 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
2559 & '+ DIST eval',ieval
2566 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
2567 & nfun/(time1-time0),' eval/s'
2570 call var_to_geom(nvar,var)
2572 call write_pdb(999,'full min',etot)
2579 subroutine beta_slide(i1,i2,i3,i4,i5,ieval,ij)
2580 implicit real*8 (a-h,o-z)
2581 include 'DIMENSIONS'
2585 include 'COMMON.GEO'
2586 include 'COMMON.VAR'
2587 include 'COMMON.INTERACT'
2588 include 'COMMON.IOUNITS'
2589 include 'COMMON.DISTFIT'
2590 include 'COMMON.SBRIDGE'
2591 include 'COMMON.CONTROL'
2592 include 'COMMON.FFIELD'
2593 include 'COMMON.MINIM'
2594 include 'COMMON.CHAIN'
2595 double precision time0,time1
2596 double precision energy(0:n_ene),ee
2597 double precision var(maxvar)
2598 integer jdata(5),isec(maxres)
2606 call secondary2(.false.)
2612 do i=bfrag(1,j),bfrag(2,j)
2615 do i=bfrag(4,j),bfrag(3,j),sign(1,bfrag(3,j)-bfrag(4,j))
2620 do i=hfrag(1,j),hfrag(2,j)
2626 c cut strands at the ends
2628 if (jdata(2)-jdata(1).gt.3) then
2631 if (jdata(3).lt.jdata(4)) then
2641 cv call etotal(energy(0))
2643 cv write(iout,*) nnt,nct,etot
2644 cv call write_pdb(ij*100,'first structure',etot)
2645 cv write(iout,*) 'N16 test',(jdata(i),i=1,5)
2647 c------------------------
2648 c generate constrains
2651 if(ishift.eq.0) ishift=-2
2654 do i=jdata(1),jdata(2)
2656 if(jdata(4).gt.jdata(3))then
2657 do j=jdata(3)+i-jdata(1)-2,jdata(3)+i-jdata(1)+2
2659 cd print *,i,j,j+ishift
2664 dhpb(nhpb)=DIST(i,j+ishift)
2667 do j=jdata(3)-i+jdata(1)+2,jdata(3)-i+jdata(1)-2,-1
2669 cd print *,i,j,j+ishift
2674 dhpb(nhpb)=DIST(i,j+ishift)
2681 if(isec(i).gt.0.or.isec(j).gt.0) then
2687 dhpb(nhpb)=DIST(i,j)
2694 call geom_to_var(nvar,var)
2701 wstrain=wstrain0/ico
2703 call minimize(etot,var,iretcode,nfun)
2704 write(iout,'(a10,f6.3,a14,i3,a6,i5)')
2705 & ' SUMSL DIST',wstrain,' return code is',iretcode,
2719 call sc_move(nnt,nct,100,100d0,nft_sc,etot)
2722 cv call etotal(energy(0))
2724 cv call write_pdb(ij*100+10,'sc_move',etot)
2726 cd print *,nft_sc,etot
2731 subroutine beta_zip(i1,i2,ieval,ij)
2732 implicit real*8 (a-h,o-z)
2733 include 'DIMENSIONS'
2737 include 'COMMON.GEO'
2738 include 'COMMON.VAR'
2739 include 'COMMON.INTERACT'
2740 include 'COMMON.IOUNITS'
2741 include 'COMMON.DISTFIT'
2742 include 'COMMON.SBRIDGE'
2743 include 'COMMON.CONTROL'
2744 include 'COMMON.FFIELD'
2745 include 'COMMON.MINIM'
2746 include 'COMMON.CHAIN'
2747 double precision time0,time1
2748 double precision energy(0:n_ene),ee
2749 double precision var(maxvar)
2753 cv call etotal(energy(0))
2755 cv write(test,'(2i5)') i1,i2
2756 cv call write_pdb(ij*100,test,etot)
2757 cv write(iout,*) 'N17 test',i1,i2,etot,ij
2760 c generate constrains
2771 call geom_to_var(nvar,var)
2777 wstrain=wstrain0/ico
2778 call minimize(etot,var,iretcode,nfun)
2779 write(iout,'(a10,f6.3,a14,i3,a6,i5)')
2780 & ' SUMSL DIST',wstrain,' return code is',iretcode,
2783 c do not comment the next line
2784 call var_to_geom(nvar,var)
2786 cv call write_pdb(ij*100+ico,'dist cons',etot)
2794 cv call etotal(energy(0))
2796 cv write(iout,*) 'N17 test end',i1,i2,etot,ij