1 subroutine probabl(ib,nlist,ncon,*)
2 ! construct the conformational ensembles at REMD temperatures
9 integer ierror,errcode,status(MPI_STATUS_SIZE)
11 include "COMMON.IOUNITS"
13 include "COMMON.FFIELD"
14 include "COMMON.INTERACT"
15 include "COMMON.SBRIDGE"
16 include "COMMON.CHAIN"
17 include "COMMON.CLUSTER"
18 real*4 csingle(3,maxres2)
19 double precision fT(5),fTprim(5),fTbis(5),quot,quotl1,quotl,kfacl,
20 & eprim,ebis,temper,kfac/2.4d0/,T0/300.0d0/
21 double precision etot,evdw,evdw2,ees,evdw1,ebe,etors,escloc,
22 & ehpb,ecorr,ecorr5,ecorr6,eello_turn4,eello_turn3,
23 & eturn6,eel_loc,edihcnstr,etors_d,estr,evdw2_14,esccor
24 integer i,ii,ik,iproc,iscor,j,k,l,ib,nlist,ncon
25 double precision qfree,sumprob,eini,efree,rmsdev
31 real*4 Fdimless(maxconf)
32 double precision energia(0:max_ene)
37 c write (iout,*) i,list_conf(i)
40 c write(iout,*) "entrop before", entfac(i),i
44 write (iout,*) me," indstart",indstart(me)," indend",indend(me)
45 call daread_ccoords(indstart(me),indend(me))
48 c write(iout,*) "entrop after", entfac(i),i
51 c write (iout,*) "ncon",ncon
53 temper=1.0d0/(beta_h(ib)*1.987D-3)
54 c write (iout,*) "ib",ib," beta_h",beta_h(ib)," temper",temper
55 c quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
62 c fT(l)=kfacl/(kfacl-1.0d0+quotl)
64 if (rescale_mode.eq.1) then
65 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
72 fT(l)=kfacl/(kfacl-1.0d0+quotl)
74 else if (rescale_mode.eq.2) then
75 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
79 fT(l)=1.12692801104297249644d0/
80 & dlog(dexp(quotl)+dexp(-quotl))
82 c write (iout,*) 1.0d0/(beta_h(ib)*1.987D-3),ft
93 c write (iout,*) "i",i," ii",ii
99 c(k,j+nres)=allcart(k,j+nres,i)
104 c(k,nres+nres)=c(k,nres)
108 ihpb(j)=ihpb_all(j,i)
109 jhpb(j)=jhpb_all(j,i)
111 call int_from_cart1(.false.)
112 call etotal(energia(0),fT)
113 totfree(i)=energia(0)
115 write (iout,*) i," energia",(energia(j),j=0,20)
116 call enerprint(energia(0),ft)
120 enetb(k,i)=energia(k)
126 evdw2=enetb(2,i)+evdw2_14
141 cc if (wcorr6.eq.0) ecorr6=0.0d0
143 eello_turn3=enetb(8,i)
144 eello_turn4=enetb(9,i)
153 edihcnstr=enetb(20,i)
154 ehomology_constr=enetb(21,i)
156 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*ees+wvdwpp*evdw1
157 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
158 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
159 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
160 & +ft(2)*wturn3*eello_turn3
161 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc
162 & +edihcnstr+ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
163 & +wbond*estr+ehomology_constr
165 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*(ees+evdw1)
166 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
167 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
168 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
169 & +ft(2)*wturn3*eello_turn3
170 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc+edihcnstr
171 & +ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
172 & +wbond*estr+ehomology_constr
174 Fdimless(i)=beta_h(ib)*etot+entfac(ii)
178 write (iout,*) "etrop", i,ii,ib,
179 & 1.0d0/(1.987d-3*beta_h(ib)),totfree(i),
180 & entfac(ii),Fdimless(i)
184 call MPI_Gatherv(Fdimless(1),scount(me),
185 & MPI_REAL,Fdimless(1),
186 & scount(0),idispl(0),MPI_REAL,Master,
187 & MPI_COMM_WORLD, IERROR)
188 call MPI_Gatherv(totfree(1),scount(me),
189 & MPI_DOUBLE_PRECISION,totfree(1),
190 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
191 & MPI_COMM_WORLD, IERROR)
192 call MPI_Gatherv(entfac(indstart(me)+1),scount(me),
193 & MPI_DOUBLE_PRECISION,entfac(1),
194 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
195 & MPI_COMM_WORLD, IERROR)
196 if (me.eq.Master) then
200 write (iout,*) "The FDIMLESS array before sorting"
202 write (iout,*) i,fdimless(i)
205 call mysort1(ncon,Fdimless,list_conf)
207 write (iout,*) "The FDIMLESS array after sorting"
209 write (iout,*) i,list_conf(i),fdimless(i)
214 totfree(i)=fdimless(i)
218 qfree=qfree+dexp(dble(-fdimless(i)+fdimless(1)))
220 c write (iout,*) "qfree",qfree
223 do i=1,min0(ncon,maxstr_proc)-1
224 sumprob=sumprob+dexp(dble(-fdimless(i)+fdimless(1)))/qfree
227 write (iout,*) 'i=',i,ib,beta_h(ib),
228 & 1.0d0/(1.987d-3*beta_h(ib)),list_conf(i),
229 & totfree(list_conf(i)),
230 & -entfac(list_conf(i)),fdimless(i),sumprob
233 if (sumprob.gt.prob_limit) goto 122
234 c if (sumprob.gt.1.00d0) goto 122
240 call MPI_Bcast(nlist, 1, MPI_INTEGER, Master, MPI_COMM_WORLD,
242 call MPI_Bcast(list_conf,nlist,MPI_INTEGER,Master,MPI_COMM_WORLD,
245 c write (iout,*) "iproc",iproc," indstart",indstart(iproc),
246 c & " indend",indend(iproc)
248 write (iout,*) "nlist",nlist
252 !--------------------------------------------------
253 subroutine mysort1(n, x, ipermut)
255 integer i,j,imax,ipm,n
263 if (x(j).lt.xtemp) then
271 ipermut(imax)=ipermut(i)