2 !-----------------------------------------------------------------------------
8 #if .not. defined WHAM_RUN && .not. defined CLUSTER
14 use control, only: hpb_partition
16 use minimm, only: sc_move, minimize
19 !-----------------------------------------------------------------------------
22 !-----------------------------------------------------------------------------
24 #if .not. defined WHAM_RUN && .not. defined CLUSTER
25 !-----------------------------------------------------------------------------
27 !-----------------------------------------------------------------------------
28 subroutine contact(lprint,ncont,icont,co)
30 use geometry, only:dist
31 ! implicit real*8 (a-h,o-z)
32 ! include 'DIMENSIONS'
33 ! include 'COMMON.IOUNITS'
34 ! include 'COMMON.CHAIN'
35 ! include 'COMMON.INTERACT'
36 ! include 'COMMON.FFIELD'
37 ! include 'COMMON.NAMES'
38 real(kind=8) :: facont=1.569D0 ! facont = (2/(1-sqrt(1-1/4)))**(1/6)
40 integer,dimension(2,100*nres) :: icont!(2,100*nres) !(2,maxcont) (maxcont=12*maxres)
43 real(kind=8) :: co,rcomp
44 integer :: kkk,i,j,i1,i2,it1,it2,iti,itj,inum,jnum
48 do i=nnt_molec(1)+kkk,nct_molec(1)
49 iti=iabs(itype(i,molnum(i)))
50 if (molnum(i).lt.3) then
57 itj=iabs(itype(j,molnum(i)))
58 if (molnum(j).lt.3) then
64 ! rcomp=sigmaii(iti,itj)+1.0D0
65 rcomp=facont*sigmaii(iti,itj)
67 ! rcomp=sigma(iti,itj)+1.0D0
68 rcomp=facont*sigma(iti,itj)
71 ! print *,'rcomp=',rcomp,' dist=',dist(nres+i,nres+j)
72 if (dist(inum,jnum).lt.rcomp) then
74 if (ncont.gt.nres*100) ncont=nres*100
81 write (iout,'(a)') 'Contact map:'
87 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
88 i,restyp(it1,1),i1,restyp(it2,1),i2
93 co = co + dfloat(iabs(icont(1,i)-icont(2,i)))
95 co = co / (nres*ncont)
97 end subroutine contact
98 !-----------------------------------------------------------------------------
99 real(kind=8) function contact_fract(ncont,ncont_ref,icont,icont_ref)
101 ! implicit real*8 (a-h,o-z)
102 ! include 'DIMENSIONS'
103 ! include 'COMMON.IOUNITS'
104 integer :: ncont,ncont_ref
105 integer,dimension(2,100*nres) :: icont,icont_ref !(2,100*nres) (2,maxcont) (maxcont=12*maxres)
107 integer :: i,j,nmatch
109 ! print *,'ncont=',ncont,' ncont_ref=',ncont_ref
110 ! write (iout,'(20i4)') (icont_ref(1,i),i=1,ncont_ref)
111 ! write (iout,'(20i4)') (icont_ref(2,i),i=1,ncont_ref)
112 ! write (iout,'(20i4)') (icont(1,i),i=1,ncont)
113 ! write (iout,'(20i4)') (icont(2,i),i=1,ncont)
116 if (icont(1,i).eq.icont_ref(1,j) .and. &
117 icont(2,i).eq.icont_ref(2,j)) nmatch=nmatch+1
120 ! print *,' nmatch=',nmatch
121 ! contact_fract=dfloat(nmatch)/dfloat(max0(ncont,ncont_ref))
122 contact_fract=dfloat(nmatch)/dfloat(ncont_ref)
124 end function contact_fract
125 !-----------------------------------------------------------------------------
126 real(kind=8) function contact_fract_nn(ncont,ncont_ref,icont,icont_ref)
128 ! implicit real*8 (a-h,o-z)
129 ! include 'DIMENSIONS'
130 ! include 'COMMON.IOUNITS'
131 integer :: ncont,ncont_ref
132 integer,dimension(2,100*nres) :: icont,icont_ref !(2,100*nres) (2,maxcont) (maxcont=12*maxres)
134 integer :: i,j,nmatch
136 ! print *,'ncont=',ncont,' ncont_ref=',ncont_ref
137 ! write (iout,'(20i4)') (icont_ref(1,i),i=1,ncont_ref)
138 ! write (iout,'(20i4)') (icont_ref(2,i),i=1,ncont_ref)
139 ! write (iout,'(20i4)') (icont(1,i),i=1,ncont)
140 ! write (iout,'(20i4)') (icont(2,i),i=1,ncont)
143 if (icont(1,i).eq.icont_ref(1,j) .and. &
144 icont(2,i).eq.icont_ref(2,j)) nmatch=nmatch+1
147 ! print *,' nmatch=',nmatch
148 ! contact_fract=dfloat(nmatch)/dfloat(max0(ncont,ncont_ref))
149 contact_fract_nn=dfloat(ncont-nmatch)/dfloat(ncont)
151 end function contact_fract_nn
152 !-----------------------------------------------------------------------------
153 subroutine hairpin(lprint,nharp,iharp)
155 use geometry, only:dist
156 ! implicit real*8 (a-h,o-z)
157 ! include 'DIMENSIONS'
158 ! include 'COMMON.IOUNITS'
159 ! include 'COMMON.CHAIN'
160 ! include 'COMMON.INTERACT'
161 ! include 'COMMON.FFIELD'
162 ! include 'COMMON.NAMES'
164 integer,dimension(:,:),allocatable :: icont !(2,maxcont) (maxcont=12*maxres)
166 integer,dimension(4,nres) :: iharp !(4,nres/3)(4,maxres/3)
167 logical :: lprint,not_done
168 real(kind=8) :: rcomp=6.0d0
170 integer :: i,j,kkk,k,i1,i2,it1,it2,j1,ii1,jj1
171 if (.not.allocated(icont)) then
172 allocate(icont(2,100*nres_molec(1)+1))
176 ! print *,'nnt=',nnt,' nct=',nct
177 do i=nnt_molec(1),nct_molec(1)-3
179 c(k,2*nres+1)=0.5d0*(c(k,i)+c(k,i+1))
183 c(k,2*nres+2)=0.5d0*(c(k,j)+c(k,j+1))
185 if (dist(2*nres+1,2*nres+2).lt.rcomp) then
193 write (iout,'(a)') 'PP contact map:'
199 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
200 i,restyp(it1,1),i1,restyp(it2,1),i2
208 if (j1.eq.i1+2 .and. i1.gt.nnt .and. j1.lt.nct) then
209 ! write (iout,*) "found turn at ",i1,j1
217 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
221 ! write (iout,*) i1,j1,not_done
231 ! write (iout,*)'nharp',nharp,' iharp',(iharp(k,nharp),k=1,4)
236 ! write (iout,*)'i',i,' iharp',(iharp(k,i),k=1,4)
239 write (iout,*) "Hairpins:"
246 write (iout,'(20(a,i3,1x))') (restyp(itype(k,1),1),k,k=i1,ii1)
247 write (iout,'(20(a,i3,1x))') (restyp(itype(k,1),1),k,k=j1,jj1,-1)
249 ! write (iout,'(a,i3,$)') restyp(itype(k,1)),k
254 end subroutine hairpin
255 !-----------------------------------------------------------------------------
257 !-----------------------------------------------------------------------------
258 subroutine elecont(lprint,ncont,icont)
260 ! implicit real*8 (a-h,o-z)
261 ! include 'DIMENSIONS'
262 ! include 'COMMON.IOUNITS'
263 ! include 'COMMON.CHAIN'
264 ! include 'COMMON.INTERACT'
265 ! include 'COMMON.LOCAL'
266 ! include 'COMMON.FFIELD'
267 ! include 'COMMON.NAMES'
269 real(kind=8),dimension(2,2) :: elpp_6,elpp_3,ael6_,ael3_
270 real(kind=8) :: ael6_i,ael3_i
271 real(kind=8),dimension(2,2) :: app_,bpp_,rpp_
273 integer,dimension(:,:),allocatable :: icont !(2,100*nres)(2,maxcont) (maxcont=12*maxres)
274 real(kind=8),dimension(:),allocatable :: econt !(maxcont)
276 integer :: i,j,k,iteli,itelj,i1,i2,it1,it2,ic1,ic2
277 real(kind=8) :: elcutoff,elecutoff_14,rri,ees,evdw
278 real(kind=8) :: xi,yi,zi,dxi,dyi,dzi,aaa,bbb
279 real(kind=8) :: xmedi,ymedi,zmedi
280 real(kind=8) :: xj,yj,zj,dxj,dyj,dzj,rrmij,rmij,r3ij,r6ij
281 real(kind=8) :: vrmij,cosa,cosb,cosg,fac,ev1,ev2,fac3,fac4,&
282 evdwij,el1,el2,eesij,ene
284 ! Load the constants of peptide bond - peptide bond interactions.
285 ! Type 1 - ordinary peptide bond, type 2 - alkylated peptide bond (e.g.
286 ! proline) - determined by averaging ECEPP energy.
290 ! data epp / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
291 data rpp_ / 4.5088d0, 4.5395d0, 4.5395d0, 4.4846d0/
292 data elpp_6 /-0.2379d0,-0.2056d0,-0.2056d0,-0.0610d0/
293 data elpp_3 / 0.0503d0, 0.0000d0, 0.0000d0, 0.0692d0/
295 !el allocate(econt(100*nres)) !(maxcont)
296 if (.not.allocated(icont)) then
297 allocate(icont(2,100*nres_molec(1)+1))
299 if (.not.allocated(econt)) then
300 allocate(econt(100*nres_molec(1)+1))
303 elecutoff_14 = -0.5d0
304 if (lprint) write (iout,'(a)') &
305 "Constants of electrostatic interaction energy expression."
309 app_(i,j)=epp(i,j)*rri*rri
310 bpp_(i,j)=-2.0*epp(i,j)*rri
311 ael6_(i,j)=elpp_6(i,j)*4.2**6
312 ael3_(i,j)=elpp_3(i,j)*4.2**3
314 write (iout,'(2i2,4e15.4)') i,j,app_(i,j),bpp_(i,j),ael6_(i,j),&
321 ! print *, "nntt,nct",nnt,nct-2
322 do 1 i=nnt_molec(1),nct_molec(1)-2
323 if (itype(i,1).eq.ntyp1 .or. itype(i+1,1).eq.ntyp1) goto 1
334 if (itype(j,1).eq.ntyp1 .or. itype(j+1,1).eq.ntyp1) goto 4
337 if (j.eq.i+2 .and. itelj.eq.2) iteli=2
338 if (iteli.eq.2 .and. itelj.eq.2) goto 4
339 aaa=app_(iteli,itelj)
340 bbb=bpp_(iteli,itelj)
341 ael6_i=ael6_(iteli,itelj)
342 ael3_i=ael3_(iteli,itelj)
346 xj=c(1,j)+0.5*dxj-xmedi
347 yj=c(2,j)+0.5*dyj-ymedi
348 zj=c(3,j)+0.5*dzj-zmedi
349 rrmij=1.0/(xj*xj+yj*yj+zj*zj)
354 cosa=(dxi*dxj+dyi*dyj+dzi*dzj)*vblinv2
355 cosb=(xj*dxi+yj*dyi+zj*dzi)*vrmij
356 cosg=(xj*dxj+yj*dyj+zj*dzj)*vrmij
357 fac=cosa-3.0*cosb*cosg
363 el1=fac3*(4.0+fac*fac-3.0*(cosb*cosb+cosg*cosg))
366 if (j.gt.i+2 .and. eesij.le.elcutoff .or. &
367 j.eq.i+2 .and. eesij.le.elecutoff_14) then
378 write (iout,*) 'Total average electrostatic energy: ',ees
379 write (iout,*) 'VDW energy between peptide-group centers: ',evdw
381 write (iout,*) 'Electrostatic contacts before pruning: '
387 write (iout,'(i3,2x,a,i4,2x,a,i4,f10.5)') &
388 i,restyp(it1,1),i1,restyp(it2,1),i2,econt(i)
391 ! For given residues keep only the contacts with the greatest energy.
393 do while (i.lt.ncont)
399 do while (j.lt.ncont)
401 if (ic1.eq.icont(1,j).and.iabs(icont(2,j)-ic2).le.2 .or. &
402 ic2.eq.icont(2,j).and.iabs(icont(1,j)-ic1).le.2) then
403 ! write (iout,*) "i",i," j",j," ic1",ic1," ic2",ic2,
404 ! & " jc1",icont(1,j)," jc2",icont(2,j)," ncont",ncont
405 if (econt(j).lt.ene .and. icont(2,j).ne.icont(1,j)+2) then
406 if (ic1.eq.icont(1,j)) then
408 if (k.ne.i .and. k.ne.j .and. icont(2,k).eq.icont(2,j) &
409 .and. iabs(icont(1,k)-ic1).le.2 .and. &
410 econt(k).lt.econt(j) ) goto 21
412 else if (ic2.eq.icont(2,j) ) then
414 if (k.ne.i .and. k.ne.j .and. icont(1,k).eq.icont(1,j) &
415 .and. iabs(icont(2,k)-ic2).le.2 .and. &
416 econt(k).lt.econt(j) ) goto 21
421 icont(1,k-1)=icont(1,k)
422 icont(2,k-1)=icont(2,k)
427 ! write (iout,*) "ncont",ncont
429 ! write (iout,*) icont(1,k),icont(2,k)
432 else if (econt(j).gt.ene .and. ic2.ne.ic1+2) &
434 if (ic1.eq.icont(1,j)) then
436 if (k.ne.i .and. k.ne.j .and. icont(2,k).eq.ic2 &
437 .and. iabs(icont(1,k)-icont(1,j)).le.2 .and. &
438 econt(k).lt.econt(i) ) goto 21
440 else if (ic2.eq.icont(2,j) ) then
442 if (k.ne.i .and. k.ne.j .and. icont(1,k).eq.ic1 &
443 .and. iabs(icont(2,k)-icont(2,j)).le.2 .and. &
444 econt(k).lt.econt(i) ) goto 21
449 icont(1,k-1)=icont(1,k)
450 icont(2,k-1)=icont(2,k)
454 ! write (iout,*) "ncont",ncont
456 ! write (iout,*) icont(1,k),icont(2,k)
467 write (iout,*) 'Electrostatic contacts after pruning: '
473 write (iout,'(i3,2x,a,i4,2x,a,i4,f10.5)') &
474 i,restyp(it1,1),i1,restyp(it2,1),i2,econt(i)
478 end subroutine elecont
479 !-----------------------------------------------------------------------------
480 subroutine secondary2(lprint)
482 ! implicit real*8 (a-h,o-z)
483 ! include 'DIMENSIONS'
484 ! include 'COMMON.CHAIN'
485 ! include 'COMMON.IOUNITS'
486 ! include 'COMMON.DISTFIT'
487 ! include 'COMMON.VAR'
488 ! include 'COMMON.GEO'
489 ! include 'COMMON.CONTROL'
490 integer :: ncont,i,j,i1,j1,nbeta,nstrand,ii1,jj1,ij,nhelix,&
492 integer,dimension(:,:),allocatable :: icont !(2,maxcont) (maxcont=12*maxres)
493 integer,dimension(nres,0:4) :: isec !(maxres,4)
494 integer,dimension(nres) :: nsec !(maxres)
495 logical :: lprint,not_done !,freeres
496 real(kind=8) :: p1,p2
499 !el allocate(icont(2,100*nres),isec(nres,4),nsec(nres))
500 if (.not.allocated(icont)) then
501 allocate(icont(2,100*nres+1))
503 if(.not.dccart) call chainbuild_cart
504 if(.not.allocated(hfrag)) allocate(hfrag(2,nres/3)) !(2,maxres/3)
505 !d call write_pdb(99,'sec structure',0d0)
515 call elecont(lprint,ncont,icont)
516 ! print *,"after elecont"
517 if (nres_molec(1).eq.0) return
519 ! finding parallel beta
520 !d write (iout,*) '------- looking for parallel beta -----------'
526 if(j1-i1.gt.5 .and. freeres(i1,j1,nsec,isec)) then
529 !d write (iout,*) i1,j1
535 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j) .and. &
536 freeres(i1,j1,nsec,isec)) goto 5
540 !d write (iout,*) i1,j1,not_done
544 if (i1-ii1.gt.1) then
548 if(lprint)write(iout,'(a,i3,4i4)')'parallel beta',&
552 bfrag(1,nbfrag)=ii1+1
554 bfrag(3,nbfrag)=jj1+1
555 bfrag(4,nbfrag)=min0(j1+1,nres)
559 isec(ij,nsec(ij))=nbeta
563 isec(ij,nsec(ij))=nbeta
569 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
570 "DefPropRes 'strand",nstrand,&
571 "' 'num = ",ii1-1,"..",i1-1,"'"
573 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
574 "DefPropRes 'strand",nstrand,&
575 "' 'num = ",ii1-1,"..",i1-1,"'"
579 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
580 "DefPropRes 'strand",nstrand,&
581 "' 'num = ",jj1-1,"..",j1-1,"'"
583 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
584 "DefPropRes 'strand",nstrand,&
585 "' 'num = ",jj1-1,"..",j1-1,"'"
587 write(12,'(a8,4i4)') &
588 "SetNeigh",ii1-1,i1-1,jj1-1,j1-1
594 ! finding alpha or 310 helix
601 if (j1+2.le.nres) p2=phi(j1+2)*rad2deg
604 if (j1.eq.i1+3 .and. &
605 ((p1.ge.10.and.p1.le.80).or.i1.le.2).and. &
606 ((p2.ge.10.and.p2.le.80).or.j1.le.2.or.j1.ge.nres-3) )then
607 !d if (j1.eq.i1+3) write (iout,*) "found 1-4 ",i1,j1,p1,p2
608 !o if (j1.eq.i1+4) write (iout,*) "found 1-5 ",i1,j1,p1,p2
611 if (nsec(ii1).eq.0) then
620 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
626 if (p1.lt.10.or.p1.gt.80.or.p2.lt.10.or.p2.gt.80) &
631 if (j1-ii1.gt.5) then
643 write (iout,'(a,i3,2i4)') "Helix",nhelix,ii1-1,j1-1
644 if (nhelix.le.9) then
645 write(12,'(a17,i1,a9,i3,a2,i3,a1)') &
646 "DefPropRes 'helix",nhelix,&
647 "' 'num = ",ii1-1,"..",j1-2,"'"
649 write(12,'(a17,i2,a9,i3,a2,i3,a1)') &
650 "DefPropRes 'helix",nhelix,&
651 "' 'num = ",ii1-1,"..",j1-2,"'"
657 if (nhelix.gt.0.and.lprint) then
658 write(12,'(a26,$)') "DefPropRes 'helix' 'helix1"
660 if (nhelix.le.9) then
661 write(12,'(a8,i1,$)') " | helix",i
663 write(12,'(a8,i2,$)') " | helix",i
670 ! finding antiparallel beta
671 !d write (iout,*) '--------- looking for antiparallel beta ---------'
676 if (freeres(i1,j1,nsec,isec)) then
679 !d write (iout,*) i1,j1
686 if (i1.eq.icont(1,j).and.j1.eq.icont(2,j) .and. &
687 freeres(i1,j1,nsec,isec)) goto 6
691 !d write (iout,*) i1,j1,not_done
695 if (i1-ii1.gt.1) then
699 bfrag(2,nbfrag)=min0(i1+1,nres)
700 bfrag(3,nbfrag)=min0(jj1+1,nres)
707 if (nsec(ij).le.2) then
708 isec(ij,nsec(ij))=nbeta
714 if (nsec(ij).le.2 .and. nsec(ij).gt.0) then
715 isec(ij,nsec(ij))=nbeta
721 write (iout,'(a,i3,4i4)')'antiparallel beta',&
722 nbeta,ii1-1,i1,jj1,j1-1
724 if (nstrand.le.9) then
725 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
726 "DefPropRes 'strand",nstrand,&
727 "' 'num = ",ii1-2,"..",i1-1,"'"
729 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
730 "DefPropRes 'strand",nstrand,&
731 "' 'num = ",ii1-2,"..",i1-1,"'"
734 if (nstrand.le.9) then
735 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
736 "DefPropRes 'strand",nstrand,&
737 "' 'num = ",j1-2,"..",jj1-1,"'"
739 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
740 "DefPropRes 'strand",nstrand,&
741 "' 'num = ",j1-2,"..",jj1-1,"'"
743 write(12,'(a8,4i4)') &
744 "SetNeigh",ii1-2,i1-1,jj1-1,j1-2
750 if (nstrand.gt.0.and.lprint) then
751 write(12,'(a27,$)') "DefPropRes 'sheet' 'strand1"
754 write(12,'(a9,i1,$)') " | strand",i
756 write(12,'(a9,i2,$)') " | strand",i
765 write(12,'(a37)') "DefPropRes 'coil' '! (helix | sheet)'"
766 write(12,'(a20)') "XMacStand ribbon.mac"
768 if (nres_molec(1).eq.0) return
769 write(iout,*) 'UNRES seq:'
771 write(iout,*) 'beta ',(bfrag(i,j),i=1,4)
775 write(iout,*) 'helix ',(hfrag(i,j),i=1,2)
780 end subroutine secondary2
782 !-----------------------------------------------------------------------------
783 logical function freeres(i,j,nsec,isec)
785 ! implicit real*8 (a-h,o-z)
786 ! include 'DIMENSIONS'
787 integer,dimension(nres,4) :: isec !(maxres,4)
788 integer,dimension(nres) :: nsec !(maxres)
795 if (nsec(i).lt.0.or.nsec(j).lt.0) return
797 if (nsec(i).gt.1.or.nsec(j).gt.1) return
800 if (isec(i,k).eq.isec(j,l)) return
806 !-----------------------------------------------------------------------------
808 !-----------------------------------------------------------------------------
809 logical function seq_comp(itypea,itypeb,length)
812 integer :: length,itypea(length),itypeb(length)
815 if (itypea(i).ne.itypeb(i)) then
822 end function seq_comp
824 !-----------------------------------------------------------------------------
826 !-----------------------------------------------------------------------------
827 subroutine rms_nac_nnc(rms,frac,frac_nn,co,lprn)
829 ! implicit real*8 (a-h,o-z)
830 ! include 'DIMENSIONS'
831 ! include 'COMMON.CHAIN'
832 ! include 'COMMON.CONTACTS'
833 ! include 'COMMON.IOUNITS'
834 real(kind=8) :: przes(3),obr(3,3)
835 logical :: non_conv,lprn
836 real(kind=8) :: rms,frac,frac_nn,co
837 ! call fitsq(rms,c(1,nstart_seq),cref(1,nstart_sup),nsup,przes,
841 ! print *,"before contact"
842 !elte(iout,*) "rms_nacc before contact"
843 call contact(.false.,ncont,icont,co)
844 frac=contact_fract(ncont,ncont_ref,icont,icont_ref)
845 frac_nn=contact_fract_nn(ncont,ncont_ref,icont,icont_ref)
846 if (lprn) write (iout,'(a,f8.3/a,f8.3/a,f8.3/a,f8.3)') &
847 'RMS deviation from the reference structure:',rms,&
848 ' % of native contacts:',frac*100,&
849 ' % of nonnative contacts:',frac_nn*100,&
853 end subroutine rms_nac_nnc
854 !-----------------------------------------------------------------------------
855 subroutine rmsd(drms)
857 use regularize_, only:fitsq
858 ! implicit real*8 (a-h,o-z)
859 ! include 'DIMENSIONS'
863 ! include 'COMMON.CHAIN'
864 ! include 'COMMON.IOUNITS'
865 ! include 'COMMON.INTERACT'
866 ! include 'COMMON.CONTROL'
868 real(kind=8) :: przes(3),obrot(3,3)
869 real(kind=8),dimension(3,2*nres+2) :: ccopy,crefcopy !(3,maxres2+2) maxres2=2*maxres
872 real(kind=8) :: drms,rminroz,roznica
873 integer :: i,j,iatom,kkk,iti,k,mnum
875 !el allocate(ccopy(3,2*nres+2),crefcopy(3,2*nres+2)) !(3,maxres2+2) maxres2=2*maxres
883 ! print *,"nz_start",nz_start," nz_end",nz_end
884 ! if (symetr.le.1) then
886 ! do i=nz_start,nz_end
890 ! ccopy(k,iatom)=c(k,i+nstart_seq-nstart_sup)
891 ! crefcopy(k,iatom,kkk)=cref(k,i,kkk)
893 ! if (iz_sc.eq.1.and.iti.ne.10) then
896 ! ccopy(k,iatom)=c(k,nres+i+nstart_seq-nstart_sup)
897 ! crefcopy(k,iatom,kkk)=cref(k,nres+i,kkk)
904 ! print *,nz_start,nz_end,nstart_seq-nstart_sup
907 iti=itype(i+nstart_seq-nstart_sup,molnum(i))
908 if (iti.eq.ntyp1_molec(molnum(i))) cycle
910 mnum=molnum(i+nstart_seq-nstart_sup)
912 ccopy(k,iatom)=c(k,i+nstart_seq-nstart_sup)
913 crefcopy(k,iatom)=cref(k,i,kkk)
915 if (iz_sc.eq.1.and.iti.ne.10.and.mnum.lt.4) then
918 ccopy(k,iatom)=c(k,nres+i+nstart_seq-nstart_sup)
919 crefcopy(k,iatom)=cref(k,nres+i,kkk)
928 ! write (iout,*) 'Ccopy and CREFcopy'
929 ! print '(i5,3f10.5,5x,3f10.5)',(k,(ccopy(j,k),j=1,3),
930 ! & (crefcopy(j,k),j=1,3),k=1,iatom)
931 ! write (iout,'(i5,3f10.5,5x,3f10.5)') (k,(ccopy(j,k),j=1,3),
932 ! & (crefcopy(j,k),j=1,3),k=1,iatom)
934 ! ----- end diagnostics
936 call fitsq(roznica,ccopy(1,1),crefcopy(1,1),iatom,&
937 przes,obrot,non_conv)
939 print *,'Problems in FITSQ!!! rmsd'
940 write (iout,*) 'Problems in FITSQ!!! rmsd'
941 print *,'Ccopy and CREFcopy'
942 write (iout,*) 'Ccopy and CREFcopy'
943 print '(i5,3f10.5,5x,3f10.5)',(k,(ccopy(j,k),j=1,3),&
944 (crefcopy(j,k),j=1,3),k=1,iatom)
945 write (iout,'(i5,3f10.5,5x,3f10.5)') (k,(ccopy(j,k),j=1,3),&
946 (crefcopy(j,k),j=1,3),k=1,iatom)
948 ! call mpi_abort(mpi_comm_world,ierror,ierrcode)
954 ! write (iout,*) "roznica", roznica,kkk
955 if (roznica.le.rminroz) rminroz=roznica
957 drms=dsqrt(dabs(rminroz))
959 ! write (iout,*) "nperm,symetr", nperm,symetr
960 ! ---- end diagnostics
963 !-----------------------------------------------------------------------------
964 subroutine rmsd_csa(drms)
966 use regularize_, only:fitsq
967 ! implicit real*8 (a-h,o-z)
968 ! include 'DIMENSIONS'
972 ! include 'COMMON.CHAIN'
973 ! include 'COMMON.IOUNITS'
974 ! include 'COMMON.INTERACT'
976 real(kind=8) :: przes(3),obrot(3,3)
977 real(kind=8),dimension(:,:),allocatable :: ccopy,crefcopy !(3,maxres2+2) maxres2=2*maxres
978 integer :: kkk,iatom,ierror,ierrcode
982 real(kind=8) :: drms,roznica
984 allocate(ccopy(3,2*nres+2),crefcopy(3,2*nres+2)) !(3,maxres2+2) maxres2=2*maxres
992 ccopy(k,iatom)=c(k,i)
993 crefcopy(k,iatom)=crefjlee(k,i)
995 if (iz_sc.eq.1.and.iti.ne.10) then
998 ccopy(k,iatom)=c(k,nres+i)
999 crefcopy(k,iatom)=crefjlee(k,nres+i)
1004 call fitsq(roznica,ccopy(1,1),crefcopy(1,1),iatom,&
1005 przes,obrot,non_conv)
1007 print *,'Problems in FITSQ!!! rmsd_csa'
1008 write (iout,*) 'Problems in FITSQ!!! rmsd_csa'
1009 print *,'Ccopy and CREFcopy'
1010 write (iout,*) 'Ccopy and CREFcopy'
1011 print '(i5,3f10.5,5x,3f10.5)',(k,(ccopy(j,k),j=1,3),&
1012 (crefcopy(j,k),j=1,3),k=1,iatom)
1013 write (iout,'(i5,3f10.5,5x,3f10.5)') (k,(ccopy(j,k),j=1,3),&
1014 (crefcopy(j,k),j=1,3),k=1,iatom)
1016 call mpi_abort(mpi_comm_world,ierror,ierrcode)
1021 drms=dsqrt(dabs(roznica))
1023 end subroutine rmsd_csa
1024 !-----------------------------------------------------------------------------
1026 !-----------------------------------------------------------------------------
1030 use geometry, only:pinorm
1031 use random, only:ran_number,iran_num
1032 ! implicit real*8 (a-h,o-z)
1033 ! include 'DIMENSIONS'
1035 ! include 'COMMON.GEO'
1036 ! include 'COMMON.VAR'
1037 ! include 'COMMON.INTERACT'
1038 ! include 'COMMON.IOUNITS'
1039 ! include 'COMMON.DISTFIT'
1040 ! include 'COMMON.SBRIDGE'
1041 ! include 'COMMON.CONTROL'
1042 ! include 'COMMON.FFIELD'
1043 ! include 'COMMON.MINIM'
1044 ! include 'COMMON.CHAIN'
1045 real(kind=8) :: time0,time1
1046 real(kind=8) :: energy(0:n_ene),ee
1047 real(kind=8),dimension(6*nres) :: var,var1 !(maxvar) (maxvar=6*maxres)
1048 integer :: j1,j2,jr,i,iretcode,nfun,nft_sc
1049 logical :: debug,accepted
1050 real(kind=8) :: etot,rms,da,temp,betbol,etot0,d,phiold,&
1053 !el allocate(var(6*nres),var1(6*nres)) !(maxvar) (maxvar=6*maxres)
1055 call geom_to_var(nvar,var1)
1060 write(iout,*) 'etot=',0,etot,rms
1061 call secondary2(.false.)
1063 call write_pdb(0,'first structure',etot)
1072 betbol=1.0D0/(1.9858D-3*temp)
1074 d=ran_number(-pi,pi)
1075 ! phi(jr)=pinorm(phi(jr)+d)
1080 write(iout,*) 'etot=',1,etot0,rms
1081 call write_pdb(1,'perturb structure',etot0)
1085 d=ran_number(-da,da)
1087 phi(jr)=pinorm(phi(jr)+d)
1092 if (etot.lt.etot0) then
1096 xxr=ran_number(0.0D0,1.0D0)
1097 xxh=betbol*(etot-etot0)
1098 if (xxh.lt.50.0D0) then
1100 if (xxh.gt.xxr) accepted=.true.
1104 ! print *,etot0,etot,accepted
1108 write(iout,*) 'etot=',i,etot,rms
1109 call write_pdb(i,'MC structure',etot)
1111 ! call geom_to_var(nvar,var1)
1112 call sc_move(2,nres-1,1,10d0,nft_sc,etot)
1113 call geom_to_var(nvar,var)
1114 call minimize(etot,var,iretcode,nfun)
1115 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun
1116 call var_to_geom(nvar,var)
1119 write(iout,*) 'etot mcm=',i,etot,rms
1120 call write_pdb(i+1,'MCM structure',etot)
1121 call var_to_geom(nvar,var1)
1129 ! call sc_move(2,nres-1,1,10d0,nft_sc,etot)
1130 ! call geom_to_var(nvar,var)
1133 ! call write_pdb(998 ,'sc min',etot)
1135 ! call minimize(etot,var,iretcode,nfun)
1136 ! write(iout,*)'------------------------------------------------'
1137 ! write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun
1139 ! call var_to_geom(nvar,var)
1141 ! call write_pdb(999,'full min',etot)
1145 !-----------------------------------------------------------------------------
1150 ! implicit real*8 (a-h,o-z)
1151 ! include 'DIMENSIONS'
1153 ! include 'COMMON.GEO'
1154 ! include 'COMMON.VAR'
1155 ! include 'COMMON.INTERACT'
1156 ! include 'COMMON.IOUNITS'
1157 ! include 'COMMON.DISTFIT'
1158 ! include 'COMMON.SBRIDGE'
1159 ! include 'COMMON.CONTROL'
1160 ! include 'COMMON.FFIELD'
1161 ! include 'COMMON.MINIM'
1162 ! include 'COMMON.CHAIN'
1163 real(kind=8) :: time0,time1
1164 real(kind=8) :: energy(0:n_ene),ee
1165 real(kind=8),dimension(:),allocatable :: var,var1 !(maxvar) (maxvar=6*maxres)
1169 integer :: i,ij,ieval,iretcode,nfun
1170 real(kind=8) :: etot
1172 allocate(var(6*nres),var1(6*nres)) !(maxvar) (maxvar=6*maxres)
1174 call geom_to_var(nvar,var1)
1178 write(iout,*) nnt,nct,etot
1179 call write_pdb(1,'first structure',etot)
1180 call secondary2(.true.)
1189 call var_to_geom(nvar,var1)
1190 write(iout,*) 'N16 test',(jdata(i),i=1,5)
1191 call beta_slide(jdata(1),jdata(2),jdata(3),jdata(4),jdata(5), &
1193 call geom_to_var(nvar,var)
1199 call minimize(etot,var,iretcode,nfun)
1200 write(iout,*)'------------------------------------------------'
1201 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,&
1207 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,&
1208 nfun/(time1-time0),' eval/s'
1210 call var_to_geom(nvar,var)
1212 call write_pdb(ij*100+99,'full min',etot)
1219 end subroutine test_n16
1221 !-----------------------------------------------------------------------------
1222 subroutine test_local
1224 ! implicit real*8 (a-h,o-z)
1225 ! include 'DIMENSIONS'
1226 ! include 'COMMON.GEO'
1227 ! include 'COMMON.VAR'
1228 ! include 'COMMON.INTERACT'
1229 ! include 'COMMON.IOUNITS'
1230 real(kind=8) :: time0,time1
1231 real(kind=8) :: energy(0:n_ene),ee
1232 real(kind=8),dimension(6*nres) :: varia !(maxvar) (maxvar=6*maxres)
1234 real(kind=8) :: etot
1236 ! allocate(varia(6*nres)) !(maxvar) (maxvar=6*maxres)
1238 ! call geom_to_var(nvar,varia)
1239 call write_pdb(1,'first structure',0d0)
1243 write(iout,*) nnt,nct,etot
1245 write(iout,*) 'calling sc_move'
1246 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
1247 write(iout,*) nft_sc,etot
1248 call write_pdb(2,'second structure',etot)
1250 write(iout,*) 'calling local_move'
1251 call local_move_init(.false.)
1252 call local_move(24,29,20d0,50d0)
1254 call write_pdb(3,'third structure',etot)
1256 write(iout,*) 'calling sc_move'
1257 call sc_move(24,29,5,10d0,nft_sc,etot)
1258 write(iout,*) nft_sc,etot
1259 call write_pdb(2,'last structure',etot)
1262 end subroutine test_local
1263 !-----------------------------------------------------------------------------
1266 ! implicit real*8 (a-h,o-z)
1267 ! include 'DIMENSIONS'
1268 ! include 'COMMON.GEO'
1269 ! include 'COMMON.VAR'
1270 ! include 'COMMON.INTERACT'
1271 ! include 'COMMON.IOUNITS'
1272 real(kind=8) :: time0,time1,etot
1273 real(kind=8) :: energy(0:n_ene),ee
1274 real(kind=8),dimension(6*nres) :: varia !(maxvar) (maxvar=6*maxres)
1278 ! call geom_to_var(nvar,varia)
1279 call write_pdb(1,'first structure',0d0)
1283 write(iout,*) nnt,nct,etot
1285 write(iout,*) 'calling sc_move'
1287 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
1288 write(iout,*) nft_sc,etot
1289 call write_pdb(2,'second structure',etot)
1291 write(iout,*) 'calling sc_move 2nd time'
1293 call sc_move(nnt,nct,5,1d0,nft_sc,etot)
1294 write(iout,*) nft_sc,etot
1295 call write_pdb(3,'last structure',etot)
1297 end subroutine test_sc
1298 !-----------------------------------------------------------------------------
1299 subroutine bgrow(bstrand,nbstrand,in,ind,new)
1301 ! implicit real*8 (a-h,o-z)
1302 ! include 'DIMENSIONS'
1303 ! include 'COMMON.CHAIN'
1304 integer,dimension(nres/3,6) :: bstrand !(maxres/3,6)
1307 integer :: nbstrand,in,ind,new,ishift,i
1309 ishift=iabs(bstrand(in,ind+4)-new)
1311 print *,'bgrow',bstrand(in,ind+4),new,ishift
1316 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1318 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
1319 if (bstrand(i,5).lt.bstrand(i,6)) then
1320 bstrand(i,5)=bstrand(i,5)-ishift
1322 bstrand(i,5)=bstrand(i,5)+ishift
1327 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1329 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
1330 if (bstrand(i,6).lt.bstrand(i,5)) then
1331 bstrand(i,6)=bstrand(i,6)-ishift
1333 bstrand(i,6)=bstrand(i,6)+ishift
1340 end subroutine bgrow
1341 !-----------------------------------------------------------------------------
1344 use geometry, only:dist
1346 ! implicit real*8 (a-h,o-z)
1347 ! include 'DIMENSIONS'
1349 ! include 'COMMON.GEO'
1350 ! include 'COMMON.CHAIN'
1351 ! include 'COMMON.IOUNITS'
1352 ! include 'COMMON.VAR'
1353 ! include 'COMMON.CONTROL'
1354 ! include 'COMMON.SBRIDGE'
1355 ! include 'COMMON.FFIELD'
1356 ! include 'COMMON.MINIM'
1358 ! include 'COMMON.DISTFIT'
1359 integer :: if(20,nres),nif,ifa(20)
1360 integer :: ibc(0:nres,0:nres),istrand(20)
1361 integer :: ibd(nres),ifb(10,2),nifb,lifb(10),lifb0
1362 integer :: itmp(20,nres)
1363 real(kind=8) :: time0,time1
1364 real(kind=8) :: energy(0:n_ene),ee
1365 real(kind=8),dimension(6*nres) :: varia,vorg !(maxvar) (maxvar=6*maxres)
1367 logical :: debug,ltest,usedbfrag(nres/3)
1368 character(len=50) :: linia
1370 integer :: betasheet(nres),ibetasheet(nres),nbetasheet
1371 integer :: bstrand(nres/3,6),nbstrand
1372 real(kind=8) :: etot
1373 integer :: i,j,jk,k,isa,m,l,ig,iconf,is,ii,iused_nbfrag,&
1374 in,ind,ifun,nfun,iretcode
1375 !------------------------
1378 !------------------------
1385 call geom_to_var(nvar,vorg)
1386 call secondary2(debug)
1388 if (nbfrag.le.1) return
1391 usedbfrag(i)=.false.
1395 nbetasheet=nbetasheet+1
1397 bstrand(1,1)=bfrag(1,1)
1398 bstrand(1,2)=bfrag(2,1)
1399 bstrand(1,3)=nbetasheet
1401 bstrand(1,5)=bfrag(1,1)
1402 bstrand(1,6)=bfrag(2,1)
1403 do i=bfrag(1,1),bfrag(2,1)
1404 betasheet(i)=nbetasheet
1408 bstrand(2,1)=bfrag(3,1)
1409 bstrand(2,2)=bfrag(4,1)
1410 bstrand(2,3)=nbetasheet
1411 bstrand(2,5)=bfrag(3,1)
1412 bstrand(2,6)=bfrag(4,1)
1414 if (bfrag(3,1).le.bfrag(4,1)) then
1416 do i=bfrag(3,1),bfrag(4,1)
1417 betasheet(i)=nbetasheet
1422 do i=bfrag(4,1),bfrag(3,1)
1423 betasheet(i)=nbetasheet
1430 do while (iused_nbfrag.ne.nbfrag)
1434 IF (.not.usedbfrag(j)) THEN
1436 write (*,*) j,(bfrag(i,j),i=1,4)
1438 write (*,'(i4,a3,10i4)') jk,'B',(bstrand(i,jk),i=1,nbstrand)
1440 write (*,*) '------------------'
1443 if (bfrag(3,j).le.bfrag(4,j)) then
1444 do i=bfrag(3,j),bfrag(4,j)
1445 if(betasheet(i).eq.nbetasheet) then
1447 do k=bfrag(3,j),bfrag(4,j)
1448 betasheet(k)=nbetasheet
1453 iused_nbfrag=iused_nbfrag+1
1454 do k=bfrag(1,j),bfrag(2,j)
1455 betasheet(k)=nbetasheet
1456 ibetasheet(k)=nbstrand
1458 if (bstrand(in,4).lt.0) then
1459 bstrand(nbstrand,1)=bfrag(2,j)
1460 bstrand(nbstrand,2)=bfrag(1,j)
1461 bstrand(nbstrand,3)=nbetasheet
1462 bstrand(nbstrand,4)=-nbstrand
1463 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1464 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1465 if(bstrand(in,1).lt.bfrag(4,j)) then
1466 call bgrow(bstrand,nbstrand,in,1,bfrag(4,j))
1468 bstrand(nbstrand,5)=bstrand(nbstrand,5)+&
1469 (bstrand(in,5)-bfrag(4,j))
1471 if(bstrand(in,2).gt.bfrag(3,j)) then
1472 call bgrow(bstrand,nbstrand,in,2,bfrag(3,j))
1474 bstrand(nbstrand,6)=bstrand(nbstrand,6)-&
1475 (-bstrand(in,6)+bfrag(3,j))
1478 bstrand(nbstrand,1)=bfrag(1,j)
1479 bstrand(nbstrand,2)=bfrag(2,j)
1480 bstrand(nbstrand,3)=nbetasheet
1481 bstrand(nbstrand,4)=nbstrand
1482 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1483 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1484 if(bstrand(in,1).gt.bfrag(3,j)) then
1485 call bgrow(bstrand,nbstrand,in,1,bfrag(3,j))
1487 bstrand(nbstrand,5)=bstrand(nbstrand,5)-&
1488 (-bstrand(in,5)+bfrag(3,j))
1490 if(bstrand(in,2).lt.bfrag(4,j)) then
1491 call bgrow(bstrand,nbstrand,in,2,bfrag(4,j))
1493 bstrand(nbstrand,6)=bstrand(nbstrand,6)+&
1494 (bstrand(in,6)-bfrag(4,j))
1499 if(betasheet(bfrag(1,j)+i-bfrag(3,j)).eq.nbetasheet) then
1500 in=ibetasheet(bfrag(1,j)+i-bfrag(3,j))
1501 do k=bfrag(1,j),bfrag(2,j)
1502 betasheet(k)=nbetasheet
1507 iused_nbfrag=iused_nbfrag+1
1508 do k=bfrag(3,1),bfrag(4,1)
1509 betasheet(k)=nbetasheet
1510 ibetasheet(k)=nbstrand
1512 if (bstrand(in,4).lt.0) then
1513 bstrand(nbstrand,1)=bfrag(4,j)
1514 bstrand(nbstrand,2)=bfrag(3,j)
1515 bstrand(nbstrand,3)=nbetasheet
1516 bstrand(nbstrand,4)=-nbstrand
1517 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1518 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1519 if(bstrand(in,1).lt.bfrag(2,j)) then
1520 call bgrow(bstrand,nbstrand,in,1,bfrag(2,j))
1522 bstrand(nbstrand,5)=bstrand(nbstrand,5)+&
1523 (bstrand(in,5)-bfrag(2,j))
1525 if(bstrand(in,2).gt.bfrag(1,j)) then
1526 call bgrow(bstrand,nbstrand,in,2,bfrag(1,j))
1528 bstrand(nbstrand,6)=bstrand(nbstrand,6)-&
1529 (-bstrand(in,6)+bfrag(1,j))
1532 bstrand(nbstrand,1)=bfrag(3,j)
1533 bstrand(nbstrand,2)=bfrag(4,j)
1534 bstrand(nbstrand,3)=nbetasheet
1535 bstrand(nbstrand,4)=nbstrand
1536 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1537 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1538 if(bstrand(in,1).gt.bfrag(1,j)) then
1539 call bgrow(bstrand,nbstrand,in,1,bfrag(1,j))
1541 bstrand(nbstrand,5)=bstrand(nbstrand,5)-&
1542 (-bstrand(in,5)+bfrag(1,j))
1544 if(bstrand(in,2).lt.bfrag(2,j)) then
1545 call bgrow(bstrand,nbstrand,in,2,bfrag(2,j))
1547 bstrand(nbstrand,6)=bstrand(nbstrand,6)+&
1548 (bstrand(in,6)-bfrag(2,j))
1555 do i=bfrag(4,j),bfrag(3,j)
1556 if(betasheet(i).eq.nbetasheet) then
1558 do k=bfrag(4,j),bfrag(3,j)
1559 betasheet(k)=nbetasheet
1564 iused_nbfrag=iused_nbfrag+1
1565 do k=bfrag(1,j),bfrag(2,j)
1566 betasheet(k)=nbetasheet
1567 ibetasheet(k)=nbstrand
1569 if (bstrand(in,4).lt.0) then
1570 bstrand(nbstrand,1)=bfrag(1,j)
1571 bstrand(nbstrand,2)=bfrag(2,j)
1572 bstrand(nbstrand,3)=nbetasheet
1573 bstrand(nbstrand,4)=nbstrand
1574 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1575 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1576 if(bstrand(in,1).lt.bfrag(3,j)) then
1577 call bgrow(bstrand,nbstrand,in,1,bfrag(3,j))
1579 bstrand(nbstrand,5)=bstrand(nbstrand,5)-&
1580 (bstrand(in,5)-bfrag(3,j))
1582 if(bstrand(in,2).gt.bfrag(4,j)) then
1583 call bgrow(bstrand,nbstrand,in,2,bfrag(4,j))
1585 bstrand(nbstrand,6)=bstrand(nbstrand,6)+&
1586 (-bstrand(in,6)+bfrag(4,j))
1589 bstrand(nbstrand,1)=bfrag(2,j)
1590 bstrand(nbstrand,2)=bfrag(1,j)
1591 bstrand(nbstrand,3)=nbetasheet
1592 bstrand(nbstrand,4)=-nbstrand
1593 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1594 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1595 if(bstrand(in,1).gt.bfrag(4,j)) then
1596 call bgrow(bstrand,nbstrand,in,1,bfrag(4,j))
1598 bstrand(nbstrand,5)=bstrand(nbstrand,5)+&
1599 (-bstrand(in,5)+bfrag(4,j))
1601 if(bstrand(in,2).lt.bfrag(3,j)) then
1602 call bgrow(bstrand,nbstrand,in,2,bfrag(3,j))
1604 bstrand(nbstrand,6)=bstrand(nbstrand,6)-&
1605 (bstrand(in,6)-bfrag(3,j))
1610 if(betasheet(bfrag(2,j)-i+bfrag(4,j)).eq.nbetasheet) then
1611 in=ibetasheet(bfrag(2,j)-i+bfrag(4,j))
1612 do k=bfrag(1,j),bfrag(2,j)
1613 betasheet(k)=nbetasheet
1618 iused_nbfrag=iused_nbfrag+1
1619 do k=bfrag(4,j),bfrag(3,j)
1620 betasheet(k)=nbetasheet
1621 ibetasheet(k)=nbstrand
1623 if (bstrand(in,4).lt.0) then
1624 bstrand(nbstrand,1)=bfrag(4,j)
1625 bstrand(nbstrand,2)=bfrag(3,j)
1626 bstrand(nbstrand,3)=nbetasheet
1627 bstrand(nbstrand,4)=nbstrand
1628 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1629 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1630 if(bstrand(in,1).lt.bfrag(2,j)) then
1631 call bgrow(bstrand,nbstrand,in,1,bfrag(2,j))
1633 bstrand(nbstrand,5)=bstrand(nbstrand,5)-&
1634 (bstrand(in,5)-bfrag(2,j))
1636 if(bstrand(in,2).gt.bfrag(1,j)) then
1637 call bgrow(bstrand,nbstrand,in,2,bfrag(1,j))
1639 bstrand(nbstrand,6)=bstrand(nbstrand,6)+&
1640 (-bstrand(in,6)+bfrag(1,j))
1643 bstrand(nbstrand,1)=bfrag(3,j)
1644 bstrand(nbstrand,2)=bfrag(4,j)
1645 bstrand(nbstrand,3)=nbetasheet
1646 bstrand(nbstrand,4)=-nbstrand
1647 bstrand(nbstrand,5)=bstrand(nbstrand,1)
1648 bstrand(nbstrand,6)=bstrand(nbstrand,2)
1649 if(bstrand(in,1).gt.bfrag(1,j)) then
1650 call bgrow(bstrand,nbstrand,in,1,bfrag(1,j))
1652 bstrand(nbstrand,5)=bstrand(nbstrand,5)+&
1653 (-bstrand(in,5)+bfrag(1,j))
1655 if(bstrand(in,2).lt.bfrag(2,j)) then
1656 call bgrow(bstrand,nbstrand,in,2,bfrag(2,j))
1658 bstrand(nbstrand,6)=bstrand(nbstrand,6)-&
1659 (bstrand(in,6)-bfrag(2,j))
1673 do while (usedbfrag(j))
1678 nbetasheet=nbetasheet+1
1679 bstrand(nbstrand,1)=bfrag(1,j)
1680 bstrand(nbstrand,2)=bfrag(2,j)
1681 bstrand(nbstrand,3)=nbetasheet
1682 bstrand(nbstrand,5)=bfrag(1,j)
1683 bstrand(nbstrand,6)=bfrag(2,j)
1685 bstrand(nbstrand,4)=nbstrand
1686 do i=bfrag(1,j),bfrag(2,j)
1687 betasheet(i)=nbetasheet
1688 ibetasheet(i)=nbstrand
1692 bstrand(nbstrand,1)=bfrag(3,j)
1693 bstrand(nbstrand,2)=bfrag(4,j)
1694 bstrand(nbstrand,3)=nbetasheet
1695 bstrand(nbstrand,5)=bfrag(3,j)
1696 bstrand(nbstrand,6)=bfrag(4,j)
1698 if (bfrag(3,j).le.bfrag(4,j)) then
1699 bstrand(nbstrand,4)=nbstrand
1700 do i=bfrag(3,j),bfrag(4,j)
1701 betasheet(i)=nbetasheet
1702 ibetasheet(i)=nbstrand
1705 bstrand(nbstrand,4)=-nbstrand
1706 do i=bfrag(4,j),bfrag(3,j)
1707 betasheet(i)=nbetasheet
1708 ibetasheet(i)=nbstrand
1712 iused_nbfrag=iused_nbfrag+1
1718 write (*,'(i4,a3,10i4)') jk,'A',(bstrand(i,jk),i=1,nbstrand)
1725 if (betasheet(i).ne.0) write(*,*) i,betasheet(i),ibetasheet(i)
1729 write (*,'(i4,a3,10i4)') j,':',(bstrand(i,j),i=1,nbstrand)
1732 !------------------------
1736 if(iabs(bstrand(i,5)-bstrand(j,5)).le.5 .or. &
1737 iabs(bstrand(i,6)-bstrand(j,6)).le.5 ) then
1739 ifb(nifb,1)=bstrand(i,4)
1740 ifb(nifb,2)=bstrand(j,4)
1747 write (*,'(a3,20i4)') "ifb",i,ifb(i,1),ifb(i,2)
1753 write (*,'(a3,20i4)') "ifa",(ifa(i),i=1,nbstrand)
1755 nif=iabs(bstrand(1,6)-bstrand(1,5))+1
1757 if (iabs(bstrand(j,6)-bstrand(j,5))+1.gt.nif) &
1758 nif=iabs(bstrand(j,6)-bstrand(j,5))+1
1764 if(j,i)=bstrand(j,6)+(i-1)*sign(1,bstrand(j,5)-bstrand(j,6))
1765 if (if(j,i).gt.0) then
1766 if(betasheet(if(j,i)).eq.0 .or. &
1767 ibetasheet(if(j,i)).ne.iabs(bstrand(j,4))) if(j,i)=0
1772 write(*,'(a3,10i4)') 'if ',(if(j,i),j=1,nbstrand)
1775 ! read (inp,*) (ifa(i),i=1,4)
1777 ! read (inp,*,err=20,end=20) (if(j,i),j=1,4)
1781 !------------------------
1786 !ccccccccccccccccccccccccccccccccc
1788 !ccccccccccccccccccccccccccccccccc
1792 istrand(is-j+1)=int(ii/is**(is-j))
1793 ii=ii-istrand(is-j+1)*is**(is-j)
1797 istrand(k)=istrand(k)+1
1798 if(istrand(k).gt.isa) istrand(k)=istrand(k)-2*isa-1
1802 if(istrand(k).eq.istrand(l).and.k.ne.l.or. &
1803 istrand(k).eq.-istrand(l).and.k.ne.l) ltest=.false.
1812 ifb(m,1).eq.istrand(k).and.ifb(m,2).eq.istrand(k+1).or. &
1813 ifb(m,2).eq.istrand(k).and.ifb(m,1).eq.istrand(k+1).or. &
1814 -ifb(m,1).eq.istrand(k).and.-ifb(m,2).eq.istrand(k+1).or. &
1815 -ifb(m,2).eq.istrand(k).and.-ifb(m,1).eq.istrand(k+1)) &
1821 if (mod(isa,2).eq.0) then
1823 if (istrand(k).eq.1) ltest=.false.
1826 do k=(isa+1)/2+1,isa
1827 if (istrand(k).eq.1) ltest=.false.
1831 IF (ltest.and.lifb0.eq.1) THEN
1834 call var_to_geom(nvar,vorg)
1836 write (*,'(i5,i10,10i3)') iconf,ig,(istrand(k),k=1,isa)
1837 write (iout,'(i5,i10,10i3)') iconf,ig,(istrand(k),k=1,isa)
1838 write (linia,'(10i3)') (istrand(k),k=1,isa)
1848 if ( sign(1,istrand(i)).eq.sign(1,ifa(iabs(istrand(i)))) ) then
1850 itmp(iabs(istrand(i)),j)=if(iabs(ifa(iabs(istrand(i)))),j)
1854 itmp(iabs(istrand(i)),j)=if(iabs(ifa(iabs(istrand(i)))),nif-j+1)
1860 write(*,*) (itmp(j,i),j=1,4)
1864 ! ifa(1),ifa(2),ifa(3),ifa(4)
1865 ! if(1,i),if(2,i),if(3,i),if(4,i)
1870 ifb(m,1).eq.istrand(k).and.ifb(m,2).eq.istrand(k+1).or. &
1871 ifb(m,2).eq.istrand(k).and.ifb(m,1).eq.istrand(k+1).or. &
1872 -ifb(m,1).eq.istrand(k).and.-ifb(m,2).eq.istrand(k+1).or. &
1873 -ifb(m,2).eq.istrand(k).and.-ifb(m,1).eq.istrand(k+1)) &
1881 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+1)),i))=-1
1883 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+1)),i))=-2
1887 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+2)),i))=-3
1889 ibc(itmp(iabs(istrand(k)),i),itmp(iabs(istrand(k+3)),i))=-4
1892 !------------------------
1895 ! freeze sec.elements
1905 do i=bfrag(1,j),bfrag(2,j)
1910 if (bfrag(3,j).le.bfrag(4,j)) then
1911 do i=bfrag(3,j),bfrag(4,j)
1917 do i=bfrag(4,j),bfrag(3,j)
1925 do i=hfrag(1,j),hfrag(2,j)
1933 !------------------------
1934 ! generate constrains
1942 if ( ibc(i,j).eq.-1 .or. ibc(j,i).eq.-1) then
1950 else if ( ibc(i,j).eq.-2 .or. ibc(j,i).eq.-2) then
1958 else if ( ibc(i,j).eq.-3 .or. ibc(j,i).eq.-3) then
1966 else if ( ibc(i,j).eq.-4 .or. ibc(j,i).eq.-4) then
1974 else if ( ibc(i,j).gt.0 ) then
1975 d0(ind)=DIST(i,ibc(i,j))
1982 else if ( ibc(j,i).gt.0 ) then
1983 d0(ind)=DIST(ibc(j,i),j)
1997 !d--------------------------
1999 write(iout,'(i3,2i4,a3,2i4,f7.2)') (i,ibc(ihpb(i),jhpb(i)),&
2000 ibc(jhpb(i),ihpb(i)),' --',&
2001 ihpb(i),jhpb(i),dhpb(i),i=1,nhpb)
2008 call contact_cp_min(varia,ifun,iconf,linia,debug)
2013 call minimize(etot,varia,iretcode,nfun)
2014 write(iout,*)'------------------------------------------------'
2015 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,&
2021 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,&
2022 nfun/(time1-time0),' eval/s'
2024 write (linia,'(a10,10i3)') 'full_min',(istrand(k),k=1,isa)
2025 call var_to_geom(nvar,varia)
2027 call write_pdb(900+iconf,linia,etot)
2032 call enerprint(energy)
2034 !d call briefout(0,etot)
2035 !d call secondary2(.true.)
2039 !ccccccccccccccccccccccccccccccccccc
2042 !ccccccccccccccccccccccccccccccccccc
2045 10 write (iout,'(a)') 'Error reading test structure.'
2047 end subroutine test11
2048 !-----------------------------------------------------------------------------
2051 use geometry, only:dist
2053 ! implicit real*8 (a-h,o-z)
2054 ! include 'DIMENSIONS'
2056 ! include 'COMMON.GEO'
2057 ! include 'COMMON.CHAIN'
2058 ! include 'COMMON.IOUNITS'
2059 ! include 'COMMON.VAR'
2060 ! include 'COMMON.CONTROL'
2061 ! include 'COMMON.SBRIDGE'
2062 ! include 'COMMON.FFIELD'
2063 ! include 'COMMON.MINIM'
2065 ! include 'COMMON.DISTFIT'
2066 integer :: if(3,nres),nif
2067 integer :: ibc(nres,nres),istrand(20)
2068 integer :: ibd(nres),ifb(10,2),nifb,lifb(10),lifb0
2069 real(kind=8) :: time0,time1
2070 real(kind=8) :: energy(0:n_ene),ee
2071 real(kind=8),dimension(6*nres) :: varia !(maxvar) (maxvar=6*maxres)
2073 logical :: debug,ltest
2074 character(len=50) :: linia
2075 integer :: ieval,i,j,ind,in_pdb,nfun,iretcode
2076 real(kind=8) :: etot
2079 read (inp,*,err=20,end=20) if(1,i),if(2,i),if(3,i)
2082 write (*,'(a4,3i5)') ('if =',if(1,i),if(2,i),if(3,i),&
2086 !------------------------
2087 call secondary2(debug)
2088 !------------------------
2096 ! freeze sec.elements and store indexes for beta constrains
2106 do i=bfrag(1,j),bfrag(2,j)
2111 if (bfrag(3,j).le.bfrag(4,j)) then
2112 do i=bfrag(3,j),bfrag(4,j)
2116 ibc(bfrag(1,j)+i-bfrag(3,j),i)=-1
2119 do i=bfrag(4,j),bfrag(3,j)
2123 ibc(bfrag(2,j)-i+bfrag(4,j),i)=-1
2128 do i=hfrag(1,j),hfrag(2,j)
2137 ! ---------------- test --------------
2139 if (ibc(if(1,i),if(2,i)).eq.-1) then
2140 ibc(if(1,i),if(2,i))=if(3,i)
2141 ibc(if(1,i),if(3,i))=if(2,i)
2142 else if (ibc(if(2,i),if(1,i)).eq.-1) then
2143 ibc(if(2,i),if(1,i))=0
2144 ibc(if(1,i),if(2,i))=if(3,i)
2145 ibc(if(1,i),if(3,i))=if(2,i)
2147 ibc(if(1,i),if(2,i))=if(3,i)
2148 ibc(if(1,i),if(3,i))=if(2,i)
2154 if (ibc(i,j).ne.0) write(*,'(3i5)') i,j,ibc(i,j)
2157 !------------------------
2163 if ( ibc(i,j).eq.-1 ) then
2171 else if ( ibc(i,j).gt.0 ) then
2172 d0(ind)=DIST(i,ibc(i,j))
2179 else if ( ibc(j,i).gt.0 ) then
2180 d0(ind)=DIST(ibc(j,i),j)
2194 !d--------------------------
2195 write(*,'(i3,2i4,a3,2i4,f7.2)') (i,ibc(ihpb(i),jhpb(i)),&
2196 ibc(jhpb(i),ihpb(i)),' --',&
2197 ihpb(i),jhpb(i),dhpb(i),i=1,nhpb)
2205 call contact_cp_min(varia,ieval,in_pdb,linia,debug)
2210 call minimize(etot,varia,iretcode,nfun)
2211 write(iout,*)'------------------------------------------------'
2212 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,&
2218 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,&
2219 nfun/(time1-time0),' eval/s'
2222 call var_to_geom(nvar,varia)
2224 call write_pdb(999,'full min',etot)
2229 call enerprint(energy)
2231 call briefout(0,etot)
2232 call secondary2(.true.)
2235 10 write (iout,'(a)') 'Error reading test structure.'
2237 end subroutine test3
2238 !-----------------------------------------------------------------------------
2242 ! implicit real*8 (a-h,o-z)
2243 ! include 'DIMENSIONS'
2245 ! include 'COMMON.GEO'
2246 ! include 'COMMON.CHAIN'
2247 ! include 'COMMON.IOUNITS'
2248 ! include 'COMMON.VAR'
2249 ! include 'COMMON.CONTROL'
2250 ! include 'COMMON.SBRIDGE'
2251 ! include 'COMMON.FFIELD'
2252 ! include 'COMMON.MINIM'
2254 ! include 'COMMON.DISTFIT'
2255 integer :: if(2,2),ind
2256 integer :: iff(nres)
2257 real(kind=8) :: time0,time1
2258 real(kind=8) :: energy(0:n_ene),ee
2259 real(kind=8),dimension(nres) :: theta2,phi2,alph2,omeg2,&
2260 theta1,phi1,alph1,omeg1 !(maxres)
2261 real(kind=8),dimension(6*nres) :: varia,varia2 !(maxvar) (maxvar=6*maxres)
2263 integer :: i,j,nn,ifun,iretcode,nfun
2264 real(kind=8) :: etot
2267 read (inp,*,err=10,end=10) if(1,1),if(1,2),if(2,1),if(2,2)
2268 write (iout,'(a4,4i5)') 'if =',if(1,1),if(1,2),if(2,1),if(2,2)
2269 read (inp,*,err=10,end=10) (theta2(i),i=3,nres)
2270 read (inp,*,err=10,end=10) (phi2(i),i=4,nres)
2271 read (inp,*,err=10,end=10) (alph2(i),i=2,nres-1)
2272 read (inp,*,err=10,end=10) (omeg2(i),i=2,nres-1)
2274 theta2(i)=deg2rad*theta2(i)
2275 phi2(i)=deg2rad*phi2(i)
2276 alph2(i)=deg2rad*alph2(i)
2277 omeg2(i)=deg2rad*omeg2(i)
2291 !------------------------
2296 do i=if(j,1),if(j,2)
2302 call geom_to_var(nvar,varia)
2303 call write_pdb(1,'first structure',0d0)
2305 call secondary(.true.)
2307 call secondary2(.true.)
2310 if ( (bfrag(3,j).lt.bfrag(4,j) .or. &
2311 bfrag(4,j)-bfrag(2,j).gt.4) .and. &
2312 bfrag(2,j)-bfrag(1,j).gt.3 ) then
2315 if (bfrag(3,j).lt.bfrag(4,j)) then
2316 write(iout,'(a6,i3,a1,i3,a1,i3,a1,i3)') &
2317 "select",bfrag(1,j)-1,"-",bfrag(2,j)-1,&
2318 ",",bfrag(3,j)-1,"-",bfrag(4,j)-1
2320 write(iout,'(a6,i3,a1,i3,a1,i3,a1,i3)') &
2321 "select",bfrag(1,j)-1,"-",bfrag(2,j)-1,&
2322 ",",bfrag(4,j)-1,"-",bfrag(3,j)-1
2335 call geom_to_var(nvar,varia2)
2336 call write_pdb(2,'second structure',0d0)
2340 !-------------------------------------------------------
2343 call contact_cp(varia,varia2,iff,ifun,7)
2348 call minimize(etot,varia,iretcode,nfun)
2349 write(iout,*)'------------------------------------------------'
2350 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,&
2356 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,&
2357 nfun/(time1-time0),' eval/s'
2360 call var_to_geom(nvar,varia)
2362 call write_pdb(999,'full min',etot)
2367 call enerprint(energy)
2369 call briefout(0,etot)
2372 10 write (iout,'(a)') 'Error reading test structure.'
2374 end subroutine test__
2375 !-----------------------------------------------------------------------------
2376 subroutine secondary(lprint)
2378 ! implicit real*8 (a-h,o-z)
2379 ! include 'DIMENSIONS'
2380 ! include 'COMMON.CHAIN'
2381 ! include 'COMMON.IOUNITS'
2382 ! include 'COMMON.DISTFIT'
2384 integer :: ncont,isec(nres,3)
2385 logical :: lprint,not_done
2387 real(kind=4) :: rcomp = 7.0
2388 real(kind=4) :: rbeta = 5.2
2389 real(kind=4) :: ralfa = 5.2
2390 real(kind=4) :: r310 = 6.6
2391 real(kind=8),dimension(3) :: xpi,xpj
2392 integer :: i,k,j,i1,j1,nbeta,nstrand,ii1,jj1,ij,iii1,jjj1,&
2394 integer, dimension(:,:),allocatable :: icont
2395 real(kind=4),dimension(:),allocatable :: dcont
2396 if (.not.allocated(icont)) then
2397 allocate(icont(2,100*nres_molec(1)+1))
2399 if (.not.allocated(dcont)) then
2400 allocate(dcont(100*nres_molec(1)+1))
2402 call chainbuild_cart
2403 !d call write_pdb(99,'sec structure',0d0)
2415 xpi(k)=0.5d0*(c(k,i-1)+c(k,i))
2419 xpj(k)=0.5d0*(c(k,j-1)+c(k,j))
2421 !d d = (c(1,i)-c(1,j))*(c(1,i)-c(1,j)) +
2422 !d & (c(2,i)-c(2,j))*(c(2,i)-c(2,j)) +
2423 !d & (c(3,i)-c(3,j))*(c(3,i)-c(3,j))
2424 !d print *,'CA',i,j,d
2425 d = (xpi(1)-xpj(1))*(xpi(1)-xpj(1)) + &
2426 (xpi(2)-xpj(2))*(xpi(2)-xpj(2)) + &
2427 (xpi(3)-xpj(3))*(xpi(3)-xpj(3))
2428 if ( d.lt.rcomp*rcomp) then
2429 if (ncont.gt.(100*nres_molec(1)+1)) ncont=100*nres_molec(1)+1
2433 dcont(ncont)=sqrt(d)
2439 write (iout,'(a)') '#PP contact map distances:'
2441 write (iout,'(3i4,f10.5)') &
2442 i,icont(1,i),icont(2,i),dcont(i)
2446 ! finding parallel beta
2447 !d write (iout,*) '------- looking for parallel beta -----------'
2453 if(dcont(i).le.rbeta .and. j1-i1.gt.4 .and. &
2454 isec(i1,1).le.1.and.isec(j1,1).le.1.and. &
2455 (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and. &
2456 (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and. &
2457 (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and. &
2458 (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0) &
2462 !d write (iout,*) i1,j1,dcont(i)
2468 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j) &
2469 .and. dcont(j).le.rbeta .and. &
2470 isec(i1,1).le.1.and.isec(j1,1).le.1.and. &
2471 (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and. &
2472 (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and. &
2473 (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and. &
2474 (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0) &
2479 !d write (iout,*) i1,j1,dcont(j),not_done
2483 if (i1-ii1.gt.1) then
2487 if(lprint)write(iout,*)'parallel beta',nbeta,ii1,i1,jj1,j1
2496 isec(ij,1)=isec(ij,1)+1
2497 isec(ij,1+isec(ij,1))=nbeta
2500 isec(ij,1)=isec(ij,1)+1
2501 isec(ij,1+isec(ij,1))=nbeta
2506 if (nbeta.le.9) then
2507 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
2508 "DefPropRes 'strand",nstrand,&
2509 "' 'num = ",ii1-1,"..",i1-1,"'"
2511 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
2512 "DefPropRes 'strand",nstrand,&
2513 "' 'num = ",ii1-1,"..",i1-1,"'"
2516 if (nbeta.le.9) then
2517 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
2518 "DefPropRes 'strand",nstrand,&
2519 "' 'num = ",jj1-1,"..",j1-1,"'"
2521 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
2522 "DefPropRes 'strand",nstrand,&
2523 "' 'num = ",jj1-1,"..",j1-1,"'"
2525 write(12,'(a8,4i4)') &
2526 "SetNeigh",ii1-1,i1-1,jj1-1,j1-1
2532 ! finding antiparallel beta
2533 !d write (iout,*) '--------- looking for antiparallel beta ---------'
2538 if (dcont(i).le.rbeta.and. &
2539 isec(i1,1).le.1.and.isec(j1,1).le.1.and. &
2540 (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and. &
2541 (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and. &
2542 (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and. &
2543 (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0) &
2547 !d write (iout,*) i1,j1,dcont(i)
2554 if (i1.eq.icont(1,j).and.j1.eq.icont(2,j) .and. &
2555 isec(i1,1).le.1.and.isec(j1,1).le.1.and. &
2556 (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and. &
2557 (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and. &
2558 (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and. &
2559 (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0) &
2560 .and. dcont(j).le.rbeta ) goto 6
2564 !d write (iout,*) i1,j1,dcont(j),not_done
2568 if (i1-ii1.gt.1) then
2569 if(lprint)write (iout,*)'antiparallel beta',&
2570 nbeta,ii1-1,i1,jj1,j1-1
2573 bfrag(1,nbfrag)=max0(ii1-1,1)
2576 bfrag(4,nbfrag)=max0(j1-1,1)
2581 isec(ij,1)=isec(ij,1)+1
2582 isec(ij,1+isec(ij,1))=nbeta
2586 isec(ij,1)=isec(ij,1)+1
2587 isec(ij,1+isec(ij,1))=nbeta
2593 if (nstrand.le.9) then
2594 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
2595 "DefPropRes 'strand",nstrand,&
2596 "' 'num = ",ii1-2,"..",i1-1,"'"
2598 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
2599 "DefPropRes 'strand",nstrand,&
2600 "' 'num = ",ii1-2,"..",i1-1,"'"
2603 if (nstrand.le.9) then
2604 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
2605 "DefPropRes 'strand",nstrand,&
2606 "' 'num = ",j1-2,"..",jj1-1,"'"
2608 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
2609 "DefPropRes 'strand",nstrand,&
2610 "' 'num = ",j1-2,"..",jj1-1,"'"
2612 write(12,'(a8,4i4)') &
2613 "SetNeigh",ii1-2,i1-1,jj1-1,j1-2
2619 if (nstrand.gt.0.and.lprint) then
2620 write(12,'(a27,$)') "DefPropRes 'sheet' 'strand1"
2623 write(12,'(a9,i1,$)') " | strand",i
2625 write(12,'(a9,i2,$)') " | strand",i
2628 write(12,'(a1)') "'"
2632 ! finding alpha or 310 helix
2638 if (j1.eq.i1+3.and.dcont(i).le.r310 &
2639 .or.j1.eq.i1+4.and.dcont(i).le.ralfa ) then
2640 !d if (j1.eq.i1+3) write (iout,*) "found 1-4 ",i1,j1,dcont(i)
2641 !d if (j1.eq.i1+4) write (iout,*) "found 1-5 ",i1,j1,dcont(i)
2644 if (isec(ii1,1).eq.0) then
2653 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
2657 !d write (iout,*) i1,j1,not_done
2660 if (j1-ii1.gt.4) then
2662 !d write (iout,*)'helix',nhelix,ii1,j1
2666 hfrag(2,nhfrag)=max0(j1-1,1)
2672 write (iout,'(a6,i3,2i4)') "Helix",nhelix,ii1-1,j1-2
2673 if (nhelix.le.9) then
2674 write(12,'(a17,i1,a9,i3,a2,i3,a1)') &
2675 "DefPropRes 'helix",nhelix,&
2676 "' 'num = ",ii1-1,"..",j1-2,"'"
2678 write(12,'(a17,i2,a9,i3,a2,i3,a1)') &
2679 "DefPropRes 'helix",nhelix,&
2680 "' 'num = ",ii1-1,"..",j1-2,"'"
2687 if (nhelix.gt.0.and.lprint) then
2688 write(12,'(a26,$)') "DefPropRes 'helix' 'helix1"
2690 if (nhelix.le.9) then
2691 write(12,'(a8,i1,$)') " | helix",i
2693 write(12,'(a8,i2,$)') " | helix",i
2696 write(12,'(a1)') "'"
2700 write(12,'(a37)') "DefPropRes 'coil' '! (helix | sheet)'"
2701 write(12,'(a20)') "XMacStand ribbon.mac"
2705 end subroutine secondary
2706 !-----------------------------------------------------------------------------
2707 subroutine contact_cp2(var,var2,iff,ieval,in_pdb)
2709 use geometry, only:dist
2711 ! implicit real*8 (a-h,o-z)
2712 ! include 'DIMENSIONS'
2714 ! include 'COMMON.SBRIDGE'
2715 ! include 'COMMON.FFIELD'
2716 ! include 'COMMON.IOUNITS'
2717 ! include 'COMMON.DISTFIT'
2718 ! include 'COMMON.VAR'
2719 ! include 'COMMON.CHAIN'
2720 ! include 'COMMON.MINIM'
2722 character(len=50) :: linia
2724 real(kind=8),dimension(6*nres) :: var,var2 !(maxvar) (maxvar=6*maxres)
2725 real(kind=8) :: time0,time1
2726 integer :: iff(nres),ieval
2727 real(kind=8),dimension(nres) :: theta1,phi1,alph1,omeg1 !(maxres)
2730 integer :: in_pdb,i,j,ind,ipot0,maxmin0,maxfun0,nfun,iwsk,iretcode
2731 real(kind=8) :: wstrain0,etot
2733 maxres22=nres*(nres+1)/2
2735 if(.not.allocated(DRDG)) allocate(DRDG(maxres22,maxres22)) !(MAXRES22,MAXRES)
2736 call var_to_geom(nvar,var)
2743 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
2765 call var_to_geom(nvar,var2)
2768 if ( iff(i).eq.1 ) then
2777 !d call write_pdb(3,'combined structure',0d0)
2778 !d time0=MPI_WTIME()
2781 NY=((NRES-4)*(NRES-5))/2
2782 call distfit(.true.,200)
2784 !d time1=MPI_WTIME()
2785 !d write (iout,'(a,f6.2,a)') ' Time for distfit ',time1-time0,' sec'
2795 call geom_to_var(nvar,var)
2796 !d time0=MPI_WTIME()
2797 call minimize(etot,var,iretcode,nfun)
2798 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
2800 !d time1=MPI_WTIME()
2801 !d write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,
2802 !d & nfun/(time1-time0),' SOFT eval/s'
2803 call var_to_geom(nvar,var)
2809 if (iff(1).eq.1) then
2815 if ( iwsk.eq.0.and.iff(i-1).eq.0.and.iff(i).eq.1 ) then
2820 if ( iwsk.eq.1.and.iff(i-1).eq.1.and.iff(i).eq.0 ) then
2826 if (iff(nres).eq.1) then
2832 !d write(linia,'(a6,i3,a1,i3,a1,i3,a1,i3)')
2833 !d & "select",ij(1),"-",ij(2),
2834 !d & ",",ij(3),"-",ij(4)
2835 !d call write_pdb(in_pdb,linia,etot)
2841 !d time0=MPI_WTIME()
2842 call minimize(etot,var,iretcode,nfun)
2843 !d write(iout,*)'SUMSL DIST return code is',iretcode,' eval ',nfun
2846 !d time1=MPI_WTIME()
2847 !d write (iout,'(a,f6.2,f8.2,a)')' Time for DIST min.',time1-time0,
2848 !d & nfun/(time1-time0),' eval/s'
2849 !d call var_to_geom(nvar,var)
2851 !d call write_pdb(6,'dist structure',etot)
2860 end subroutine contact_cp2
2861 !-----------------------------------------------------------------------------
2862 subroutine contact_cp(var,var2,iff,ieval,in_pdb)
2864 use geometry, only:dist
2866 ! implicit real*8 (a-h,o-z)
2867 ! include 'DIMENSIONS'
2868 ! include 'COMMON.SBRIDGE'
2869 ! include 'COMMON.FFIELD'
2870 ! include 'COMMON.IOUNITS'
2871 ! include 'COMMON.DISTFIT'
2872 ! include 'COMMON.VAR'
2873 ! include 'COMMON.CHAIN'
2874 ! include 'COMMON.MINIM'
2876 character(len=50) :: linia
2878 real(kind=8) :: energy(0:n_ene)
2879 real(kind=8),dimension(6*nres) :: var,var2 !(maxvar) (maxvar=6*maxres)
2880 real(kind=8) :: time0,time1
2881 integer :: iff(nres),ieval
2882 real(kind=8),dimension(nres) :: theta1,phi1,alph1,omeg1 !(maxres)
2886 integer :: in_pdb,i,j,ind,iwsk
2890 if (ieval.eq.-1) debug=.true.
2894 ! store selected dist. constrains from 1st structure
2897 ! Intercept NaNs in the coordinates
2898 ! write(iout,*) (var(i),i=1,nvar)
2903 if (x_sum.ne.x_sum) then
2904 write(iout,*)" *** contact_cp : Found NaN in coordinates"
2906 print *," *** contact_cp : Found NaN in coordinates"
2912 call var_to_geom(nvar,var)
2919 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
2942 ! freeze sec.elements from 2nd structure
2950 call var_to_geom(nvar,var2)
2951 call secondary2(debug)
2953 do i=bfrag(1,j),bfrag(2,j)
2958 if (bfrag(3,j).le.bfrag(4,j)) then
2959 do i=bfrag(3,j),bfrag(4,j)
2965 do i=bfrag(4,j),bfrag(3,j)
2973 do i=hfrag(1,j),hfrag(2,j)
2982 ! copy selected res from 1st to 2nd structure
2986 if ( iff(i).eq.1 ) then
2996 ! prepare description in linia variable
3000 if (iff(1).eq.1) then
3006 if ( iwsk.eq.0.and.iff(i-1).eq.0.and.iff(i).eq.1 ) then
3011 if ( iwsk.eq.1.and.iff(i-1).eq.1.and.iff(i).eq.0 ) then
3017 if (iff(nres).eq.1) then
3022 write(linia,'(a6,i3,a1,i3,a1,i3,a1,i3)') &
3023 "SELECT",ij(1)-1,"-",ij(2)-1,&
3024 ",",ij(3)-1,"-",ij(4)-1
3030 call contact_cp_min(var,ieval,in_pdb,linia,debug)
3033 end subroutine contact_cp
3034 !-----------------------------------------------------------------------------
3035 subroutine contact_cp_min(var,ieval,in_pdb,linia,debug)
3039 ! input : theta,phi,alph,omeg,in_pdb,linia,debug
3040 ! output : var,ieval
3042 ! implicit real*8 (a-h,o-z)
3043 ! include 'DIMENSIONS'
3045 ! include 'COMMON.SBRIDGE'
3046 ! include 'COMMON.FFIELD'
3047 ! include 'COMMON.IOUNITS'
3048 ! include 'COMMON.DISTFIT'
3049 ! include 'COMMON.VAR'
3050 ! include 'COMMON.CHAIN'
3051 ! include 'COMMON.MINIM'
3053 character(len=50) :: linia
3055 real(kind=8) :: energy(0:n_ene)
3056 real(kind=8),dimension(6*nres) :: var !(maxvar) (maxvar=6*maxres)
3057 real(kind=8) :: time0,time1
3058 integer :: ieval,info(3)
3059 logical :: debug,fail,reduce,change !check_var,
3062 integer :: in_pdb,i,ipot0,ipot01,maxmin0,maxfun0,maxmin01,maxfun01,&
3064 real(kind=8) :: wsc01,wscp01,welec01,wvdwpp01,wscloc01,wtor01,&
3065 wtor_d01,wstrain0,etot
3067 write(iout,'(a20,i6,a20)') &
3068 '------------------',in_pdb,'-------------------'
3072 call write_pdb(1000+in_pdb,'combined structure',0d0)
3079 ! run optimization of distances
3081 ! uses d0(),w() and mask() for frozen 2D
3083 !test---------------------------------------------
3085 !test NY=((NRES-4)*(NRES-5))/2
3086 !test call distfit(debug,5000)
3118 call geom_to_var(nvar,var)
3119 !de change=reduce(var)
3120 if (check_var(var,info)) then
3121 write(iout,*) 'cp_min error in input'
3122 print *,'cp_min error in input'
3126 !d call etotal(energy(0))
3127 !d call enerprint(energy(0))
3131 !dtest call minimize(etot,var,iretcode,nfun)
3132 !dtest write(iout,*)'SUMSL return code is',iretcode,' eval SDIST',nfun
3135 !d call etotal(energy(0))
3136 !d call enerprint(energy(0))
3155 !test--------------------------------------------------
3161 write (iout,'(a,f6.2,a)')' Time for distfit ',time1-time0,' sec'
3162 call write_pdb(2000+in_pdb,'distfit structure',0d0)
3170 ! run soft pot. optimization
3172 ! nhpb,ihpb(),jhpb(),forcon(),dhpb() and hpb_partition
3174 ! mask_phi(),mask_theta(),mask_side(),mask_r
3180 !de change=reduce(var)
3181 !de if (check_var(var,info)) write(iout,*) 'error before soft'
3185 call minimize(etot,var,iretcode,nfun)
3187 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
3191 write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,&
3192 nfun/(time1-time0),' SOFT eval/s'
3195 call var_to_geom(nvar,var)
3197 call write_pdb(3000+in_pdb,'soft structure',etot)
3201 ! run full UNRES optimization with constrains and frozen 2D
3202 ! the same variables as soft pot. optimizatio
3208 ! check overlaps before calling full UNRES minim
3210 call var_to_geom(nvar,var)
3214 write(iout,*) 'N7 ',energy(0)
3215 if (energy(0).ne.energy(0)) then
3216 write(iout,*) 'N7 error - gives NaN',energy(0)
3220 if (energy(1).eq.1.0d20) then
3221 write (iout,'(a,1pe14.5)')'#N7_OVERLAP evdw=1d20',energy(1)
3222 call overlap_sc(fail)
3226 write (iout,'(a,1pe14.5)')'#N7_OVERLAP evdw after',energy(1)
3238 !dte time0=MPI_WTIME()
3239 !de change=reduce(var)
3240 !de if (check_var(var,info)) then
3241 !de write(iout,*) 'error before mask dist'
3242 !de call var_to_geom(nvar,var)
3244 !de call write_pdb(10000+in_pdb,'before mask dist',etot)
3246 !dte call minimize(etot,var,iretcode,nfun)
3247 !dte write(iout,*)'SUMSL MASK DIST return code is',iretcode,
3248 !dte & ' eval ',nfun
3249 !dte ieval=ieval+nfun
3251 !dte time1=MPI_WTIME()
3252 !dte write (iout,'(a,f6.2,f8.2,a)')
3253 !dte & ' Time for mask dist min.',time1-time0,
3254 !dte & nfun/(time1-time0),' eval/s'
3255 !dte call flush(iout)
3258 call var_to_geom(nvar,var)
3260 call write_pdb(4000+in_pdb,'mask dist',etot)
3263 ! switch off freezing of 2D and
3264 ! run full UNRES optimization with constrains
3270 !de change=reduce(var)
3271 !de if (check_var(var,info)) then
3272 !de write(iout,*) 'error before dist'
3273 !de call var_to_geom(nvar,var)
3275 !de call write_pdb(11000+in_pdb,'before dist',etot)
3278 call minimize(etot,var,iretcode,nfun)
3280 !de change=reduce(var)
3281 !de if (check_var(var,info)) then
3282 !de write(iout,*) 'error after dist',ico
3283 !de call var_to_geom(nvar,var)
3285 !de call write_pdb(12000+in_pdb+ico*1000,'after dist',etot)
3287 write(iout,*)'SUMSL DIST return code is',iretcode,' eval ',nfun
3293 write (iout,'(a,f6.2,f8.2,a)')' Time for dist min.',time1-time0,&
3294 nfun/(time1-time0),' eval/s'
3296 !de call etotal(energy(0))
3297 !de write(iout,*) 'N7 after dist',energy(0)
3301 call var_to_geom(nvar,var)
3303 call write_pdb(in_pdb,linia,etot)
3315 end subroutine contact_cp_min
3316 !-----------------------------------------------------------------------------
3319 use geometry, only:dist
3321 ! implicit real*8 (a-h,o-z)
3322 ! include 'DIMENSIONS'
3324 ! include 'COMMON.GEO'
3325 ! include 'COMMON.CHAIN'
3326 ! include 'COMMON.IOUNITS'
3327 ! include 'COMMON.VAR'
3328 ! include 'COMMON.CONTROL'
3329 ! include 'COMMON.SBRIDGE'
3330 ! include 'COMMON.FFIELD'
3331 ! include 'COMMON.MINIM'
3332 ! include 'COMMON.INTERACT'
3334 ! include 'COMMON.DISTFIT'
3335 integer :: iff(nres)
3336 real(kind=8) :: time0,time1
3337 real(kind=8) :: energy(0:n_ene),ee
3338 real(kind=8),dimension(6*nres) :: var !(maxvar) (maxvar=6*maxres)
3340 logical :: debug,ltest,fail
3341 character(len=50) :: linia
3342 integer :: ieval,i,j,in_pdb,ipot0,maxmin0,maxfun0,ico,nhpb_c,&
3344 real(kind=8) :: wstrain0,wang0,etot
3350 !------------------------
3352 ! freeze sec.elements
3362 do i=bfrag(1,j),bfrag(2,j)
3367 if (bfrag(3,j).le.bfrag(4,j)) then
3368 do i=bfrag(3,j),bfrag(4,j)
3374 do i=bfrag(4,j),bfrag(3,j)
3382 do i=hfrag(1,j),hfrag(2,j)
3394 ! store dist. constrains
3398 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
3403 dhpb(nhpb)=DIST(i,j)
3411 call write_pdb(100+in_pdb,'input reg. structure',0d0)
3421 ! run soft pot. optimization
3427 call geom_to_var(nvar,var)
3431 call minimize(etot,var,iretcode,nfun)
3433 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
3437 write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,&
3438 nfun/(time1-time0),' SOFT eval/s'
3440 call var_to_geom(nvar,var)
3442 call write_pdb(300+in_pdb,'soft structure',etot)
3445 ! run full UNRES optimization with constrains and frozen 2D
3446 ! the same variables as soft pot. optimizatio
3455 call minimize(etot,var,iretcode,nfun)
3456 write(iout,*)'SUMSL MASK DIST return code is',iretcode,&
3463 write (iout,'(a,f6.2,f8.2,a)') &
3464 ' Time for mask dist min.',time1-time0,&
3465 nfun/(time1-time0),' eval/s'
3467 call var_to_geom(nvar,var)
3469 call write_pdb(400+in_pdb,'mask & dist',etot)
3472 ! switch off constrains and
3473 ! run full UNRES optimization with frozen 2D
3488 call minimize(etot,var,iretcode,nfun)
3489 write(iout,*)'SUMSL MASK return code is',iretcode,' eval ',nfun
3495 write (iout,'(a,f6.2,f8.2,a)')' Time for mask min.',time1-time0,&
3496 nfun/(time1-time0),' eval/s'
3500 call var_to_geom(nvar,var)
3502 call write_pdb(500+in_pdb,'mask 2d frozen',etot)
3509 ! run full UNRES optimization with constrains and NO frozen 2D
3519 wstrain=wstrain0/ico
3524 call minimize(etot,var,iretcode,nfun)
3525 write(iout,'(a10,f6.3,a14,i3,a6,i5)') &
3526 ' SUMSL DIST',wstrain,' return code is',iretcode,&
3533 write (iout,'(a,f6.2,f8.2,a)') &
3534 ' Time for dist min.',time1-time0,&
3535 nfun/(time1-time0),' eval/s'
3537 call var_to_geom(nvar,var)
3539 call write_pdb(600+in_pdb+ico,'dist cons',etot)
3556 call minimize(etot,var,iretcode,nfun)
3557 write(iout,*)'------------------------------------------------'
3558 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,&
3564 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,&
3565 nfun/(time1-time0),' eval/s'
3568 call var_to_geom(nvar,var)
3570 call write_pdb(999,'full min',etot)
3574 end subroutine softreg
3575 !-----------------------------------------------------------------------------
3576 subroutine beta_slide(i1,i2,i3,i4,i5,ieval,ij)
3578 use geometry, only:dist
3580 ! implicit real*8 (a-h,o-z)
3581 ! include 'DIMENSIONS'
3583 ! include 'COMMON.GEO'
3584 ! include 'COMMON.VAR'
3585 ! include 'COMMON.INTERACT'
3586 ! include 'COMMON.IOUNITS'
3587 ! include 'COMMON.DISTFIT'
3588 ! include 'COMMON.SBRIDGE'
3589 ! include 'COMMON.CONTROL'
3590 ! include 'COMMON.FFIELD'
3591 ! include 'COMMON.MINIM'
3592 ! include 'COMMON.CHAIN'
3593 real(kind=8) :: time0,time1
3594 real(kind=8) :: energy(0:n_ene),ee
3595 real(kind=8),dimension(6*nres) :: var !(maxvar) (maxvar=6*maxres)
3596 integer :: jdata(5),isec(nres)
3599 integer :: i1,i2,i3,i4,i5,ieval,ij
3600 integer :: i,j,nft_sc,ishift,iretcode,nfun,maxfun0,ico
3601 real(kind=8) :: etot,wscloc0,wstrain0
3609 call secondary2(.false.)
3615 do i=bfrag(1,j),bfrag(2,j)
3618 do i=bfrag(4,j),bfrag(3,j),sign(1,bfrag(3,j)-bfrag(4,j))
3623 do i=hfrag(1,j),hfrag(2,j)
3629 ! cut strands at the ends
3631 if (jdata(2)-jdata(1).gt.3) then
3634 if (jdata(3).lt.jdata(4)) then
3644 !v call etotal(energy(0))
3646 !v write(iout,*) nnt,nct,etot
3647 !v call write_pdb(ij*100,'first structure',etot)
3648 !v write(iout,*) 'N16 test',(jdata(i),i=1,5)
3650 !------------------------
3651 ! generate constrains
3654 if(ishift.eq.0) ishift=-2
3657 do i=jdata(1),jdata(2)
3659 if(jdata(4).gt.jdata(3))then
3660 do j=jdata(3)+i-jdata(1)-2,jdata(3)+i-jdata(1)+2
3662 !d print *,i,j,j+ishift
3667 dhpb(nhpb)=DIST(i,j+ishift)
3670 do j=jdata(3)-i+jdata(1)+2,jdata(3)-i+jdata(1)-2,-1
3672 !d print *,i,j,j+ishift
3677 dhpb(nhpb)=DIST(i,j+ishift)
3684 if(isec(i).gt.0.or.isec(j).gt.0) then
3690 dhpb(nhpb)=DIST(i,j)
3697 call geom_to_var(nvar,var)
3704 wstrain=wstrain0/ico
3706 !v time0=MPI_WTIME()
3707 call minimize(etot,var,iretcode,nfun)
3708 write(iout,'(a10,f6.3,a14,i3,a6,i5)') &
3709 ' SUMSL DIST',wstrain,' return code is',iretcode,&
3712 !v time1=MPI_WTIME()
3713 !v write (iout,'(a,f6.2,f8.2,a)')
3714 !v & ' Time for dist min.',time1-time0,
3715 !v & nfun/(time1-time0),' eval/s'
3716 !v call var_to_geom(nvar,var)
3718 !v call write_pdb(ij*100+ico,'dist cons',etot)
3730 call sc_move(nnt,nct,100,100d0,nft_sc,etot)
3733 !v call etotal(energy(0))
3735 !v call write_pdb(ij*100+10,'sc_move',etot)
3737 !d print *,nft_sc,etot
3740 end subroutine beta_slide
3741 !-----------------------------------------------------------------------------
3742 subroutine beta_zip(i1,i2,ieval,ij)
3745 ! implicit real*8 (a-h,o-z)
3746 ! include 'DIMENSIONS'
3748 ! include 'COMMON.GEO'
3749 ! include 'COMMON.VAR'
3750 ! include 'COMMON.INTERACT'
3751 ! include 'COMMON.IOUNITS'
3752 ! include 'COMMON.DISTFIT'
3753 ! include 'COMMON.SBRIDGE'
3754 ! include 'COMMON.CONTROL'
3755 ! include 'COMMON.FFIELD'
3756 ! include 'COMMON.MINIM'
3757 ! include 'COMMON.CHAIN'
3758 real(kind=8) :: time0,time1
3759 real(kind=8) :: energy(0:n_ene),ee
3760 real(kind=8),dimension(6*nres) :: var !(maxvar) (maxvar=6*maxres)
3761 character(len=10) :: test
3763 integer :: i1,i2,ieval,ij,ico,iretcode,nfun,maxfun0
3764 real(kind=8) :: etot,wstrain0
3766 !v call etotal(energy(0))
3768 !v write(test,'(2i5)') i1,i2
3769 !v call write_pdb(ij*100,test,etot)
3770 !v write(iout,*) 'N17 test',i1,i2,etot,ij
3773 ! generate constrains
3784 call geom_to_var(nvar,var)
3790 wstrain=wstrain0/ico
3791 !v time0=MPI_WTIME()
3792 call minimize(etot,var,iretcode,nfun)
3793 write(iout,'(a10,f6.3,a14,i3,a6,i5)') &
3794 ' SUMSL DIST',wstrain,' return code is',iretcode,&
3797 !v time1=MPI_WTIME()
3798 !v write (iout,'(a,f6.2,f8.2,a)')
3799 !v & ' Time for dist min.',time1-time0,
3800 !v & nfun/(time1-time0),' eval/s'
3801 ! do not comment the next line
3802 call var_to_geom(nvar,var)
3804 !v call write_pdb(ij*100+ico,'dist cons',etot)
3812 !v call etotal(energy(0))
3814 !v write(iout,*) 'N17 test end',i1,i2,etot,ij
3817 end subroutine beta_zip
3818 !-----------------------------------------------------------------------------
3820 !-----------------------------------------------------------------------------
3821 subroutine thread_seq
3823 use geometry, only:dist
3824 use random, only:iran_num
3825 use control, only:tcpu
3826 use regularize_, only:regularize
3827 use mcm_data, only: nsave_part,nacc_tot
3828 ! Thread the sequence through a database of known structures
3829 ! implicit real*8 (a-h,o-z)
3830 ! include 'DIMENSIONS'
3831 use MPI_data !include 'COMMON.INFO'
3836 ! include 'COMMON.CONTROL'
3837 ! include 'COMMON.CHAIN'
3838 ! include 'COMMON.DBASE'
3839 ! include 'COMMON.INTERACT'
3840 ! include 'COMMON.VAR'
3841 ! include 'COMMON.THREAD'
3842 ! include 'COMMON.FFIELD'
3843 ! include 'COMMON.SBRIDGE'
3844 ! include 'COMMON.HEADER'
3845 ! include 'COMMON.IOUNITS'
3846 ! include 'COMMON.TIME1'
3847 ! include 'COMMON.CONTACTS'
3848 ! include 'COMMON.MCM'
3849 ! include 'COMMON.NAMES'
3851 integer :: ThreadId,ThreadType,Kwita
3853 real(kind=8),dimension(6*nres) :: varia !(maxvar) (maxvar=6*maxres)
3854 real(kind=8) :: przes(3),obr(3,3)
3855 real(kind=8) :: time_for_thread
3856 logical :: found_pattern,non_conv
3857 character(len=32) :: head_pdb
3858 real(kind=8) :: energia(0:n_ene)
3859 integer :: i,j,ithread,itrial,ii,jj,nres_t,ist,ipattern,iretcode,&
3861 real(kind=8) :: dcj,rms,frac,frac_nn,co,etot,curr_tim,curr_tim1
3863 n_ene_comp=nprint_ene
3868 if (me.eq.king) then
3887 ave_time_for_thread=0.0D0
3888 max_time_for_thread=0.0D0
3889 !d print *,'nthread=',nthread,' nseq=',nseq,' nres0=',nres0
3890 nthread=nexcl+nthread
3891 do ithread=1,nthread
3892 found_pattern=.false.
3894 do while (.not.found_pattern)
3896 if (itrial.gt.1000) then
3897 write (iout,'(/a/)') 'Too many attempts to find pattern.'
3900 call recv_stop_sig(Kwita)
3901 call send_stop_sig(-3)
3905 ! Find long enough chain in the database
3907 nres_t=nres_base(1,ii)
3908 ! Select the starting position to thread.
3909 print *,'nseq',nseq,' ii=',ii,' nres_t=',&
3910 nres_t,' nres0=',nres0
3911 if (nres_t.ge.nres0) then
3912 ist=iran_num(0,nres_t-nres0)
3914 if (Kwita.eq.0) call recv_stop_sig(Kwita)
3915 if (Kwita.lt.0) then
3916 write (iout,*) 'Stop signal received. Terminating.'
3917 write (*,*) 'Stop signal received. Terminating.'
3919 write (*,*) 'ithread=',ithread,' nthread=',nthread
3922 call pattern_receive
3925 if (iexam(1,i).eq.ii .and. iexam(2,i).eq.ist) goto 10
3927 found_pattern=.true.
3929 ! If this point is reached, the pattern has not yet been examined.
3931 ! print *,'found_pattern:',found_pattern
3937 if (Kwita.eq.0) call recv_stop_sig(Kwita)
3938 if (Kwita.lt.0) then
3939 write (iout,*) 'Stop signal received. Terminating.'
3941 write (*,*) 'ithread=',ithread,' nthread=',nthread
3947 ipatt(2,ithread)=ist
3949 write (iout,'(/80(1h*)/a,i4,a,i5,2a,i3,a,i3,a,i3/)') &
3950 'Processor:',me,' Attempt:',ithread,&
3951 ' pattern: ',str_nam(ii),nres_base(2,ii),':',nres_base(3,ii),&
3952 ' start at res.',ist+1
3953 write (*,'(a,i4,a,i5,2a,i3,a,i3,a,i3)') 'Processor:',me,&
3954 ' Attempt:',ithread,&
3955 ' pattern: ',str_nam(ii),nres_base(2,ii),':',nres_base(3,ii),&
3956 ' start at res.',ist+1
3958 write (iout,'(/80(1h*)/a,i5,2a,i3,a,i3,a,i3/)') &
3959 'Attempt:',ithread,&
3960 ' pattern: ',str_nam(ii),nres_base(2,ii),':',nres_base(3,ii),&
3961 ' start at res.',ist+1
3962 write (*,'(a,i5,2a,i3,a,i3,a,i3)') &
3963 'Attempt:',ithread,&
3964 ' pattern: ',str_nam(ii),nres_base(2,ii),':',nres_base(3,ii),&
3965 ' start at res.',ist+1
3968 ! Copy coordinates from the database.
3972 c(j,i)=cart_base(j,i+ist,ii)
3975 !d write (iout,'(a,i4,3f10.5)') restyp(itype(i,1)),i,(c(j,i),j=1,3)
3977 !d call fitsq(rms,c(1,nnt),cref(1,nnt),nct-nnt+1,przes,obr,
3979 !d write (iout,'(a,f10.5)')
3980 !d & 'Initial RMS deviation from reference structure:',rms
3981 if (itype(nres,1).eq.ntyp1) then
3983 dcj=c(j,nres-2)-c(j,nres-3)
3984 c(j,nres)=c(j,nres-1)+dcj
3985 c(j,2*nres)=c(j,nres)
3988 if (itype(1,1).eq.ntyp1) then
3995 call int_from_cart(.false.,.false.)
3996 !d print *,'Exit INT_FROM_CART.'
3997 !d print *,'nhpb=',nhpb
4002 ! write (iout,'(2i5,2f10.5)') ihpb(i),jhpb(i),dhpb(i),forcon(i)
4004 ! stop 'End generate'
4005 ! Generate SC conformations.
4009 !d print *,'Processor:',me,': exit GEN_SIDE.'
4011 !d print *,'Exit GEN_SIDE.'
4013 ! Calculate initial energy.
4015 call etotal(energia)
4018 ener0(i,ithread)=energia(i)
4020 ener0(n_ene_comp+1,ithread)=energia(0)
4022 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
4023 ener0(n_ene_comp+3,ithread)=contact_fract(ncont,ncont_ref,&
4025 ener0(n_ene_comp+2,ithread)=rms
4026 ener0(n_ene_comp+4,ithread)=frac
4027 ener0(n_ene_comp+5,ithread)=frac_nn
4029 ener0(n_ene_comp+3,ithread)=0.0d0
4032 print*,'Processor:',me,' ithread=',ithread,' Start REGULARIZE.'
4034 print*,'ithread=',ithread,' Start REGULARIZE.'
4037 call regularize(nct-nnt+1,etot,rms,&
4038 cart_base(1,ist+nnt,ipattern),iretcode)
4040 time_for_thread=curr_tim1-curr_tim
4041 ave_time_for_thread= &
4042 ((ithread-1)*ave_time_for_thread+time_for_thread)/ithread
4043 if (time_for_thread.gt.max_time_for_thread) &
4044 max_time_for_thread=time_for_thread
4046 print *,'Processor',me,': Exit REGULARIZE.'
4047 if (WhatsUp.eq.2) then
4049 'Sufficient number of confs. collected. Terminating.'
4052 else if (WhatsUp.eq.-1) then
4054 write (iout,*) 'Time up in REGULARIZE. Call SEND_STOP_SIG.'
4055 if (Kwita.eq.0) call recv_stop_sig(Kwita)
4056 call send_stop_sig(-2)
4058 else if (WhatsUp.eq.-2) then
4060 write (iout,*) 'Timeup signal received. Terminating.'
4062 else if (WhatsUp.eq.-3) then
4064 write (iout,*) 'Error stop signal received. Terminating.'
4068 print *,'Exit REGULARIZE.'
4069 if (iretcode.eq.11) then
4070 write (iout,'(/a/)') &
4071 '******* Allocated time exceeded in SUMSL. The program will stop.'
4076 head_pdb=titel(:24)//':'//str_nam(ipattern)
4077 if (outpdb) call pdbout(etot,head_pdb,ipdb)
4078 if (outmol2) call mol2out(etot,head_pdb)
4080 call briefout(ithread,etot)
4082 link_end=min0(link_end,nss)
4083 write (iout,*) 'link_end=',link_end,' link_end0=',link_end0,&
4085 call etotal(energia)
4086 ! call enerprint(energia(0))
4089 !d call fitsq(rms,c(1,nnt),cref(1,nnt),nct-nnt+1,przes,obr,non_conv)
4090 !d write (iout,'(a,f10.5)')
4091 !d & 'RMS deviation from reference structure:',dsqrt(rms)
4093 ener(i,ithread)=energia(i)
4095 ener(n_ene_comp+1,ithread)=energia(0)
4096 ener(n_ene_comp+3,ithread)=rms
4098 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
4099 ener(n_ene_comp+2,ithread)=rms
4100 ener(n_ene_comp+4,ithread)=frac
4101 ener(n_ene_comp+5,ithread)=frac_nn
4103 call write_stat_thread(ithread,ipattern,ist)
4104 ! write (istat,'(i4,2x,a8,i4,11(1pe14.5),2(0pf8.3),f8.5)')
4105 ! & ithread,str_nam(ipattern),ist+1,(ener(k,ithread),k=1,11),
4106 ! & (ener(k,ithread),k=12,14)
4108 if (me.eq.king) then
4110 call pattern_receive
4111 call receive_MCM_info
4112 if (nacc_tot.ge.nthread) then
4114 'Sufficient number of conformations collected nacc_tot=',&
4115 nacc_tot,'. Stopping other processors and terminating.'
4117 'Sufficient number of conformations collected nacc_tot=',&
4118 nacc_tot,'. Stopping other processors and terminating.'
4119 call recv_stop_sig(Kwita)
4120 if (Kwita.eq.0) call send_stop_sig(-1)
4125 call send_MCM_info(2)
4128 if (timlim-curr_tim1-safety .lt. max_time_for_thread) then
4129 write (iout,'(/2a)') &
4130 '********** There would be not enough time for another thread. ',&
4131 'The program will stop.'
4133 '********** There would be not enough time for another thread. ',&
4134 'The program will stop.'
4135 write (iout,'(a,1pe14.4/)') &
4136 'Elapsed time for last threading step: ',time_for_thread
4139 call recv_stop_sig(Kwita)
4140 call send_stop_sig(-2)
4145 write (iout,'(a,1pe14.4)') &
4146 'Elapsed time for this threading step: ',time_for_thread
4149 if (Kwita.eq.0) call recv_stop_sig(Kwita)
4150 if (Kwita.lt.0) then
4151 write (iout,*) 'Stop signal received. Terminating.'
4152 write (*,*) 'Stop signal received. Terminating.'
4154 write (*,*) 'nthread=',nthread,' ithread=',ithread
4160 call send_stop_sig(-1)
4164 ! Any messages left for me?
4165 call pattern_receive
4166 if (Kwita.eq.0) call recv_stop_sig(Kwita)
4168 call write_thread_summary
4170 if (king.eq.king) then
4172 do while (Kwita.ne.0 .or. nacc_tot.ne.0)
4175 call recv_stop_sig(Kwita)
4176 call receive_MCM_info
4179 call receive_thread_results(iproc)
4181 call write_thread_summary
4183 call send_thread_results
4187 end subroutine thread_seq
4188 !-----------------------------------------------------------------------------
4191 ! Sample (hopefully) optimal SC orientations given backcone conformation.
4193 use random, only:iran_num
4194 ! implicit real*8 (a-h,o-z)
4195 ! include 'DIMENSIONS'
4196 ! include 'COMMON.CHAIN'
4197 ! include 'COMMON.DBASE'
4198 ! include 'COMMON.INTERACT'
4199 ! include 'COMMON.VAR'
4200 ! include 'COMMON.THREAD'
4201 ! include 'COMMON.FFIELD'
4202 ! include 'COMMON.SBRIDGE'
4203 ! include 'COMMON.HEADER'
4204 ! include 'COMMON.GEO'
4205 ! include 'COMMON.IOUNITS'
4206 real(kind=8),dimension(6*nres) :: varia !(maxvar) (maxvar=6*maxres)
4207 !el integer :: icall
4208 !el common /srutu/ icall
4209 real(kind=8) :: energia(0:n_ene)
4210 logical :: glycine,fail
4211 integer :: i,maxsample,link_end0,ind_sc,isample
4212 real(kind=8) :: alph0,omeg0,e1,e0
4216 link_end=min0(link_end,nss)
4218 if (itype(i,1).ne.10) then
4219 !d print *,'i=',i,' itype=',itype(i,1),' theta=',theta(i+1)
4220 call gen_side(itype(i,1),theta(i+1),alph(i),omeg(i),fail,1)
4224 call etotal(energia)
4226 do isample=1,maxsample
4227 ! Choose a non-glycine side chain.
4230 ind_sc=iran_num(nnt,nct)
4231 glycine=(itype(ind_sc,1).eq.10)
4235 call gen_side(itype(ind_sc,1),theta(ind_sc+1),alph(ind_sc),&
4236 omeg(ind_sc),fail,1)
4238 call etotal(energia)
4239 !d write (iout,'(a,i5,a,i4,2(a,f8.3),2(a,1pe14.5))')
4240 !d & 'Step:',isample,' SC',ind_sc,' alpha',alph(ind_sc)*rad2deg,
4241 !d & ' omega',omeg(ind_sc)*rad2deg,' old energy',e0,' new energy',e1
4252 end subroutine sc_conf
4253 !-----------------------------------------------------------------------------
4255 !-----------------------------------------------------------------------------
4256 logical function check_var(var,info)
4260 ! implicit real*8 (a-h,o-z)
4261 ! include 'DIMENSIONS'
4262 ! include 'COMMON.VAR'
4263 ! include 'COMMON.IOUNITS'
4264 ! include 'COMMON.GEO'
4265 ! include 'COMMON.SETUP'
4266 real(kind=8),dimension(6*nres) :: var !(maxvar) (maxvar=6*maxres)
4267 integer,dimension(3) :: info
4271 do i=nphi+ntheta+1,nphi+ntheta+nside
4272 ! Check the side chain "valence" angles alpha
4273 if (var(i).lt.1.0d-7) then
4274 write (iout,*) 'CHUJ NASTAPIL ABSOLUTNY!!!!!!!!!!!!'
4275 write (iout,*) 'Processor',me,'received bad variables!!!!'
4276 write (iout,*) 'Variables'
4277 write (iout,'(8f10.4)') (rad2deg*var(j),j=1,nvar)
4278 write (iout,*) 'Continuing calculations at this point',&
4279 ' could destroy the results obtained so far... ABORTING!!!!!!'
4280 write (iout,'(a19,i5,f10.4,a4,2i4,a3,i3)') &
4281 'valence angle alpha',i-nphi-ntheta,var(i),&
4282 'n it',info(1),info(2),'mv ',info(3)
4283 write (*,*) 'CHUJ NASTAPIL ABSOLUTNY!!!!!!!!!!!!'
4284 write (*,*) 'Processor',me,'received bad variables!!!!'
4285 write (*,*) 'Variables'
4286 write (*,'(8f10.4)') (rad2deg*var(j),j=1,nvar)
4287 write (*,*) 'Continuing calculations at this point',&
4288 ' could destroy the results obtained so far... ABORTING!!!!!!'
4289 write (*,'(a19,i5,f10.4,a4,2i4,a3,i3)') &
4290 'valence angle alpha',i-nphi-ntheta,var(i),&
4291 'n it',info(1),info(2),'mv ',info(3)
4296 ! Check the backbone "valence" angles theta
4297 do i=nphi+1,nphi+ntheta
4298 if (var(i).lt.1.0d-7) then
4299 write (iout,*) 'CHUJ NASTAPIL ABSOLUTNY!!!!!!!!!!!!'
4300 write (iout,*) 'Processor',me,'received bad variables!!!!'
4301 write (iout,*) 'Variables'
4302 write (iout,'(8f10.4)') (rad2deg*var(j),j=1,nvar)
4303 write (iout,*) 'Continuing calculations at this point',&
4304 ' could destroy the results obtained so far... ABORTING!!!!!!'
4305 write (iout,'(a19,i5,f10.4,a4,2i4,a3,i3)') &
4306 'valence angle theta',i-nphi,var(i),&
4307 'n it',info(1),info(2),'mv ',info(3)
4308 write (*,*) 'CHUJ NASTAPIL ABSOLUTNY!!!!!!!!!!!!'
4309 write (*,*) 'Processor',me,'received bad variables!!!!'
4310 write (*,*) 'Variables'
4311 write (*,'(8f10.4)') (rad2deg*var(j),j=1,nvar)
4312 write (*,*) 'Continuing calculations at this point',&
4313 ' could destroy the results obtained so far... ABORTING!!!!!!'
4314 write (*,'(a19,i5,f10.4,a4,2i4,a3,i3)') &
4315 'valence angle theta',i-nphi,var(i),&
4316 'n it',info(1),info(2),'mv ',info(3)
4322 end function check_var
4323 !-----------------------------------------------------------------------------
4325 !-----------------------------------------------------------------------------
4326 subroutine distfit(debug,maxit)
4328 use geometry_data, only: phi
4331 ! implicit real*8 (a-h,o-z)
4332 ! include 'DIMENSIONS'
4333 ! include 'COMMON.CHAIN'
4334 ! include 'COMMON.VAR'
4335 ! include 'COMMON.IOUNITS'
4336 ! include 'COMMON.DISTFIT'
4337 integer :: i,maxit,MAXMAR,IT,IMAR
4338 real(kind=8),DIMENSION(nres) :: X,DIAGH,phiold !(maxres)
4339 logical :: debug,sing
4340 real(kind=8) :: TOL,RL,F0,AIN,F1
4342 !input------------------------------------
4344 ! NY=((NRES-4)*(NRES-5))/2
4345 !input------------------------------------
4351 CALL TRANSFER(NRES,phi,phiold)
4355 !d WRITE (IOUT,*) 'DISTFIT: F0=',F0
4371 CALL TRANSFER(NX,XX,X)
4372 CALL BANACH(NX,NRES,H,X,sing)
4377 IF (AIN.LT.0.1*TOL .AND. RL.LT.1.0E-4) THEN
4379 WRITE (IOUT,*) 'DISTFIT: CONVERGENCE HAS BEEN ACHIEVED'
4380 WRITE (IOUT,*) 'IT=',it,'F=',F0
4385 phi(I)=phiold(I)+mask(i)*X(I-3)
4390 !d WRITE (IOUT,*) 'IMAR=',IMAR,' RL=',RL,' F1=',F1
4392 CALL TRANSFER(NRES,phi,phiold)
4395 ELSE IF (DABS(F1-F0).LT.1.0E-5) THEN
4397 WRITE (IOUT,*) 'DISTFIT: CANNOT IMPROVE DISTANCE FIT'
4398 WRITE (IOUT,*) 'IT=',it,'F=',F1
4404 WRITE (IOUT,*) 'DISTFIT: MARQUARDT PROCEDURE HAS FAILED'
4405 WRITE (IOUT,*) 'IT=',it,'F=',F0
4406 CALL TRANSFER(NRES,phiold,phi)
4409 !d write (iout,*) "it",it," imar",imar," f0",f0
4411 WRITE (IOUT,*) 'DISTFIT: FINAL F=',F0,'after MAXIT=',maxit
4413 end subroutine distfit
4414 !-----------------------------------------------------------------------------
4415 real(kind=8) function RDIF()
4418 use geometry, only: dist
4419 ! implicit real*8 (a-h,o-z)
4420 ! include 'DIMENSIONS'
4421 ! include 'COMMON.CHAIN'
4422 ! include 'COMMON.DISTFIT'
4424 real(kind=8) :: suma,DIJ
4433 if (w(ind).ne.0.0) then
4435 suma=suma+w(ind)*(DIJ-d0(ind))*(DIJ-d0(ind))
4437 ! print '(2i3,i4,4f12.2)',i,j,ind,dij,d0(ind),w(ind),suma
4445 !-----------------------------------------------------------------------------
4450 use geometry, only:dist
4451 ! implicit real*8 (a-h,o-z)
4452 ! include 'DIMENSIONS'
4453 ! include 'COMMON.CHAIN'
4454 ! include 'COMMON.DISTFIT'
4455 ! include 'COMMON.GEO'
4456 integer :: i,j,k,l,I1,I2,IND
4457 real(kind=8),DIMENSION(3) :: E12,R13,R24,PRODU
4470 R13(K)=C(K,J)-C(K,I1)
4474 R24(L)=C(L,K)-C(L,I2)
4476 IND=((J-1)*(2*NRES-J-6))/2+K-3
4477 PRODU(1)=R13(2)*R24(3)-R13(3)*R24(2)
4478 PRODU(2)=R13(3)*R24(1)-R13(1)*R24(3)
4479 PRODU(3)=R13(1)*R24(2)-R13(2)*R24(1)
4480 DRDG(IND,I)=SCALAR(E12,PRODU)/DIST(J,K)
4485 end subroutine RDERIV
4486 !-----------------------------------------------------------------------------
4490 ! implicit real*8 (a-h,o-z)
4491 ! include 'DIMENSIONS'
4492 ! include 'COMMON.CHAIN'
4493 ! include 'COMMON.DISTFIT'
4495 real(kind=8) :: XI,HII,BKI,BKIWK,HIJ
4503 XI=XI+BKIWK*(D0(K)-DDD(K))
4511 HIJ=HIJ+DRDG(K,I)*DRDG(K,J)*w(K)
4518 end subroutine HEVAL
4519 !-----------------------------------------------------------------------------
4520 subroutine VEC(I,J,U)
4522 use geometry_data, only: C
4523 ! Find the unit vector from atom (I) to atom (J). Store in U.
4525 ! implicit real*8 (a-h,o-z)
4526 ! include 'DIMENSIONS'
4527 ! include 'COMMON.CHAIN'
4529 real(kind=8),DIMENSION(3) :: U
4530 real(kind=8) :: ANORM,UK
4544 !-----------------------------------------------------------------------------
4545 subroutine TRANSFER(N,X1,X2)
4547 ! implicit real*8 (a-h,o-z)
4548 ! include 'DIMENSIONS'
4550 real(kind=8),DIMENSION(N) :: X1,X2
4554 end subroutine TRANSFER
4555 !-----------------------------------------------------------------------------
4556 !-----------------------------------------------------------------------------
4557 subroutine alloc_compare_arrays
4559 maxres22=nres*(nres+1)/2
4561 ! common /struct/ in io_common: read_threadbase
4562 ! allocate(cart_base !(3,maxres_base,maxseq)
4563 ! allocate(nres_base !(3,maxseq)
4564 ! allocate(str_nam !(maxseq)
4566 ! COMMON /c_frag/ in io_conf: readpdb
4567 if(.not.allocated(bfrag)) allocate(bfrag(4,nres/3)) !(4,maxres/3)
4568 if(.not.allocated(hfrag)) allocate(hfrag(2,nres/3)) !(2,maxres/3)
4571 if(.not.allocated(w)) allocate(w(maxres22),d0(maxres22)) !(maxres22)
4573 !el allocate(DRDG(maxres22,maxres22)) !(MAXRES22,MAXRES)
4574 if (.not.allocated(DDD)) allocate(DDD(maxres22)) !(maxres22)
4575 if (.not.allocated(H)) allocate(H(nres,nres)) !(MAXRES,MAXRES)
4577 if (.not.allocated(XX)) allocate(XX(nres)) !(MAXRES)
4579 if (.not.allocated(mask)) allocate(mask(nres)) !(maxres)
4582 if (.not.allocated(iexam))allocate(iexam(2,maxthread),ipatt(2,maxthread)) !(2,maxthread)
4584 if (.not.allocated(ener0)) allocate(ener0(n_ene+2,maxthread),ener(n_ene+2,maxthread)) !(n_ene+2,maxthread)
4587 end subroutine alloc_compare_arrays
4588 !-----------------------------------------------------------------------------
4590 !-----------------------------------------------------------------------------