source: anneal.f@ 6650a56

Last change on this file since 6650a56 was 6650a56, checked in by baerbaer <baerbaer@…>, 15 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
RevLine 
[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()
86 write (*,'(a,e12.5,/)') 'energy of start configuration: ',eol
87
[bd2278d]88! Write start configuration in pdb-format into file
[e40e335]89 call outpdb(0, "start.pdb")
90
[bd2278d]91! =====================Equilibration by Metropolis
[e40e335]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
[bd2278d]98!======================Simulation by simulated annealing
[e40e335]99 acz = 0.0d0
100 ymin = eol
101 do nsw=0,nswp
102 beta = bmin*db**nsw
103 call metropolis(eol,acz,can_weight)
[bd2278d]104! Store lowest-energy conformation
[e40e335]105 if(eol.lt.ymin) then
106 ymin = eol
107 nemin = nsw
108 call outvar(0,'global.var')
[bd2278d]109! Output of lowest-energy conformation as pdb-file
[e40e335]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
[bd2278d]116!
[e40e335]117 if(mod(nsw,nmes).eq.0) then
[bd2278d]118! Measure radius of gyration and end-to-end distance
[e40e335]119 call rgyr(1, rgy, ee)
[bd2278d]120! Determine Zimmerman code of actual conformation
[e40e335]121 call zimmer(nresi)
[bd2278d]122! Write down information on actual conformation
[e40e335]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
[bd2278d]129!
[e40e335]130 end do
131
132 acz = acz/dble(nsw*nvr)
133 write(*,*) 'acceptance rate:',acz
134 write(*,*)
[bd2278d]135! ------------ Output Dihedreals of final configuration
[e40e335]136 write(*,*) 'last energy',eol
137 call outvar(0,' ')
[bd2278d]138! Output final conformation as pdb-file
[e40e335]139 call outpdb(0,"final.pdb")
140 write(*,*)
141
[bd2278d]142! ------------ Output Dihedreals of conformation with lowest energy
[e40e335]143 write(*,*) 'lowest energy ever found:',nemin,ymin
144 close(14)
[bd2278d]145! =====================
[e40e335]146
147
148 end
149
150
Note: See TracBrowser for help on using the repository browser.