Changeset bd2278d for mulcan_sim.f
- Timestamp:
- 09/05/08 11:49:42 (16 years ago)
- Branches:
- master
- Children:
- fafe4d6
- Parents:
- 2ebb8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mulcan_sim.f
r2ebb8b6 rbd2278d 1 c**************************************************************2 c 3 cThis file contains the subroutines: mulcan_sim,muca_weight24 c 5 cCopyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,6 cShura Hayryan, Chin-Ku7 cCopyright 2007 Frank Eisenmenger, U.H.E. Hansmann,8 cJan H. Meinke, Sandipan Mohanty9 c 10 c**************************************************************1 ! ************************************************************** 2 ! 3 ! This file contains the subroutines: mulcan_sim,muca_weight2 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 11 12 12 subroutine mulcan_sim 13 C 14 CPURPOSE: PERFORM A MULTICANONICAL SIMULATION15 CREQUIRES AS INPUT THE MULTICANONICAL PARAMETER AS CALCULATED16 CBY THE SUBROUTINE mulcan_par17 C 18 cCALLS: addang, contacts,energy,metropolis19 c 13 ! 14 ! PURPOSE: PERFORM A MULTICANONICAL SIMULATION 15 ! REQUIRES AS INPUT THE MULTICANONICAL PARAMETER AS CALCULATED 16 ! BY THE SUBROUTINE mulcan_par 17 ! 18 ! CALLS: addang, contacts,energy,metropolis 19 ! 20 20 include 'INCL.H' 21 21 22 cexternal rand22 ! external rand 23 23 external muca_weight2 24 24 … … 29 29 parameter(nsweep=100000,nequi=100) 30 30 Parameter(nsave=1000,nmes=10) 31 C 32 Crestart: .true. = restart of simulation33 C.false. = start of simulation with random configuration34 Ckmin,kmax: Range of multicanonical parameter35 Cebin: bin size for multicanonical parameter36 Cnequi: Number of sweeps for equilibrisation37 Cnsweep: Number of sweeps for simulation run38 Cnsave: Number of sweeps after which actual configuration is saved39 Cfor re-starts40 Cnmes: Number of sweeps between measurments41 C 31 ! 32 ! restart: .true. = restart of simulation 33 ! .false. = start of simulation with random configuration 34 ! kmin,kmax: Range of multicanonical parameter 35 ! ebin: bin size for multicanonical parameter 36 ! nequi: Number of sweeps for equilibrisation 37 ! nsweep: Number of sweeps for simulation run 38 ! nsave: Number of sweeps after which actual configuration is saved 39 ! for re-starts 40 ! nmes: Number of sweeps between measurments 41 ! 42 42 43 43 dimension xhist(kmin:kmax),ihist(kmin:kmax) … … 45 45 46 46 47 CFILE with last conformation (for re-starts)47 ! FILE with last conformation (for re-starts) 48 48 open(8,file='EXAMPLES/start.d') 49 CFile with contact map of reference configuration49 ! File with contact map of reference configuration 50 50 open(9,file='EXAMPLES/enkefa.ref') 51 CFile with multicanonical parameter51 ! File with multicanonical parameter 52 52 open(10,file='EXAMPLES/muca.d') 53 CResult file: Time series of certain quantities53 ! Result file: Time series of certain quantities 54 54 open(11, file='EXAMPLES/time.d') 55 55 … … 60 60 61 61 nresi=irsml2(1)-irsml1(1) + 1 62 cnresi: Number of residues63 64 CREAD REFERENCE CONTACT MAP62 ! nresi: Number of residues 63 64 ! READ REFERENCE CONTACT MAP 65 65 nci = 0 66 66 do i=1,nresi … … 74 74 write(*,*) 'Number of contacts in reference conformation:',nci 75 75 76 CREAD IN FIELDS WITH MULTICANONICAL PARAMETER76 ! READ IN FIELDS WITH MULTICANONICAL PARAMETER 77 77 Do j=kmin,kmax 78 78 read(10,*) i,b(i),alpha(i) 79 79 end do 80 C 80 ! 81 81 82 82 if(restart) then … … 90 90 write(*,*) 'Last iteration, energy:',nswm,eol_old 91 91 else 92 c_________________________________ random start92 ! _________________________________ random start 93 93 do i=1,nvr 94 94 iv=idvr(i) ! provides index of non-fixed variable … … 98 98 enddo 99 99 end if 100 c 100 ! 101 101 eol = energy() 102 102 write (*,'(e12.5,/)') eol … … 109 109 end do 110 110 write(*,*) 111 C 111 ! 112 112 113 113 114 114 if(.not.restart) then 115 c=====================Equilibrization by Metropolis115 ! =====================Equilibrization by Metropolis 116 116 do nsw=1,nequi 117 117 call metropolis(eol,acz,muca_weight2) … … 123 123 end if 124 124 125 C======================Simulation125 !======================Simulation 126 126 acz = 0.0d0 127 CLOOP OVER SWEEPS127 ! LOOP OVER SWEEPS 128 128 do nsw=nswm,nsweep 129 C 130 CMETROPOLIS UPDATE129 ! 130 ! METROPOLIS UPDATE 131 131 call metropolis(eol,acz,muca_weight2) 132 132 muold = min(kmax,max(kmin,int(eol/ebin+sign(0.5d0,eol)))) 133 133 ihist(muold) = ihist(muold) + 1 134 C 135 CSAVE ACTUAL CONFORMATIONS FOR RE-STARTS:134 ! 135 ! SAVE ACTUAL CONFORMATIONS FOR RE-STARTS: 136 136 if(mod(nsw,nsave).eq.0) then 137 137 rewind 8 … … 143 143 end do 144 144 end if 145 CMeasurements after NMES sweeps145 ! Measurements after NMES sweeps 146 146 if(mod(nsw,nmes).eq.0) then 147 CTake a histogram of energy147 ! Take a histogram of energy 148 148 do i=kmin,kmax 149 149 xhist(i) = xhist(i) + ihist(i) 150 150 ihist(i) = 0 151 151 end do 152 cCalculate contacts in actual configuartion and compare with reference153 Cconfiguration154 ccall contacts(nhx,nhy,dham)155 Cnhx : Number of contcats in actual conformation156 Cnhy : Number of contacts which are identical in actual and reference157 Cconfiguration158 Cdham: Hamming distance between actual and reference configuration159 C 152 ! Calculate contacts in actual configuartion and compare with reference 153 ! configuration 154 ! call contacts(nhx,nhy,dham) 155 ! nhx : Number of contcats in actual conformation 156 ! nhy : Number of contacts which are identical in actual and reference 157 ! configuration 158 ! dham: Hamming distance between actual and reference configuration 159 ! 160 160 write(11,'(i7,f12.2,2i8,f12.4)') nsw,eol,nhx,nhy,dham 161 161 end if 162 162 end do 163 CEND OF SIMULATION164 165 CFINAL OUTPUT:163 ! END OF SIMULATION 164 165 ! FINAL OUTPUT: 166 166 acz = acz/dble(nsw*nvr) 167 167 write(*,*) 'last energy',eol 168 168 write(*,*) 'aczeptance rate:',acz 169 169 170 CWRITE DOWN (UN-REWEIGHTED) HISTOGRAM OF MULTICANONICAL SIMULATION170 ! WRITE DOWN (UN-REWEIGHTED) HISTOGRAM OF MULTICANONICAL SIMULATION 171 171 do i=kmin,kmax 172 172 if(xhist(i).gt.0.0d0) then … … 174 174 end if 175 175 end do 176 c=====================176 ! ===================== 177 177 close(8) 178 178 close(9) … … 183 183 end 184 184 185 c************************************************************185 ! ************************************************************ 186 186 real*8 function muca_weight2(x) 187 187
Note:
See TracChangeset
for help on using the changeset viewer.