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 | ! parameter(lrand=.true.)
|
---|
35 | ! parameter(nequi=100, nswp=100000,nmes=1000)
|
---|
36 | ! parameter(tmax=1000.0,tmin=100.0)
|
---|
37 | ! lrand=.true.: creates random start configuration
|
---|
38 | logical lrand
|
---|
39 | ! nequi: Number of sweeps for equilibrisation of system
|
---|
40 | integer nequi
|
---|
41 | ! nswp: Number of sweeps for simulation run
|
---|
42 | integer nswp
|
---|
43 | ! nmes: Number of sweeps between measurments
|
---|
44 | integer nmes
|
---|
45 | ! tmax: Start temperature
|
---|
46 | double precision tmax
|
---|
47 | ! tmin: Final temperature
|
---|
48 | double precision tmin
|
---|
49 |
|
---|
50 |
|
---|
51 | ! common/bet/beta
|
---|
52 | !
|
---|
53 | dimension vlvrm(mxvr)
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 | ! Define files for output:
|
---|
58 | open(14,file='time.d')
|
---|
59 | write(14, *) '# $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $'
|
---|
60 | write(14, *) '# nsw, temp, eol, eysl, eyslh, eyslp, asa, rgy, ',
|
---|
61 | & '# rgyh, rgyp, eyhb, eyvw, eyel, eyvr, zimm'
|
---|
62 | bmin=1.0/ ( tmax * 1.98773d-3 )
|
---|
63 | bmax=1.0/ ( tmin * 1.98773d-3 )
|
---|
64 | db = exp(log(bmax/bmin)/nswp)
|
---|
65 |
|
---|
66 | ! nresi: Number of residues
|
---|
67 | ! FIXME: Should loop over all proteins
|
---|
68 | nresi=irsml2(ntlml)-irsml1(1)+1
|
---|
69 | ! _________________________________ random start
|
---|
70 | if(lrand) then
|
---|
71 | do i=1,nvr
|
---|
72 | iv=idvr(i)
|
---|
73 | dv=axvr(iv)*(grnd()-0.5)
|
---|
74 | vr=addang(pi,dv)
|
---|
75 | vlvr(iv)=vr
|
---|
76 | enddo
|
---|
77 | end if
|
---|
78 |
|
---|
79 | eol=energy()
|
---|
80 | write (*,'(a,e12.5,/)') 'energy of start configuration: ',eol
|
---|
81 |
|
---|
82 | ! Write start configuration in pdb-format into file
|
---|
83 | call outpdb(0, "start.pdb")
|
---|
84 |
|
---|
85 | ! =====================Equilibration by Metropolis
|
---|
86 | beta = bmin
|
---|
87 | do nsw=1,nequi
|
---|
88 | call metropolis(eol,acz,can_weight)
|
---|
89 | end do
|
---|
90 | write(*,*) 'Energy after equilibration:',eol
|
---|
91 |
|
---|
92 | !======================Simulation by simulated annealing
|
---|
93 | acz = 0.0d0
|
---|
94 | ymin = eol
|
---|
95 | do nsw=0,nswp
|
---|
96 | beta = bmin*db**nsw
|
---|
97 | call metropolis(eol,acz,can_weight)
|
---|
98 | ! Store lowest-energy conformation
|
---|
99 | if(eol.lt.ymin) then
|
---|
100 | ymin = eol
|
---|
101 | nemin = nsw
|
---|
102 | call outvar(0,'global.var')
|
---|
103 | ! Output of lowest-energy conformation as pdb-file
|
---|
104 | call outpdb(0,"global.pdb")
|
---|
105 | do j=1,nvr
|
---|
106 | iv=idvr(j)
|
---|
107 | vlvrm(j) = vlvr(iv)
|
---|
108 | end do
|
---|
109 | end if
|
---|
110 | !
|
---|
111 | if(mod(nsw,nmes).eq.0) then
|
---|
112 | ! Measure radius of gyration and end-to-end distance
|
---|
113 | call rgyr(1, rgy, ee)
|
---|
114 | ! Determine Zimmerman code of actual conformation
|
---|
115 | call zimmer(nresi)
|
---|
116 | ! Write down information on actual conformation
|
---|
117 | temp = 1.0d0/beta/0.00198773
|
---|
118 | write(14,'(i6,13f12.3,1x,a)')
|
---|
119 | & nsw, temp, eol, eysl, eyslh, eyslp, asa,
|
---|
120 | & rgy, rgyh, rgyp,
|
---|
121 | & eyhb, eyvw, eyel, eyvr, zimm(1:nresi)
|
---|
122 | end if
|
---|
123 | !
|
---|
124 | end do
|
---|
125 |
|
---|
126 | acz = acz/dble(nsw*nvr)
|
---|
127 | write(*,*) 'acceptance rate:',acz
|
---|
128 | write(*,*)
|
---|
129 | ! ------------ Output Dihedreals of final configuration
|
---|
130 | write(*,*) 'last energy',eol
|
---|
131 | call outvar(0,' ')
|
---|
132 | ! Output final conformation as pdb-file
|
---|
133 | call outpdb(0,"final.pdb")
|
---|
134 | write(*,*)
|
---|
135 |
|
---|
136 | ! ------------ Output Dihedreals of conformation with lowest energy
|
---|
137 | write(*,*) 'lowest energy ever found:',nemin,ymin
|
---|
138 | close(14)
|
---|
139 | ! =====================
|
---|
140 |
|
---|
141 |
|
---|
142 | end
|
---|
143 |
|
---|
144 |
|
---|