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 | logical lrand
|
---|
31 | ! parameter(lrand=.false.)
|
---|
32 | ! parameter(nequi=10, nswp=1000,nmes=10)
|
---|
33 | ! parameter(temp=300.0)
|
---|
34 | ! lrand=.true.: creates random start configuration
|
---|
35 | ! nequi: Number of sweeps for equilibrisation of system
|
---|
36 | integer nequi
|
---|
37 | ! nswp: Number of sweeps for simulation run
|
---|
38 | integer nswp
|
---|
39 | ! nmes: Number of sweeps between measurments
|
---|
40 | integer nmes
|
---|
41 | ! temp: Temperature of simulation
|
---|
42 | double precision temp
|
---|
43 | !
|
---|
44 | ! common/bet/beta
|
---|
45 |
|
---|
46 | character*80 file
|
---|
47 |
|
---|
48 | ! Define files for output:
|
---|
49 | open(13,file='time.d')
|
---|
50 |
|
---|
51 |
|
---|
52 | beta=1.0/ ( temp * 1.98773d-3 )
|
---|
53 |
|
---|
54 | ! _________________________________ random start
|
---|
55 | if(lrand) then
|
---|
56 | do i=1,nvr
|
---|
57 | iv=idvr(i) ! provides index of non-fixed variable
|
---|
58 | dv=axvr(iv)*(grnd()-0.5)
|
---|
59 | vr=addang(pi,dv)
|
---|
60 | vlvr(iv)=vr
|
---|
61 | enddo
|
---|
62 | end if
|
---|
63 |
|
---|
64 | eol = energy()
|
---|
65 | write (*,'(a,e12.5,/)') 'energy of start configuration:',eol
|
---|
66 |
|
---|
67 | ! Write start configuration in pdb-format into file
|
---|
68 | call outpdb(0,'start.pdb')
|
---|
69 |
|
---|
70 | ! =====================Equilibration by Metropolis
|
---|
71 | acz = 0.0d0
|
---|
72 | do nsw=1,nequi
|
---|
73 | call metropolis(eol,acz,can_weight)
|
---|
74 | end do
|
---|
75 | write(*,*) 'Energy after equilibration:',eol
|
---|
76 |
|
---|
77 | !======================Simulation in canonical ensemble
|
---|
78 | acz = 0.0d0
|
---|
79 | do nsw=0,nswp
|
---|
80 | call metropolis(eol,acz,can_weight)
|
---|
81 | !
|
---|
82 | if(mod(nsw,nmes).eq.0) then
|
---|
83 | ! Measure radius of gyration and end-to-end distance
|
---|
84 | ! rgy: radius of gyration
|
---|
85 | ! ee: end-to-end distance
|
---|
86 | call rgyr(1,rgy,ee)
|
---|
87 | ! Measure helicity
|
---|
88 | ! nhel: number of helical residues
|
---|
89 | ! mhel: number of helical segments
|
---|
90 | ! nbet: number of sheet-like residues
|
---|
91 | ! mbet: number of sheet-like segments
|
---|
92 | call helix(nhel,mhel,nbet,mbet)
|
---|
93 | ! Measure number of hydrogen bonds (mhb)
|
---|
94 | do i=1,ntlml
|
---|
95 | call hbond(i,mhb,0)
|
---|
96 | end do
|
---|
97 | ! Write down information on actual conformation
|
---|
98 | write(13,'(i5,2f12.3,5i7)') nsw, eol, rgy,
|
---|
99 | & nhel,mhel,nbet,mbet,mhb
|
---|
100 | end if
|
---|
101 | !
|
---|
102 | end do
|
---|
103 |
|
---|
104 | acz = acz/dble(nsw*nvr)
|
---|
105 | write(*,*) 'acceptance rate:',acz
|
---|
106 | write(*,*)
|
---|
107 | ! ------------ Output Dihedreals of final configuration
|
---|
108 | write(*,*) 'last energy',eol
|
---|
109 | call outvar(0,'lastconf.var')
|
---|
110 | ! Output final conformation as pdb-file
|
---|
111 | call outpdb(0,'final.pdb')
|
---|
112 |
|
---|
113 | close(11)
|
---|
114 | close(12)
|
---|
115 | close(13)
|
---|
116 | ! =====================
|
---|
117 |
|
---|
118 |
|
---|
119 | end
|
---|
120 |
|
---|
121 | ! ********************************************************
|
---|
122 | real*8 function can_weight(x)
|
---|
123 | !
|
---|
124 | ! CALLS: none
|
---|
125 | !
|
---|
126 |
|
---|
127 | implicit real*8 (a-h,o-z)
|
---|
128 |
|
---|
129 | common/bet/beta
|
---|
130 |
|
---|
131 | can_weight = beta*x
|
---|
132 |
|
---|
133 | return
|
---|
134 |
|
---|
135 | end
|
---|