source: canon.f

Last change on this file was 38d77eb, checked in by baerbaer <baerbaer@…>, 14 years ago

Redirected standard out to logString.

SMMP produced a lot of log messages. This became an issue when run in massively
parallel environments. I replaced all writes to standard out to a write to logString.
The next step is to pass this string to a function that writes the messages to a log
file according to their importance and the chosen log level.

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

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[bd2278d]1! **************************************************************
2!
3! This file contains the subroutines: canon,can_weight
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! **************************************************************
[e40e335]11
12 subroutine canon(nequi, nswp, nmes, temp, lrand)
[bd2278d]13! -----------------------------------------------------------------
14! PURPOSE: CANONICAL SIMULATION OF PROTEINS USING METROPOLIS UPDATES
15!
16! CALLS: addang,energy,metropolis,hbond,helix,outvar,outpdb,rgyr
17!
18!-------------------------------------------------------------------
[e40e335]19 include 'INCL.H'
20
[bd2278d]21!f2py intent(in) nequi
22!f2py intent(in) nswp
23!f2py intent(in) nmes
24!f2py intent(in) temp
25!f2py logical optional, intent(in):: lrand = 1
[e40e335]26
[bd2278d]27! external rand
[e40e335]28 external can_weight
[6650a56]29
30 double precision dv, grnd, vr, addang, eol, energy, acz, rgy, ee
31
32 integer i, iv, nsw, nhel, mhel, nbet, mbet, mhb
33
[e40e335]34
35 logical lrand
[bd2278d]36! parameter(lrand=.false.)
37! parameter(nequi=10, nswp=1000,nmes=10)
38! parameter(temp=300.0)
39! lrand=.true.: creates random start configuration
40! nequi: Number of sweeps for equilibrisation of system
[e40e335]41 integer nequi
[bd2278d]42! nswp: Number of sweeps for simulation run
[e40e335]43 integer nswp
[bd2278d]44! nmes: Number of sweeps between measurments
[e40e335]45 integer nmes
[bd2278d]46! temp: Temperature of simulation
[cb47b9c]47 double precision temp, e_min
[bd2278d]48!
[e40e335]49! common/bet/beta
50
51 character*80 file
52
[bd2278d]53! Define files for output:
[e40e335]54 open(13,file='time.d')
55
56
57 beta=1.0/ ( temp * 1.98773d-3 )
58
[bd2278d]59! _________________________________ random start
[e40e335]60 if(lrand) then
61 do i=1,nvr
62 iv=idvr(i) ! provides index of non-fixed variable
63 dv=axvr(iv)*(grnd()-0.5)
64 vr=addang(pi,dv)
65 vlvr(iv)=vr
66 enddo
67 end if
68
69 eol = energy()
[cb47b9c]70 e_min = eol
[38d77eb]71 write (logString, '(a,e12.5,/)') 'energy of start configuration:',eol
[e40e335]72
[bd2278d]73! Write start configuration in pdb-format into file
[e40e335]74 call outpdb(0,'start.pdb')
75
[bd2278d]76! =====================Equilibration by Metropolis
[e40e335]77 acz = 0.0d0
78 do nsw=1,nequi
79 call metropolis(eol,acz,can_weight)
80 end do
[38d77eb]81 write (logString, *) 'Energy after equilibration:',eol
[e40e335]82
[bd2278d]83!======================Simulation in canonical ensemble
[e40e335]84 acz = 0.0d0
85 do nsw=0,nswp
86 call metropolis(eol,acz,can_weight)
[cb47b9c]87 if (eol.lt.e_min) then
[38d77eb]88 write (logString, *) "New minimum energy:", eol, "t=", nsw
89 write (logString, *) eyel,eyhb,eyvr,eysl
[cb47b9c]90 e_min = eol
91 call outpdb(0, "minen.pdb")
92 endif
[bd2278d]93!
[e40e335]94 if(mod(nsw,nmes).eq.0) then
[bd2278d]95! Measure radius of gyration and end-to-end distance
96! rgy: radius of gyration
97! ee: end-to-end distance
[e40e335]98 call rgyr(1,rgy,ee)
[bd2278d]99! Measure helicity
100! nhel: number of helical residues
101! mhel: number of helical segments
102! nbet: number of sheet-like residues
103! mbet: number of sheet-like segments
[e40e335]104 call helix(nhel,mhel,nbet,mbet)
[bd2278d]105! Measure number of hydrogen bonds (mhb)
[e40e335]106 do i=1,ntlml
107 call hbond(i,mhb,0)
108 end do
[bd2278d]109! Write down information on actual conformation
[cb47b9c]110 write(13,'(i7,2f15.3,5i7,4f15.3)') nsw, eol, rgy,
111 & nhel,mhel,nbet,mbet,mhb,
112 & eyel,eyhb,eyvr,eysl
[e40e335]113 end if
[bd2278d]114!
[e40e335]115 end do
116
117 acz = acz/dble(nsw*nvr)
[38d77eb]118 write (logString, *) 'acceptance rate:',acz
119 write (logString, *)
[bd2278d]120! ------------ Output Dihedreals of final configuration
[38d77eb]121 write (logString, *) 'last energy',eol
[e40e335]122 call outvar(0,'lastconf.var')
[bd2278d]123! Output final conformation as pdb-file
[e40e335]124 call outpdb(0,'final.pdb')
125
126 close(11)
127 close(12)
128 close(13)
[bd2278d]129! =====================
[e40e335]130
131
132 end
133
[bd2278d]134! ********************************************************
[e40e335]135 real*8 function can_weight(x)
[bd2278d]136!
137! CALLS: none
138!
[6650a56]139 implicit none
140 double precision beta, x
[e40e335]141
142
143 common/bet/beta
144
145 can_weight = beta*x
146
147 return
148
149 end
Note: See TracBrowser for help on using the repository browser.