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 | ! **************************************************************
|
---|
11 |
|
---|
12 | subroutine canon(nequi, nswp, nmes, temp, lrand)
|
---|
13 | ! -----------------------------------------------------------------
|
---|
14 | ! PURPOSE: CANONICAL SIMULATION OF PROTEINS USING METROPOLIS UPDATES
|
---|
15 | !
|
---|
16 | ! CALLS: addang,energy,metropolis,hbond,helix,outvar,outpdb,rgyr
|
---|
17 | !
|
---|
18 | !-------------------------------------------------------------------
|
---|
19 | include 'INCL.H'
|
---|
20 |
|
---|
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
|
---|
26 |
|
---|
27 | ! external rand
|
---|
28 | external can_weight
|
---|
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 |
|
---|
34 |
|
---|
35 | logical lrand
|
---|
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
|
---|
41 | integer nequi
|
---|
42 | ! nswp: Number of sweeps for simulation run
|
---|
43 | integer nswp
|
---|
44 | ! nmes: Number of sweeps between measurments
|
---|
45 | integer nmes
|
---|
46 | ! temp: Temperature of simulation
|
---|
47 | double precision temp, e_min
|
---|
48 | !
|
---|
49 | ! common/bet/beta
|
---|
50 |
|
---|
51 | character*80 file
|
---|
52 |
|
---|
53 | ! Define files for output:
|
---|
54 | open(13,file='time.d')
|
---|
55 |
|
---|
56 |
|
---|
57 | beta=1.0/ ( temp * 1.98773d-3 )
|
---|
58 |
|
---|
59 | ! _________________________________ random start
|
---|
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()
|
---|
70 | e_min = eol
|
---|
71 | write (*,'(a,e12.5,/)') 'energy of start configuration:',eol
|
---|
72 |
|
---|
73 | ! Write start configuration in pdb-format into file
|
---|
74 | call outpdb(0,'start.pdb')
|
---|
75 |
|
---|
76 | ! =====================Equilibration by Metropolis
|
---|
77 | acz = 0.0d0
|
---|
78 | do nsw=1,nequi
|
---|
79 | call metropolis(eol,acz,can_weight)
|
---|
80 | end do
|
---|
81 | write(*,*) 'Energy after equilibration:',eol
|
---|
82 |
|
---|
83 | !======================Simulation in canonical ensemble
|
---|
84 | acz = 0.0d0
|
---|
85 | do nsw=0,nswp
|
---|
86 | call metropolis(eol,acz,can_weight)
|
---|
87 | if (eol.lt.e_min) then
|
---|
88 | write (*,*) "New minimum energy:", eol, "t=", nsw
|
---|
89 | write (*,*) eyel,eyhb,eyvr,eysl
|
---|
90 | e_min = eol
|
---|
91 | call outpdb(0, "minen.pdb")
|
---|
92 | endif
|
---|
93 | !
|
---|
94 | if(mod(nsw,nmes).eq.0) then
|
---|
95 | ! Measure radius of gyration and end-to-end distance
|
---|
96 | ! rgy: radius of gyration
|
---|
97 | ! ee: end-to-end distance
|
---|
98 | call rgyr(1,rgy,ee)
|
---|
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
|
---|
104 | call helix(nhel,mhel,nbet,mbet)
|
---|
105 | ! Measure number of hydrogen bonds (mhb)
|
---|
106 | do i=1,ntlml
|
---|
107 | call hbond(i,mhb,0)
|
---|
108 | end do
|
---|
109 | ! Write down information on actual conformation
|
---|
110 | write(13,'(i7,2f15.3,5i7,4f15.3)') nsw, eol, rgy,
|
---|
111 | & nhel,mhel,nbet,mbet,mhb,
|
---|
112 | & eyel,eyhb,eyvr,eysl
|
---|
113 | end if
|
---|
114 | !
|
---|
115 | end do
|
---|
116 |
|
---|
117 | acz = acz/dble(nsw*nvr)
|
---|
118 | write(*,*) 'acceptance rate:',acz
|
---|
119 | write(*,*)
|
---|
120 | ! ------------ Output Dihedreals of final configuration
|
---|
121 | write(*,*) 'last energy',eol
|
---|
122 | call outvar(0,'lastconf.var')
|
---|
123 | ! Output final conformation as pdb-file
|
---|
124 | call outpdb(0,'final.pdb')
|
---|
125 |
|
---|
126 | close(11)
|
---|
127 | close(12)
|
---|
128 | close(13)
|
---|
129 | ! =====================
|
---|
130 |
|
---|
131 |
|
---|
132 | end
|
---|
133 |
|
---|
134 | ! ********************************************************
|
---|
135 | real*8 function can_weight(x)
|
---|
136 | !
|
---|
137 | ! CALLS: none
|
---|
138 | !
|
---|
139 | implicit none
|
---|
140 | double precision beta, x
|
---|
141 |
|
---|
142 |
|
---|
143 | common/bet/beta
|
---|
144 |
|
---|
145 | can_weight = beta*x
|
---|
146 |
|
---|
147 | return
|
---|
148 |
|
---|
149 | end
|
---|