[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
|
---|
| 29 |
|
---|
| 30 | logical lrand
|
---|
[bd2278d] | 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
|
---|
[e40e335] | 36 | integer nequi
|
---|
[bd2278d] | 37 | ! nswp: Number of sweeps for simulation run
|
---|
[e40e335] | 38 | integer nswp
|
---|
[bd2278d] | 39 | ! nmes: Number of sweeps between measurments
|
---|
[e40e335] | 40 | integer nmes
|
---|
[bd2278d] | 41 | ! temp: Temperature of simulation
|
---|
[cb47b9c] | 42 | double precision temp, e_min
|
---|
[bd2278d] | 43 | !
|
---|
[e40e335] | 44 | ! common/bet/beta
|
---|
| 45 |
|
---|
| 46 | character*80 file
|
---|
| 47 |
|
---|
[bd2278d] | 48 | ! Define files for output:
|
---|
[e40e335] | 49 | open(13,file='time.d')
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | beta=1.0/ ( temp * 1.98773d-3 )
|
---|
| 53 |
|
---|
[bd2278d] | 54 | ! _________________________________ random start
|
---|
[e40e335] | 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()
|
---|
[cb47b9c] | 65 | e_min = eol
|
---|
[e40e335] | 66 | write (*,'(a,e12.5,/)') 'energy of start configuration:',eol
|
---|
| 67 |
|
---|
[bd2278d] | 68 | ! Write start configuration in pdb-format into file
|
---|
[e40e335] | 69 | call outpdb(0,'start.pdb')
|
---|
| 70 |
|
---|
[bd2278d] | 71 | ! =====================Equilibration by Metropolis
|
---|
[e40e335] | 72 | acz = 0.0d0
|
---|
| 73 | do nsw=1,nequi
|
---|
| 74 | call metropolis(eol,acz,can_weight)
|
---|
| 75 | end do
|
---|
| 76 | write(*,*) 'Energy after equilibration:',eol
|
---|
| 77 |
|
---|
[bd2278d] | 78 | !======================Simulation in canonical ensemble
|
---|
[e40e335] | 79 | acz = 0.0d0
|
---|
| 80 | do nsw=0,nswp
|
---|
| 81 | call metropolis(eol,acz,can_weight)
|
---|
[cb47b9c] | 82 | if (eol.lt.e_min) then
|
---|
| 83 | write (*,*) "New minimum energy:", eol, "t=", nsw
|
---|
| 84 | write (*,*) eyel,eyhb,eyvr,eysl
|
---|
| 85 | e_min = eol
|
---|
| 86 | call outpdb(0, "minen.pdb")
|
---|
| 87 | endif
|
---|
[bd2278d] | 88 | !
|
---|
[e40e335] | 89 | if(mod(nsw,nmes).eq.0) then
|
---|
[bd2278d] | 90 | ! Measure radius of gyration and end-to-end distance
|
---|
| 91 | ! rgy: radius of gyration
|
---|
| 92 | ! ee: end-to-end distance
|
---|
[e40e335] | 93 | call rgyr(1,rgy,ee)
|
---|
[bd2278d] | 94 | ! Measure helicity
|
---|
| 95 | ! nhel: number of helical residues
|
---|
| 96 | ! mhel: number of helical segments
|
---|
| 97 | ! nbet: number of sheet-like residues
|
---|
| 98 | ! mbet: number of sheet-like segments
|
---|
[e40e335] | 99 | call helix(nhel,mhel,nbet,mbet)
|
---|
[bd2278d] | 100 | ! Measure number of hydrogen bonds (mhb)
|
---|
[e40e335] | 101 | do i=1,ntlml
|
---|
| 102 | call hbond(i,mhb,0)
|
---|
| 103 | end do
|
---|
[bd2278d] | 104 | ! Write down information on actual conformation
|
---|
[cb47b9c] | 105 | write(13,'(i7,2f15.3,5i7,4f15.3)') nsw, eol, rgy,
|
---|
| 106 | & nhel,mhel,nbet,mbet,mhb,
|
---|
| 107 | & eyel,eyhb,eyvr,eysl
|
---|
[e40e335] | 108 | end if
|
---|
[bd2278d] | 109 | !
|
---|
[e40e335] | 110 | end do
|
---|
| 111 |
|
---|
| 112 | acz = acz/dble(nsw*nvr)
|
---|
| 113 | write(*,*) 'acceptance rate:',acz
|
---|
| 114 | write(*,*)
|
---|
[bd2278d] | 115 | ! ------------ Output Dihedreals of final configuration
|
---|
[e40e335] | 116 | write(*,*) 'last energy',eol
|
---|
| 117 | call outvar(0,'lastconf.var')
|
---|
[bd2278d] | 118 | ! Output final conformation as pdb-file
|
---|
[e40e335] | 119 | call outpdb(0,'final.pdb')
|
---|
| 120 |
|
---|
| 121 | close(11)
|
---|
| 122 | close(12)
|
---|
| 123 | close(13)
|
---|
[bd2278d] | 124 | ! =====================
|
---|
[e40e335] | 125 |
|
---|
| 126 |
|
---|
| 127 | end
|
---|
| 128 |
|
---|
[bd2278d] | 129 | ! ********************************************************
|
---|
[e40e335] | 130 | real*8 function can_weight(x)
|
---|
[bd2278d] | 131 | !
|
---|
| 132 | ! CALLS: none
|
---|
| 133 | !
|
---|
[e40e335] | 134 |
|
---|
| 135 | implicit real*8 (a-h,o-z)
|
---|
| 136 |
|
---|
| 137 | common/bet/beta
|
---|
| 138 |
|
---|
| 139 | can_weight = beta*x
|
---|
| 140 |
|
---|
| 141 | return
|
---|
| 142 |
|
---|
| 143 | end
|
---|