source: anneal.f@ 6650a56

Last change on this file since 6650a56 was 6650a56, checked in by baerbaer <baerbaer@…>, 14 years ago

Explicitly declare variables.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@32 26dc1dd8-5c4e-0410-9ffe-d298b4865968

  • Property mode set to 100644
File size: 4.3 KB
Line 
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 (*,'(a,e12.5,/)') 'energy of start configuration: ',eol
87
88! Write start configuration in pdb-format into file
89 call outpdb(0, "start.pdb")
90
91! =====================Equilibration by Metropolis
92 beta = bmin
93 do nsw=1,nequi
94 call metropolis(eol,acz,can_weight)
95 end do
96 write(*,*) 'Energy after equilibration:',eol
97
98!======================Simulation by simulated annealing
99 acz = 0.0d0
100 ymin = eol
101 do nsw=0,nswp
102 beta = bmin*db**nsw
103 call metropolis(eol,acz,can_weight)
104! Store lowest-energy conformation
105 if(eol.lt.ymin) then
106 ymin = eol
107 nemin = nsw
108 call outvar(0,'global.var')
109! Output of lowest-energy conformation as pdb-file
110 call outpdb(0,"global.pdb")
111 do j=1,nvr
112 iv=idvr(j)
113 vlvrm(j) = vlvr(iv)
114 end do
115 end if
116!
117 if(mod(nsw,nmes).eq.0) then
118! Measure radius of gyration and end-to-end distance
119 call rgyr(1, rgy, ee)
120! Determine Zimmerman code of actual conformation
121 call zimmer(nresi)
122! Write down information on actual conformation
123 temp = 1.0d0/beta/0.00198773
124 write(14,'(i6,13f12.3,1x,a)')
125 & nsw, temp, eol, eysl, eyslh, eyslp, asa,
126 & rgy, rgyh, rgyp,
127 & eyhb, eyvw, eyel, eyvr, zimm(1:nresi)
128 end if
129!
130 end do
131
132 acz = acz/dble(nsw*nvr)
133 write(*,*) 'acceptance rate:',acz
134 write(*,*)
135! ------------ Output Dihedreals of final configuration
136 write(*,*) 'last energy',eol
137 call outvar(0,' ')
138! Output final conformation as pdb-file
139 call outpdb(0,"final.pdb")
140 write(*,*)
141
142! ------------ Output Dihedreals of conformation with lowest energy
143 write(*,*) 'lowest energy ever found:',nemin,ymin
144 close(14)
145! =====================
146
147
148 end
149
150
Note: See TracBrowser for help on using the repository browser.