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 | ! **************************************************************
|
---|
12 |
|
---|
13 | subroutine anneal(nequi, nswp, nmes, tmax, tmin, lrand)
|
---|
14 |
|
---|
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 | ! ---------------------------------------------------------------
|
---|
22 |
|
---|
23 | include 'INCL.H'
|
---|
24 |
|
---|
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
|
---|
31 |
|
---|
32 | ! external rand
|
---|
33 | external can_weight
|
---|
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 |
|
---|
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
|
---|
44 | logical lrand
|
---|
45 | ! nequi: Number of sweeps for equilibrisation of system
|
---|
46 | integer nequi
|
---|
47 | ! nswp: Number of sweeps for simulation run
|
---|
48 | integer nswp
|
---|
49 | ! nmes: Number of sweeps between measurments
|
---|
50 | integer nmes
|
---|
51 | ! tmax: Start temperature
|
---|
52 | double precision tmax
|
---|
53 | ! tmin: Final temperature
|
---|
54 | double precision tmin
|
---|
55 |
|
---|
56 |
|
---|
57 | ! common/bet/beta
|
---|
58 | !
|
---|
59 | dimension vlvrm(mxvr)
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | ! Define files for output:
|
---|
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 |
|
---|
72 | ! nresi: Number of residues
|
---|
73 | ! FIXME: Should loop over all proteins
|
---|
74 | nresi=irsml2(ntlml)-irsml1(1)+1
|
---|
75 | ! _________________________________ random start
|
---|
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()
|
---|
86 | write (logString, '(a,e12.5,/)')
|
---|
87 | & 'energy of start configuration: ',eol
|
---|
88 |
|
---|
89 | ! Write start configuration in pdb-format into file
|
---|
90 | call outpdb(0, "start.pdb")
|
---|
91 |
|
---|
92 | ! =====================Equilibration by Metropolis
|
---|
93 | beta = bmin
|
---|
94 | do nsw=1,nequi
|
---|
95 | call metropolis(eol,acz,can_weight)
|
---|
96 | end do
|
---|
97 | write (logString, *)
|
---|
98 | & 'Energy after equilibration:', eol
|
---|
99 |
|
---|
100 | !======================Simulation by simulated annealing
|
---|
101 | acz = 0.0d0
|
---|
102 | ymin = eol
|
---|
103 | do nsw=0,nswp
|
---|
104 | beta = bmin*db**nsw
|
---|
105 | call metropolis(eol,acz,can_weight)
|
---|
106 | ! Store lowest-energy conformation
|
---|
107 | if(eol.lt.ymin) then
|
---|
108 | ymin = eol
|
---|
109 | nemin = nsw
|
---|
110 | call outvar(0,'global.var')
|
---|
111 | ! Output of lowest-energy conformation as pdb-file
|
---|
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
|
---|
118 | !
|
---|
119 | if(mod(nsw,nmes).eq.0) then
|
---|
120 | ! Measure radius of gyration and end-to-end distance
|
---|
121 | call rgyr(1, rgy, ee)
|
---|
122 | ! Determine Zimmerman code of actual conformation
|
---|
123 | call zimmer(nresi)
|
---|
124 | ! Write down information on actual conformation
|
---|
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
|
---|
131 | !
|
---|
132 | end do
|
---|
133 |
|
---|
134 | acz = acz/dble(nsw*nvr)
|
---|
135 | write (logString, *) 'acceptance rate:',acz
|
---|
136 | write (logString, *)
|
---|
137 | ! ------------ Output Dihedreals of final configuration
|
---|
138 | write (logString, *) 'last energy',eol
|
---|
139 | call outvar(0,' ')
|
---|
140 | ! Output final conformation as pdb-file
|
---|
141 | call outpdb(0,"final.pdb")
|
---|
142 | write (logString, *)
|
---|
143 |
|
---|
144 | ! ------------ Output Dihedreals of conformation with lowest energy
|
---|
145 | write (logString, *) 'lowest energy ever found:',nemin,ymin
|
---|
146 | close(14)
|
---|
147 | ! =====================
|
---|
148 |
|
---|
149 |
|
---|
150 | end
|
---|
151 |
|
---|
152 |
|
---|