[bd2278d] | 1 | ! **************************************************************
|
---|
| 2 | !
|
---|
| 3 | ! This file contains the subroutines: anneal
|
---|
| 4 | !
|
---|
| 5 | ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 6 | ! Shura Hayryan, Chin-Ku
|
---|
| 7 | ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 8 | ! Jan H. Meinke, Sandipan Mohanty
|
---|
| 9 | !
|
---|
| 10 | ! $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $
|
---|
| 11 | ! **************************************************************
|
---|
[e40e335] | 12 |
|
---|
| 13 | subroutine anneal(nequi, nswp, nmes, tmax, tmin, lrand)
|
---|
| 14 |
|
---|
[bd2278d] | 15 | ! --------------------------------------------------------------
|
---|
| 16 | ! PURPOSE: SIMULATED ANNEALING SEARCH OF LOWEST-POTENTIAL-ENERGY
|
---|
| 17 | ! CONFORMATIONS OF PROTEINS
|
---|
| 18 | !
|
---|
| 19 | ! CALLS: addang,energy,metropolis,outvar,outpdb,rgyr,setvar,zimmer
|
---|
| 20 | !
|
---|
| 21 | ! ---------------------------------------------------------------
|
---|
[e40e335] | 22 |
|
---|
| 23 | include 'INCL.H'
|
---|
| 24 |
|
---|
[bd2278d] | 25 | !f2py intent(in) nequi
|
---|
| 26 | !f2py intent(in) nswp
|
---|
| 27 | !f2py intent(in) nmes
|
---|
| 28 | !f2py intent(in) Tmax
|
---|
| 29 | !f2py intent(in) Tmin
|
---|
| 30 | !f2py logical optional, intent(in):: lrand = 1
|
---|
[e40e335] | 31 |
|
---|
[bd2278d] | 32 | ! external rand
|
---|
[e40e335] | 33 | external can_weight
|
---|
[6650a56] | 34 |
|
---|
| 35 | double precision bmin, bmax, db, dv, grnd, vr, addang, eol, energy
|
---|
| 36 | double precision acz, ymin, vlvrm, rgy, ee, temp
|
---|
| 37 |
|
---|
| 38 | integer nresi, i, iv, nsw, nemin, j
|
---|
| 39 |
|
---|
[bd2278d] | 40 | ! parameter(lrand=.true.)
|
---|
| 41 | ! parameter(nequi=100, nswp=100000,nmes=1000)
|
---|
| 42 | ! parameter(tmax=1000.0,tmin=100.0)
|
---|
| 43 | ! lrand=.true.: creates random start configuration
|
---|
[e40e335] | 44 | logical lrand
|
---|
[bd2278d] | 45 | ! nequi: Number of sweeps for equilibrisation of system
|
---|
[e40e335] | 46 | integer nequi
|
---|
[bd2278d] | 47 | ! nswp: Number of sweeps for simulation run
|
---|
[e40e335] | 48 | integer nswp
|
---|
[bd2278d] | 49 | ! nmes: Number of sweeps between measurments
|
---|
[e40e335] | 50 | integer nmes
|
---|
[bd2278d] | 51 | ! tmax: Start temperature
|
---|
[e40e335] | 52 | double precision tmax
|
---|
[bd2278d] | 53 | ! tmin: Final temperature
|
---|
[e40e335] | 54 | double precision tmin
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | ! common/bet/beta
|
---|
[bd2278d] | 58 | !
|
---|
[e40e335] | 59 | dimension vlvrm(mxvr)
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
[bd2278d] | 63 | ! Define files for output:
|
---|
[e40e335] | 64 | open(14,file='time.d')
|
---|
| 65 | write(14, *) '# $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $'
|
---|
| 66 | write(14, *) '# nsw, temp, eol, eysl, eyslh, eyslp, asa, rgy, ',
|
---|
| 67 | & '# rgyh, rgyp, eyhb, eyvw, eyel, eyvr, zimm'
|
---|
| 68 | bmin=1.0/ ( tmax * 1.98773d-3 )
|
---|
| 69 | bmax=1.0/ ( tmin * 1.98773d-3 )
|
---|
| 70 | db = exp(log(bmax/bmin)/nswp)
|
---|
| 71 |
|
---|
[bd2278d] | 72 | ! nresi: Number of residues
|
---|
| 73 | ! FIXME: Should loop over all proteins
|
---|
[e40e335] | 74 | nresi=irsml2(ntlml)-irsml1(1)+1
|
---|
[bd2278d] | 75 | ! _________________________________ random start
|
---|
[e40e335] | 76 | if(lrand) then
|
---|
| 77 | do i=1,nvr
|
---|
| 78 | iv=idvr(i)
|
---|
| 79 | dv=axvr(iv)*(grnd()-0.5)
|
---|
| 80 | vr=addang(pi,dv)
|
---|
| 81 | vlvr(iv)=vr
|
---|
| 82 | enddo
|
---|
| 83 | end if
|
---|
| 84 |
|
---|
| 85 | eol=energy()
|
---|
[38d77eb] | 86 | write (logString, '(a,e12.5,/)')
|
---|
| 87 | & 'energy of start configuration: ',eol
|
---|
[e40e335] | 88 |
|
---|
[bd2278d] | 89 | ! Write start configuration in pdb-format into file
|
---|
[e40e335] | 90 | call outpdb(0, "start.pdb")
|
---|
| 91 |
|
---|
[bd2278d] | 92 | ! =====================Equilibration by Metropolis
|
---|
[e40e335] | 93 | beta = bmin
|
---|
| 94 | do nsw=1,nequi
|
---|
| 95 | call metropolis(eol,acz,can_weight)
|
---|
| 96 | end do
|
---|
[38d77eb] | 97 | write (logString, *)
|
---|
| 98 | & 'Energy after equilibration:', eol
|
---|
[e40e335] | 99 |
|
---|
[bd2278d] | 100 | !======================Simulation by simulated annealing
|
---|
[e40e335] | 101 | acz = 0.0d0
|
---|
| 102 | ymin = eol
|
---|
| 103 | do nsw=0,nswp
|
---|
| 104 | beta = bmin*db**nsw
|
---|
| 105 | call metropolis(eol,acz,can_weight)
|
---|
[bd2278d] | 106 | ! Store lowest-energy conformation
|
---|
[e40e335] | 107 | if(eol.lt.ymin) then
|
---|
| 108 | ymin = eol
|
---|
| 109 | nemin = nsw
|
---|
| 110 | call outvar(0,'global.var')
|
---|
[bd2278d] | 111 | ! Output of lowest-energy conformation as pdb-file
|
---|
[e40e335] | 112 | call outpdb(0,"global.pdb")
|
---|
| 113 | do j=1,nvr
|
---|
| 114 | iv=idvr(j)
|
---|
| 115 | vlvrm(j) = vlvr(iv)
|
---|
| 116 | end do
|
---|
| 117 | end if
|
---|
[bd2278d] | 118 | !
|
---|
[e40e335] | 119 | if(mod(nsw,nmes).eq.0) then
|
---|
[bd2278d] | 120 | ! Measure radius of gyration and end-to-end distance
|
---|
[e40e335] | 121 | call rgyr(1, rgy, ee)
|
---|
[bd2278d] | 122 | ! Determine Zimmerman code of actual conformation
|
---|
[e40e335] | 123 | call zimmer(nresi)
|
---|
[bd2278d] | 124 | ! Write down information on actual conformation
|
---|
[e40e335] | 125 | temp = 1.0d0/beta/0.00198773
|
---|
| 126 | write(14,'(i6,13f12.3,1x,a)')
|
---|
| 127 | & nsw, temp, eol, eysl, eyslh, eyslp, asa,
|
---|
| 128 | & rgy, rgyh, rgyp,
|
---|
| 129 | & eyhb, eyvw, eyel, eyvr, zimm(1:nresi)
|
---|
| 130 | end if
|
---|
[bd2278d] | 131 | !
|
---|
[e40e335] | 132 | end do
|
---|
| 133 |
|
---|
| 134 | acz = acz/dble(nsw*nvr)
|
---|
[38d77eb] | 135 | write (logString, *) 'acceptance rate:',acz
|
---|
| 136 | write (logString, *)
|
---|
[bd2278d] | 137 | ! ------------ Output Dihedreals of final configuration
|
---|
[38d77eb] | 138 | write (logString, *) 'last energy',eol
|
---|
[e40e335] | 139 | call outvar(0,' ')
|
---|
[bd2278d] | 140 | ! Output final conformation as pdb-file
|
---|
[e40e335] | 141 | call outpdb(0,"final.pdb")
|
---|
[38d77eb] | 142 | write (logString, *)
|
---|
[e40e335] | 143 |
|
---|
[bd2278d] | 144 | ! ------------ Output Dihedreals of conformation with lowest energy
|
---|
[38d77eb] | 145 | write (logString, *) 'lowest energy ever found:',nemin,ymin
|
---|
[e40e335] | 146 | close(14)
|
---|
[bd2278d] | 147 | ! =====================
|
---|
[e40e335] | 148 |
|
---|
| 149 |
|
---|
| 150 | end
|
---|
| 151 |
|
---|
| 152 |
|
---|