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)
120 subroutine test_local
121 implicit real*8 (a-h,o-z)
125 include 'COMMON.INTERACT'
126 include 'COMMON.IOUNITS'
127 double precision time0,time1
128 double precision energy(0:n_ene),ee
129 double precision varia(maxvar)
132 c call geom_to_var(nvar,varia)
133 call write_pdb(1,'first structure',0d0)
135 call etotal(energy(0))
137 write(iout,*) nnt,nct,etot
139 write(iout,*) 'calling sc_move'
140 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
141 write(iout,*) nft_sc,etot
142 call write_pdb(2,'second structure',etot)
144 write(iout,*) 'calling local_move'
145 call local_move_init(.false.)
146 call local_move(24,29,20d0,50d0)
148 call write_pdb(3,'third structure',etot)
150 write(iout,*) 'calling sc_move'
151 call sc_move(24,29,5,10d0,nft_sc,etot)
152 write(iout,*) nft_sc,etot
153 call write_pdb(2,'last structure',etot)
160 implicit real*8 (a-h,o-z)
164 include 'COMMON.INTERACT'
165 include 'COMMON.IOUNITS'
166 double precision time0,time1
167 double precision energy(0:n_ene),ee
168 double precision varia(maxvar)
171 c call geom_to_var(nvar,varia)
172 call write_pdb(1,'first structure',0d0)
174 call etotal(energy(0))
176 write(iout,*) nnt,nct,etot
178 write(iout,*) 'calling sc_move'
180 call sc_move(nnt,nct,5,10d0,nft_sc,etot)
181 write(iout,*) nft_sc,etot
182 call write_pdb(2,'second structure',etot)
184 write(iout,*) 'calling sc_move 2nd time'
186 call sc_move(nnt,nct,5,1d0,nft_sc,etot)
187 write(iout,*) nft_sc,etot
188 call write_pdb(3,'last structure',etot)
191 c--------------------------------------------------------
192 subroutine bgrow(bstrand,nbstrand,in,ind,new)
193 implicit real*8 (a-h,o-z)
195 include 'COMMON.CHAIN'
196 integer bstrand(maxres/3,6)
198 ishift=iabs(bstrand(in,ind+4)-new)
200 print *,'bgrow',bstrand(in,ind+4),new,ishift
205 bstrand(nbstrand,5)=bstrand(nbstrand,1)
207 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
208 if (bstrand(i,5).lt.bstrand(i,6)) then
209 bstrand(i,5)=bstrand(i,5)-ishift
211 bstrand(i,5)=bstrand(i,5)+ishift
216 bstrand(nbstrand,6)=bstrand(nbstrand,2)
218 IF (bstrand(nbstrand,3).eq.bstrand(i,3)) THEN
219 if (bstrand(i,6).lt.bstrand(i,5)) then
220 bstrand(i,6)=bstrand(i,6)-ishift
222 bstrand(i,6)=bstrand(i,6)+ishift
233 c-------------------------------------------------
235 subroutine secondary(lprint)
236 implicit real*8 (a-h,o-z)
238 include 'COMMON.CHAIN'
239 include 'COMMON.IOUNITS'
240 include 'COMMON.DISTFIT'
242 integer ncont,icont(2,maxres*maxres/2),isec(maxres,3)
243 logical lprint,not_done
244 real dcont(maxres*maxres/2),d
249 double precision xpi(3),xpj(3)
254 cd call write_pdb(99,'sec structure',0d0)
266 xpi(k)=0.5d0*(c(k,i-1)+c(k,i))
270 xpj(k)=0.5d0*(c(k,j-1)+c(k,j))
272 cd d = (c(1,i)-c(1,j))*(c(1,i)-c(1,j)) +
273 cd & (c(2,i)-c(2,j))*(c(2,i)-c(2,j)) +
274 cd & (c(3,i)-c(3,j))*(c(3,i)-c(3,j))
275 cd print *,'CA',i,j,d
276 d = (xpi(1)-xpj(1))*(xpi(1)-xpj(1)) +
277 & (xpi(2)-xpj(2))*(xpi(2)-xpj(2)) +
278 & (xpi(3)-xpj(3))*(xpi(3)-xpj(3))
279 if ( d.lt.rcomp*rcomp) then
289 write (iout,'(a)') '#PP contact map distances:'
291 write (iout,'(3i4,f10.5)')
292 & i,icont(1,i),icont(2,i),dcont(i)
296 c finding parallel beta
297 cd write (iout,*) '------- looking for parallel beta -----------'
303 if(dcont(i).le.rbeta .and. j1-i1.gt.4 .and.
304 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
305 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
306 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
307 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
308 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
312 cd write (iout,*) i1,j1,dcont(i)
318 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)
319 & .and. dcont(j).le.rbeta .and.
320 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
321 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
322 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
323 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
324 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
329 cd write (iout,*) i1,j1,dcont(j),not_done
333 if (i1-ii1.gt.1) then
337 if(lprint)write(iout,*)'parallel beta',nbeta,ii1,i1,jj1,j1
346 isec(ij,1)=isec(ij,1)+1
347 isec(ij,1+isec(ij,1))=nbeta
350 isec(ij,1)=isec(ij,1)+1
351 isec(ij,1+isec(ij,1))=nbeta
357 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
358 & "DefPropRes 'strand",nstrand,
359 & "' 'num = ",ii1-1,"..",i1-1,"'"
361 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
362 & "DefPropRes 'strand",nstrand,
363 & "' 'num = ",ii1-1,"..",i1-1,"'"
367 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
368 & "DefPropRes 'strand",nstrand,
369 & "' 'num = ",jj1-1,"..",j1-1,"'"
371 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
372 & "DefPropRes 'strand",nstrand,
373 & "' 'num = ",jj1-1,"..",j1-1,"'"
376 & "SetNeigh",ii1-1,i1-1,jj1-1,j1-1
382 c finding antiparallel beta
383 cd write (iout,*) '--------- looking for antiparallel beta ---------'
388 if (dcont(i).le.rbeta.and.
389 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
390 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
391 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
392 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
393 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
397 cd write (iout,*) i1,j1,dcont(i)
404 if (i1.eq.icont(1,j).and.j1.eq.icont(2,j) .and.
405 & isec(i1,1).le.1.and.isec(j1,1).le.1.and.
406 & (isec(i1,2).ne.isec(j1,2).or.isec(i1,2)*isec(j1,2).eq.0).and.
407 & (isec(i1,3).ne.isec(j1,3).or.isec(i1,3)*isec(j1,3).eq.0).and.
408 & (isec(i1,2).ne.isec(j1,3).or.isec(i1,2)*isec(j1,3).eq.0).and.
409 & (isec(i1,3).ne.isec(j1,2).or.isec(i1,3)*isec(j1,2).eq.0)
410 & .and. dcont(j).le.rbeta ) goto 6
414 cd write (iout,*) i1,j1,dcont(j),not_done
418 if (i1-ii1.gt.1) then
419 if(lprint)write (iout,*)'antiparallel beta',
420 & nbeta,ii1-1,i1,jj1,j1-1
423 bfrag(1,nbfrag)=max0(ii1-1,1)
426 bfrag(4,nbfrag)=max0(j1-1,1)
431 isec(ij,1)=isec(ij,1)+1
432 isec(ij,1+isec(ij,1))=nbeta
436 isec(ij,1)=isec(ij,1)+1
437 isec(ij,1+isec(ij,1))=nbeta
443 if (nstrand.le.9) then
444 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
445 & "DefPropRes 'strand",nstrand,
446 & "' 'num = ",ii1-2,"..",i1-1,"'"
448 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
449 & "DefPropRes 'strand",nstrand,
450 & "' 'num = ",ii1-2,"..",i1-1,"'"
453 if (nstrand.le.9) then
454 write(12,'(a18,i1,a9,i3,a2,i3,a1)')
455 & "DefPropRes 'strand",nstrand,
456 & "' 'num = ",j1-2,"..",jj1-1,"'"
458 write(12,'(a18,i2,a9,i3,a2,i3,a1)')
459 & "DefPropRes 'strand",nstrand,
460 & "' 'num = ",j1-2,"..",jj1-1,"'"
463 & "SetNeigh",ii1-2,i1-1,jj1-1,j1-2
469 if (nstrand.gt.0.and.lprint) then
470 write(12,'(a27,$)') "DefPropRes 'sheet' 'strand1"
473 write(12,'(a9,i1,$)') " | strand",i
475 write(12,'(a9,i2,$)') " | strand",i
482 c finding alpha or 310 helix
488 if (j1.eq.i1+3.and.dcont(i).le.r310
489 & .or.j1.eq.i1+4.and.dcont(i).le.ralfa ) then
490 cd if (j1.eq.i1+3) write (iout,*) "found 1-4 ",i1,j1,dcont(i)
491 cd if (j1.eq.i1+4) write (iout,*) "found 1-5 ",i1,j1,dcont(i)
494 if (isec(ii1,1).eq.0) then
503 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
507 cd write (iout,*) i1,j1,not_done
510 if (j1-ii1.gt.4) then
512 cd write (iout,*)'helix',nhelix,ii1,j1
516 hfrag(2,nhfrag)=max0(j1-1,1)
522 write (iout,'(a6,i3,2i4)') "Helix",nhelix,ii1-1,j1-2
523 if (nhelix.le.9) then
524 write(12,'(a17,i1,a9,i3,a2,i3,a1)')
525 & "DefPropRes 'helix",nhelix,
526 & "' 'num = ",ii1-1,"..",j1-2,"'"
528 write(12,'(a17,i2,a9,i3,a2,i3,a1)')
529 & "DefPropRes 'helix",nhelix,
530 & "' 'num = ",ii1-1,"..",j1-2,"'"
537 if (nhelix.gt.0.and.lprint) then
538 write(12,'(a26,$)') "DefPropRes 'helix' 'helix1"
540 if (nhelix.le.9) then
541 write(12,'(a8,i1,$)') " | helix",i
543 write(12,'(a8,i2,$)') " | helix",i
550 write(12,'(a37)') "DefPropRes 'coil' '! (helix | sheet)'"
551 write(12,'(a20)') "XMacStand ribbon.mac"
557 c----------------------------------------------------------------------------
559 subroutine write_pdb(npdb,titelloc,ee)
560 implicit real*8 (a-h,o-z)
562 include 'COMMON.IOUNITS'
563 character*50 titelloc1
564 character*(*) titelloc
573 if (npdb.lt.1000) then
574 call numstr(npdb,zahl)
575 open(ipdb,file=prefix(:lenpre)//'@@'//zahl//'.pdb')
577 if (npdb.lt.10000) then
578 write(liczba5,'(i1,i4)') 0,npdb
580 write(liczba5,'(i5)') npdb
582 open(ipdb,file=prefix(:lenpre)//'@@'//liczba5//'.pdb')
584 call pdbout(ee,titelloc1,ipdb)
589 c--------------------------------------------------------
591 implicit real*8 (a-h,o-z)
597 include 'COMMON.CHAIN'
598 include 'COMMON.IOUNITS'
600 include 'COMMON.CONTROL'
601 include 'COMMON.SBRIDGE'
602 include 'COMMON.FFIELD'
603 include 'COMMON.MINIM'
604 include 'COMMON.INTERACT'
606 include 'COMMON.DISTFIT'
608 double precision time0,time1
609 double precision energy(0:n_ene),ee
610 double precision var(maxvar)
613 logical debug,ltest,fail
622 c------------------------
624 c freeze sec.elements
634 do i=bfrag(1,j),bfrag(2,j)
639 if (bfrag(3,j).le.bfrag(4,j)) then
640 do i=bfrag(3,j),bfrag(4,j)
646 do i=bfrag(4,j),bfrag(3,j)
654 do i=hfrag(1,j),hfrag(2,j)
666 c store dist. constrains
670 if ( iff(i).eq.1.and.iff(j).eq.1 ) then
683 call write_pdb(100+in_pdb,'input reg. structure',0d0)
693 c run soft pot. optimization
699 call geom_to_var(nvar,var)
705 call minimize(etot,var,iretcode,nfun)
707 write(iout,*)'SUMSL return code is',iretcode,' eval SOFT',nfun
713 write (iout,'(a,f6.2,f8.2,a)')' Time for soft min.',time1-time0,
714 & nfun/(time1-time0),' SOFT eval/s'
716 call var_to_geom(nvar,var)
718 call write_pdb(300+in_pdb,'soft structure',etot)
721 c run full UNRES optimization with constrains and frozen 2D
722 c the same variables as soft pot. optimizatio
733 call minimize(etot,var,iretcode,nfun)
734 write(iout,*)'SUMSL MASK DIST return code is',iretcode,
742 write (iout,'(a,f6.2,f8.2,a)')
743 & ' Time for mask dist min.',time1-time0,
744 & nfun/(time1-time0),' eval/s'
746 call var_to_geom(nvar,var)
748 call write_pdb(400+in_pdb,'mask & dist',etot)
751 c switch off constrains and
752 c run full UNRES optimization with frozen 2D
769 call minimize(etot,var,iretcode,nfun)
770 write(iout,*)'SUMSL MASK return code is',iretcode,' eval ',nfun
777 write (iout,'(a,f6.2,f8.2,a)')' Time for mask min.',time1-time0,
778 & nfun/(time1-time0),' eval/s'
782 call var_to_geom(nvar,var)
784 call write_pdb(500+in_pdb,'mask 2d frozen',etot)
791 c run full UNRES optimization with constrains and NO frozen 2D
807 call minimize(etot,var,iretcode,nfun)
808 write(iout,'(a10,f6.3,a14,i3,a6,i5)')
809 & ' SUMSL DIST',wstrain,' return code is',iretcode,
817 write (iout,'(a,f6.2,f8.2,a)')
818 & ' Time for dist min.',time1-time0,
819 & nfun/(time1-time0),' eval/s'
821 call var_to_geom(nvar,var)
823 call write_pdb(600+in_pdb+ico,'dist cons',etot)
842 call minimize(etot,var,iretcode,nfun)
843 write(iout,*)'------------------------------------------------'
844 write(iout,*)'SUMSL return code is',iretcode,' eval ',nfun,
845 & '+ DIST eval',ieval
851 write (iout,'(a,f6.2,f8.2,a)')' Time for full min.',time1-time0,
852 & nfun/(time1-time0),' eval/s'
855 call var_to_geom(nvar,var)
857 call write_pdb(999,'full min',etot)